added in version 1.0.0
belongs to Maven artifact androidx.leanback:leanback:1.0.0-beta01

RowHeaderPresenter

public class RowHeaderPresenter
extends Presenter

java.lang.Object
   ↳ androidx.leanback.widget.Presenter
     ↳ androidx.leanback.widget.RowHeaderPresenter


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(ViewGroup), onSelectLevelChanged(ViewHolder).

Summary

Nested classes

class RowHeaderPresenter.ViewHolder

A ViewHolder for the RowHeaderPresenter. 

Public constructors

RowHeaderPresenter()

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

Public methods

int getSpaceUnderBaseline(RowHeaderPresenter.ViewHolder holder)

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

boolean isNullItemVisibilityGone()

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

void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item)

Binds a View to an item.

Presenter.ViewHolder onCreateViewHolder(ViewGroup parent)

Creates a new View.

void onUnbindViewHolder(Presenter.ViewHolder viewHolder)

Unbinds a View from an item.

void setNullItemVisibilityGone(boolean nullItemVisibilityGone)

Optionally sets the view visibility to View.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 onSelectLevelChanged(RowHeaderPresenter.ViewHolder holder)

Called when the select level changes.

Inherited methods

Public constructors

RowHeaderPresenter

added in version 1.0.0
public RowHeaderPresenter ()

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

Public methods

getSpaceUnderBaseline

added in version 1.0.0
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.

Parameters
holder RowHeaderPresenter.ViewHolder

Returns
int

isNullItemVisibilityGone

added in version 1.0.0
public boolean isNullItemVisibilityGone ()

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

Returns
boolean

onBindViewHolder

added in version 1.0.0
public void onBindViewHolder (Presenter.ViewHolder viewHolder, 
                Object item)

Binds a View to an item.

Parameters
viewHolder Presenter.ViewHolder

item Object

onCreateViewHolder

added in version 1.0.0
public Presenter.ViewHolder onCreateViewHolder (ViewGroup parent)

Creates a new View.

Parameters
parent ViewGroup

Returns
Presenter.ViewHolder

onUnbindViewHolder

added in version 1.0.0
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.

Parameters
viewHolder Presenter.ViewHolder

setNullItemVisibilityGone

added in version 1.0.0
public void setNullItemVisibilityGone (boolean nullItemVisibilityGone)

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

Parameters
nullItemVisibilityGone boolean

setSelectLevel

added in version 1.0.0
public final void setSelectLevel (RowHeaderPresenter.ViewHolder holder, 
                float selectLevel)

Sets the select level.

Parameters
holder RowHeaderPresenter.ViewHolder

selectLevel float

Protected methods

getFontDescent

added in version 1.0.0
protected static float getFontDescent (TextView textView, 
                Paint fontMeasurePaint)

Parameters
textView TextView

fontMeasurePaint Paint

Returns
float

onSelectLevelChanged

added in version 1.0.0
protected void onSelectLevelChanged (RowHeaderPresenter.ViewHolder holder)

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

Parameters
holder RowHeaderPresenter.ViewHolder