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
onBindViewHolder(
    @NonNull Presenter.ViewHolder viewHolder,
    @Nullable Object item
)

Binds a View to an item.

@NonNull 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(
    @NonNull RowHeaderPresenter.ViewHolder holder,
    float selectLevel
)

Sets the select level.

Protected methods

static float
getFontDescent(@NonNull TextView textView, @NonNull 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(
    @NonNull Presenter.ViewHolder viewHolder,
    @NonNull Object item,
    @NonNull 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

Added in 1.1.0
public RowHeaderPresenter()

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

Public methods

getSpaceUnderBaseline

Added in 1.1.0
public int getSpaceUnderBaseline(@NonNull RowHeaderPresenter.ViewHolder holder)

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

isNullItemVisibilityGone

Added in 1.1.0
public boolean isNullItemVisibilityGone()

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

onBindViewHolder

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

Binds a View to an item.

onCreateViewHolder

Added in 1.2.0-alpha04
public @NonNull Presenter.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.

setNullItemVisibilityGone

Added in 1.1.0
public void setNullItemVisibilityGone(boolean nullItemVisibilityGone)

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

setSelectLevel

Added in 1.1.0
public final void setSelectLevel(
    @NonNull RowHeaderPresenter.ViewHolder holder,
    float selectLevel
)

Sets the select level.

Protected methods

getFontDescent

Added in 1.1.0
protected static float getFontDescent(@NonNull TextView textView, @NonNull Paint fontMeasurePaint)

onSelectLevelChanged

Added in 1.1.0
protected void onSelectLevelChanged(@NonNull RowHeaderPresenter.ViewHolder holder)

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