AbstractMediaItemPresenter
abstract class AbstractMediaItemPresenter : RowPresenter
kotlin.Any | |||
↳ | androidx.leanback.widget.Presenter | ||
↳ | androidx.leanback.widget.RowPresenter | ||
↳ | androidx.leanback.widget.AbstractMediaItemPresenter |
Abstract Presenter
class for rendering media items in a playlist format. Media item data provided for this presenter can implement the interface MultiActionsProvider
, if the media rows wish to contain custom actions. Media items in the playlist are arranged as a vertical list with each row holding each media item's details provided by the user of this class and a set of optional custom actions. Each media item's details and actions are separately focusable. The appearance of each one of the media row components can be controlled through setting theme's attributes. Each media item row provides a view flipper for switching between different views depending on the playback state. A default layout is provided by this presenter for rendering different playback states, or a custom layout can be provided by the user by overriding the playbackMediaItemNumberViewFlipperLayout attribute in the currently specified theme. Subclasses should also override getMediaPlayState(Object)
to provide the current play state of their media item model in case they wish to use different views depending on the playback state. The presenter can optionally provide line separators between media rows by setting setHasMediaRowSeparator(boolean)
to true.
Subclasses must override onBindMediaDetails
to implement their media item model data binding to each row view.
The OnItemViewClickedListener
and OnItemViewSelectedListener
can be used in the same fashion to handle selection or click events on either of media details or each individual action views.
AbstractMediaListHeaderPresenter
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 |
Constants | |
---|---|
static Int |
Indicating that the media item is currently neither playing nor paused. |
static Int |
Indicating that the media item is currently paused. |
static Int |
Indicating that the media item is currently playing |
Inherited constants | |
---|---|
Public constructors | |
---|---|
<init>() Constructor used for creating an abstract media item presenter. |
|
Constructor used for creating an abstract media item presenter. |
Public methods | |
---|---|
open Presenter! |
Return the presenter used to render a media item row actions. |
open Int |
Return The resource id of the theme that defines attributes controlling the appearance of different widgets in a media item row. |
open Boolean | |
open Boolean | |
open Unit |
Binds the media item number view to the appropriate play state view of the media item. |
open Unit |
Called when the given ViewHolder wants to unbind the play state view. |
open Unit |
setActionPresenter(actionPresenter: Presenter!) Sets the action presenter rendering each optional custom action within each media item row. |
open Unit |
setBackgroundColor(color: Int) Sets the background color for the row views within the playlist. |
open Unit |
setHasMediaRowSeparator(hasSeparator: Boolean) Specifies whether a line separator should be used between media item rows. |
open Unit |
setThemeId(themeId: Int) Sets the theme used to style a media item row components. |
Protected methods | |
---|---|
open RowPresenter.ViewHolder! |
createRowViewHolder(parent: ViewGroup!) |
open Int |
getMediaPlayState(item: Any!) Returns the current play state of the given media item. |
open Boolean | |
abstract Unit |
onBindMediaDetails(vh: AbstractMediaItemPresenter.ViewHolder!, item: Any!) Binds the media item details to their views provided by the |
open Unit |
Binds the given media item object action to the given ViewHolder's action views. |
open Unit |
onBindRowViewHolder(vh: RowPresenter.ViewHolder!, item: Any!) |
open Unit |
Unbinds the media item details from their views provided by the |
Inherited functions | |
---|---|