Stay organized with collections Save and categorize content based on your preferences.

RowHeaderPresenter

public class RowHeaderPresenter extends Presenter


RowHeaderPresenter provides a default presentation for HeaderItem using a RowHeaderView and optionally a TextView for description. If a subclass creates its own view, the subclass must also override onCreateViewHolder, onSelectLevelChanged.

Summary

Nested types

A ViewHolder for the RowHeaderPresenter.

Public constructors

Creates default RowHeaderPresenter using a title view and a description view.

Public methods

int

Returns the space (distance in pixels) below the baseline of the text view, if one exists; otherwise, returns 0.

boolean

Returns true if the view visibility is set to GONE when bound to null.

void

Binds a View to an item.

Presenter.ViewHolder

Creates a new View.

void

Unbinds a View from an item.

void
setNullItemVisibilityGone(boolean nullItemVisibilityGone)

Optionally sets the view visibility to GONE when bound to null.

final void
setSelectLevel(RowHeaderPresenter.ViewHolder holder, float selectLevel)

Sets the select level.

Protected methods

static float
getFontDescent(TextView textView, Paint fontMeasurePaint)
void

Called when the select level changes.

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(
    Presenter.ViewHolder viewHolder,
    Object item,
    List<Object> payloads
)

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

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.

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

RowHeaderPresenter

public RowHeaderPresenter()

Creates default RowHeaderPresenter using a title view and a description view.

Public methods

getSpaceUnderBaseline

public int getSpaceUnderBaseline(RowHeaderPresenter.ViewHolder holder)

Returns the space (distance in pixels) below the baseline of the text view, if one exists; otherwise, returns 0.

isNullItemVisibilityGone

public boolean isNullItemVisibilityGone()

Returns true if the view visibility is set to GONE when bound to null.

onBindViewHolder

public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item)

Binds a View to an item.

onCreateViewHolder

public Presenter.ViewHolder onCreateViewHolder(ViewGroup parent)

Creates a new View.

onUnbindViewHolder

public void onUnbindViewHolder(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.

setNullItemVisibilityGone

public void setNullItemVisibilityGone(boolean nullItemVisibilityGone)

Optionally sets the view visibility to GONE when bound to null.

setSelectLevel

public final void setSelectLevel(RowHeaderPresenter.ViewHolder holder, float selectLevel)

Sets the select level.

Protected methods

getFontDescent

protected static float getFontDescent(TextView textView, Paint fontMeasurePaint)

onSelectLevelChanged

protected void onSelectLevelChanged(RowHeaderPresenter.ViewHolder holder)

Called when the select level changes. The default implementation sets the alpha on the view.