AbstractDetailsDescriptionPresenter


public abstract class AbstractDetailsDescriptionPresenter extends Presenter


An abstract Presenter for rendering a detailed description of an item. Typically this Presenter will be used in a FullWidthDetailsOverviewRowPresenter or PlaybackControlsRowPresenter.

Subclasses must override onBindDescription to implement the data binding for this Presenter.

Summary

Public constructors

Public methods

final void
onBindViewHolder(
    @NonNull Presenter.ViewHolder viewHolder,
    @Nullable Object item
)

Binds a View to an item.

final @NonNull AbstractDetailsDescriptionPresenter.ViewHolder

Creates a new View.

void

Unbinds a View from an item.

void

Called when a view created by this presenter has been attached to a window.

void

Called when a view created by this presenter has been detached from its window.

Protected methods

abstract void

Binds the data from the item to the ViewHolder.

Inherited methods

From androidx.leanback.widget.FacetProvider
abstract @Nullable Object
getFacet(@NonNull Class<Object> facetClass)

Queries optional implemented facet.

From androidx.leanback.widget.Presenter
static void

Utility method for removing all running animations on a view.

final Object
getFacet(Class<Object> facetClass)

Queries optional implemented facet.

void
onBindViewHolder(
    @NonNull Presenter.ViewHolder viewHolder,
    @NonNull Object item,
    @NonNull List<Object> payloads
)

Binds a View to an item with a list of payloads.

final void
setFacet(Class<Object> facetClass, Object facetImpl)

Sets dynamic implemented facet in addition to basic Presenter functions.

void

Called to set a click listener for the given view holder.

Public constructors

AbstractDetailsDescriptionPresenter

Added in 1.1.0
public AbstractDetailsDescriptionPresenter()

Public methods

onBindViewHolder

Added in 1.2.0-alpha04
public final void onBindViewHolder(
    @NonNull Presenter.ViewHolder viewHolder,
    @Nullable Object item
)

Binds a View to an item.

onCreateViewHolder

Added in 1.2.0-alpha04
public final @NonNull AbstractDetailsDescriptionPresenter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent)

Creates a new View.

onUnbindViewHolder

Added in 1.2.0-alpha04
public void onUnbindViewHolder(@NonNull Presenter.ViewHolder viewHolder)

Unbinds a View from an item. Any expensive references may be released here, and any fields that are not bound for every item should be cleared here.

onViewAttachedToWindow

public void onViewAttachedToWindow(@NonNull Presenter.ViewHolder holder)

Called when a view created by this presenter has been attached to a window.

This can be used as a reasonable signal that the view is about to be seen by the user. If the adapter previously freed any resources in onViewDetachedFromWindow those resources should be restored here.

Parameters
@NonNull Presenter.ViewHolder holder

Holder of the view being attached

onViewDetachedFromWindow

public void onViewDetachedFromWindow(@NonNull Presenter.ViewHolder holder)

Called when a view created by this presenter has been detached from its window.

Becoming detached from the window is not necessarily a permanent condition; the consumer of an presenter's views may choose to cache views offscreen while they are not visible, attaching and detaching them as appropriate.

Any view property animations should be cancelled here or the view may fail to be recycled.
Parameters
@NonNull Presenter.ViewHolder holder

Holder of the view being detached

Protected methods

onBindDescription

Added in 1.1.0
protected abstract void onBindDescription(
    @NonNull AbstractDetailsDescriptionPresenter.ViewHolder vh,
    @NonNull Object item
)

Binds the data from the item to the ViewHolder. The item is typically associated with a DetailsOverviewRow or PlaybackControlsRow.

Parameters
@NonNull AbstractDetailsDescriptionPresenter.ViewHolder vh

The ViewHolder for this details description view.

@NonNull Object item

The item being presented.