AbstractMediaListHeaderPresenter
public abstract class AbstractMediaListHeaderPresenter extends RowPresenter
| java.lang.Object | |||
| ↳ | androidx.leanback.widget.Presenter | ||
| ↳ | androidx.leanback.widget.RowPresenter | ||
| ↳ | androidx.leanback.widget.AbstractMediaListHeaderPresenter |
Abstract presenter class for rendering the header for a list of media items in a playlist. The presenter creates a ViewHolder for the TextView holding the header text.
Subclasses of this class must override onBindMediaListHeaderViewHolder 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 types |
|---|
public class AbstractMediaListHeaderPresenter.ViewHolder extends RowPresenter.ViewHolderThe ViewHolder for the |
Public constructors |
|---|
|
Constructor used for creating an abstract media-list header presenter. |
AbstractMediaListHeaderPresenter(Context context, int mThemeResId)Constructor used for creating an abstract media-list header presenter of a given theme. |
Public methods |
|
|---|---|
boolean |
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 |
Binds the playlist header data model provided by the user to the |
void |
onBindRowViewHolder(Binds the given row object to the given ViewHolder. |
Inherited Constants |
||||||||
|---|---|---|---|---|---|---|---|---|
|
Inherited methods |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Public constructors
AbstractMediaListHeaderPresenter
public AbstractMediaListHeaderPresenter()
Constructor used for creating an abstract media-list header presenter. The styling for this presenter is extracted from Context of parent in createRowViewHolder.
AbstractMediaListHeaderPresenter
public 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. |
int mThemeResId |
The resource id of the desired theme used for styling of this presenter. |
Public methods
isUsingDefaultSelectEffect
public boolean isUsingDefaultSelectEffect()
Returns true if this RowPresenter is using the default dimming effect. A subclass may (most likely) return false and override onSelectLevelChanged.
setBackgroundColor
public 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 | |
|---|---|
int color |
The ARGB color used to set as the header text background color. |
Protected methods
createRowViewHolder
protected 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 | |
|---|---|
ViewGroup parent |
The parent View for the Row's view holder. |
| Returns | |
|---|---|
RowPresenter.ViewHolder |
A ViewHolder for the Row's View. |
onBindMediaListHeaderViewHolder
protected abstract void onBindMediaListHeaderViewHolder(
AbstractMediaListHeaderPresenter.ViewHolder vh,
Object item
)
Binds the playlist header data model provided by the user to the 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 ViewHolder provided as the argument vh by this presenter.
| Parameters | |
|---|---|
AbstractMediaListHeaderPresenter.ViewHolder vh |
The ViewHolder for this |
Object item |
The header data object being presented. |
onBindRowViewHolder
protected void onBindRowViewHolder(
@NonNull RowPresenter.ViewHolder vh,
@NonNull Object item
)
Binds the given row object to the given ViewHolder. Derived classes of RowPresenter overriding onBindRowViewHolder must call through the super class's implementation of this method.