AbstractMediaListHeaderPresenter
abstract class AbstractMediaListHeaderPresenter : RowPresenter
kotlin.Any | |||
↳ | 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
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 |
|
---|---|
open |
The ViewHolder for the |
Inherited constants |
|
---|---|
Public constructors |
|
---|---|
Constructor used for creating an abstract media-list header presenter of a given theme. |
|
<init>() Constructor used for creating an abstract media-list header presenter. |
Public methods |
|
---|---|
open Boolean | |
open Unit |
setBackgroundColor(color: Int) Sets the background color for the row views within the playlist. |
Protected methods |
|
---|---|
open RowPresenter.ViewHolder! |
createRowViewHolder(parent: ViewGroup!) |
abstract Unit |
Binds the playlist header data model provided by the user to the |
open Unit |
onBindRowViewHolder(vh: RowPresenter.ViewHolder!, item: Any!) |
Inherited functions |
|
---|---|
Public constructors
<init>
AbstractMediaListHeaderPresenter(context: Context!, mThemeResId: Int)
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 |
Context!: The resource id of the desired theme used for styling of this presenter. |
<init>
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
open fun isUsingDefaultSelectEffect(): Boolean
setBackgroundColor
open fun setBackgroundColor(color: Int): Unit
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
protected open fun createRowViewHolder(parent: ViewGroup!): RowPresenter.ViewHolder!
onBindMediaListHeaderViewHolder
protected abstract fun onBindMediaListHeaderViewHolder(vh: AbstractMediaListHeaderPresenter.ViewHolder!, item: Any!): Unit
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 ViewHolder#getHeaderView()
, on the ViewHolder
provided as the argument vh
by this presenter.
Parameters | |
---|---|
vh |
AbstractMediaListHeaderPresenter.ViewHolder!: The ViewHolder for this AbstractMediaListHeaderPresenter . |
item |
AbstractMediaListHeaderPresenter.ViewHolder!: The header data object being presented. |
onBindRowViewHolder
protected open fun onBindRowViewHolder(vh: RowPresenter.ViewHolder!, item: Any!): Unit