Most visited

Recently visited

AbstractMediaListHeaderPresenter

public abstract class AbstractMediaListHeaderPresenter
extends RowPresenter

java.lang.Object
   ↳ android.support.v17.leanback.widget.Presenter
     ↳ android.support.v17.leanback.widget.RowPresenter
       ↳ android.support.v17.leanback.widget.AbstractMediaListHeaderPresenter


Abstract presenter class for rendering the header for a list of media items in a playlist. The presenter creates a AbstractMediaListHeaderPresenter.ViewHolder for the TextView holding the header text.

Subclasses of this class must override onBindMediaListHeaderViewHolder(ViewHolder, Object) in order to bind their header text to the media list header view.

AbstractMediaItemPresenter can be used in conjunction with this presenter in order to display a playlist with a header view.

Summary

Nested classes

class AbstractMediaListHeaderPresenter.ViewHolder

The ViewHolder for the AbstractMediaListHeaderPresenter

Inherited constants

From class android.support.v17.leanback.widget.RowPresenter

Public constructors

AbstractMediaListHeaderPresenter(Context context, int mThemeResId)

Constructor used for creating an abstract media-list header presenter of a given theme.

AbstractMediaListHeaderPresenter()

Constructor used for creating an abstract media-list header presenter.

Public methods

boolean isUsingDefaultSelectEffect()

Returns true if this RowPresenter is using the default dimming effect.

void setBackgroundColor(int color)

Sets the background color for the row views within the playlist.

Protected methods

RowPresenter.ViewHolder createRowViewHolder(ViewGroup parent)

Called to create a ViewHolder object for a Row.

abstract void onBindMediaListHeaderViewHolder(AbstractMediaListHeaderPresenter.ViewHolder vh, Object item)

Binds the playlist header data model provided by the user to the AbstractMediaListHeaderPresenter.ViewHolder provided by the AbstractMediaListHeaderPresenter.

void onBindRowViewHolder(RowPresenter.ViewHolder vh, Object item)

Binds the given row object to the given ViewHolder.

Inherited methods

From class android.support.v17.leanback.widget.RowPresenter
From class android.support.v17.leanback.widget.Presenter
From class java.lang.Object
From interface android.support.v17.leanback.widget.FacetProvider

Public constructors

AbstractMediaListHeaderPresenter

AbstractMediaListHeaderPresenter (Context context, 
                int mThemeResId)

Constructor used for creating an abstract media-list header presenter of a given theme.

Parameters
context Context: The context the user of this presenter is running in.
mThemeResId int: The resource id of the desired theme used for styling of this presenter.

AbstractMediaListHeaderPresenter

AbstractMediaListHeaderPresenter ()

Constructor used for creating an abstract media-list header presenter. The styling for this presenter is extracted from Context of parent in createRowViewHolder(ViewGroup).

Public methods

isUsingDefaultSelectEffect

boolean isUsingDefaultSelectEffect ()

Returns true if this RowPresenter is using the default dimming effect. A subclass may (most likely) return false and override onSelectLevelChanged(ViewHolder).

Returns
boolean

setBackgroundColor

void setBackgroundColor (int color)

Sets the background color for the row views within the playlist. If this is not set, a default color, defaultBrandColor, from theme is used. This defaultBrandColor defaults to android:attr/colorPrimary on v21, if it's specified.

Parameters
color int: The ARGB color used to set as the header text background color.

Protected methods

createRowViewHolder

RowPresenter.ViewHolder createRowViewHolder (ViewGroup parent)

Called to create a ViewHolder object for a Row. Subclasses will override this method to return a different concrete ViewHolder object.

Parameters
parent ViewGroup: The parent View for the Row's view holder.
Returns
RowPresenter.ViewHolder A ViewHolder for the Row's View.

onBindMediaListHeaderViewHolder

void onBindMediaListHeaderViewHolder (AbstractMediaListHeaderPresenter.ViewHolder vh, 
                Object item)

Binds the playlist header data model provided by the user to the AbstractMediaListHeaderPresenter.ViewHolder provided by the AbstractMediaListHeaderPresenter. The subclasses of this presenter can access and bind the text view corresponding to the header by calling getHeaderView(), on the AbstractMediaListHeaderPresenter.ViewHolder provided as the argument vh by this presenter.

Parameters
vh AbstractMediaListHeaderPresenter.ViewHolder: The ViewHolder for this AbstractMediaListHeaderPresenter.
item Object: The header data object being presented.

onBindRowViewHolder

void onBindRowViewHolder (RowPresenter.ViewHolder vh, 
                Object item)

Binds the given row object to the given ViewHolder. Derived classes of RowPresenter overriding onBindRowViewHolder(ViewHolder, Object) must call through the super class's implementation of this method.

Parameters
vh RowPresenter.ViewHolder
item Object

Hooray!