belongs to Maven artifact com.android.support:leanback-v17:28.0.0-alpha1
AbstractMediaItemPresenter
public
abstract
class
AbstractMediaItemPresenter
extends RowPresenter
java.lang.Object | |||
↳ | android.support.v17.leanback.widget.Presenter | ||
↳ | android.support.v17.leanback.widget.RowPresenter | ||
↳ | android.support.v17.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(AbstractMediaItemPresenter.ViewHolder, Object)
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 | |
---|---|
class |
AbstractMediaItemPresenter.ViewHolder
The ViewHolder for the |
Constants | |
---|---|
int |
PLAY_STATE_INITIAL
Indicating that the media item is currently neither playing nor paused. |
int |
PLAY_STATE_PAUSED
Indicating that the media item is currently paused. |
int |
PLAY_STATE_PLAYING
Indicating that the media item is currently playing |
Inherited constants |
---|
From
class
android.support.v17.leanback.widget.RowPresenter
|
Public constructors | |
---|---|
AbstractMediaItemPresenter()
Constructor used for creating an abstract media item presenter. |
|
AbstractMediaItemPresenter(int themeId)
Constructor used for creating an abstract media item presenter. |
Public methods | |
---|---|
Presenter
|
getActionPresenter()
Return the presenter used to render a media item row actions. |
int
|
getThemeId()
Return The resource id of the theme that defines attributes controlling the appearance of different widgets in a media item row. |
boolean
|
hasMediaRowSeparator()
|
boolean
|
isUsingDefaultSelectEffect()
Returns true if this RowPresenter is using the default dimming effect. |
void
|
onBindMediaPlayState(AbstractMediaItemPresenter.ViewHolder vh)
Binds the media item number view to the appropriate play state view of the media item. |
void
|
onUnbindMediaPlayState(AbstractMediaItemPresenter.ViewHolder vh)
Called when the given ViewHolder wants to unbind the play state view. |
void
|
setActionPresenter(Presenter actionPresenter)
Sets the action presenter rendering each optional custom action within each media item row. |
void
|
setBackgroundColor(int color)
Sets the background color for the row views within the playlist. |
void
|
setHasMediaRowSeparator(boolean hasSeparator)
Specifies whether a line separator should be used between media item rows. |
void
|
setThemeId(int themeId)
Sets the theme used to style a media item row components. |
Protected methods | |
---|---|
RowPresenter.ViewHolder
|
createRowViewHolder(ViewGroup parent)
Called to create a ViewHolder object for a Row. |
int
|
getMediaPlayState(Object item)
Returns the current play state of the given media item. |
boolean
|
isClippingChildren()
Returns true if the Row view should clip its children. |
abstract
void
|
onBindMediaDetails(AbstractMediaItemPresenter.ViewHolder vh, Object item)
Binds the media item details to their views provided by the
|
void
|
onBindRowActions(AbstractMediaItemPresenter.ViewHolder vh)
Binds the given media item object action to the given ViewHolder's action views. |
void
|
onBindRowViewHolder(RowPresenter.ViewHolder vh, Object item)
Binds the given row object to the given ViewHolder. |
void
|
onUnbindMediaDetails(AbstractMediaItemPresenter.ViewHolder vh)
Unbinds the media item details from their views provided by the
|
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
|
Constants
PLAY_STATE_INITIAL
int PLAY_STATE_INITIAL
Indicating that the media item is currently neither playing nor paused.
Constant Value: 0 (0x00000000)
PLAY_STATE_PAUSED
int PLAY_STATE_PAUSED
Indicating that the media item is currently paused.
Constant Value: 1 (0x00000001)
PLAY_STATE_PLAYING
int PLAY_STATE_PLAYING
Indicating that the media item is currently playing
Constant Value: 2 (0x00000002)
Public constructors
AbstractMediaItemPresenter
AbstractMediaItemPresenter ()
Constructor used for creating an abstract media item presenter.
AbstractMediaItemPresenter
AbstractMediaItemPresenter (int themeId)
Constructor used for creating an abstract media item presenter.
Parameters | |
---|---|
themeId |
int : The resource id of the theme that defines attributes controlling the
appearance of different widgets in a media item row.
|
Public methods
getActionPresenter
Presenter getActionPresenter ()
Return the presenter used to render a media item row actions.
Returns | |
---|---|
Presenter |
the presenter used to render a media item row actions. |
getThemeId
int getThemeId ()
Return The resource id of the theme that defines attributes controlling the appearance of different widgets in a media item row.
Returns | |
---|---|
int |
The resource id of the theme that defines attributes controlling the appearance of different widgets in a media item row. |
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 |
onBindMediaPlayState
void onBindMediaPlayState (AbstractMediaItemPresenter.ViewHolder vh)
Binds the media item number view to the appropriate play state view of the media item.
The play state of the media item is extracted by calling getMediaPlayState(Object)
for
the media item embedded within this view.
This method triggers updating of the playback state UI if corresponding views are specified
for the current playback state.
By default, 3 views are provided for each playback state, or these views can be provided
by the user.
Parameters | |
---|---|
vh |
AbstractMediaItemPresenter.ViewHolder |
onUnbindMediaPlayState
void onUnbindMediaPlayState (AbstractMediaItemPresenter.ViewHolder vh)
Called when the given ViewHolder wants to unbind the play state view.
Parameters | |
---|---|
vh |
AbstractMediaItemPresenter.ViewHolder : The ViewHolder to unbind from.
|
setActionPresenter
void setActionPresenter (Presenter actionPresenter)
Sets the action presenter rendering each optional custom action within each media item row.
Parameters | |
---|---|
actionPresenter |
Presenter : the presenter to be used for rendering a media item row actions.
|
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 media list background color.
|
setHasMediaRowSeparator
void setHasMediaRowSeparator (boolean hasSeparator)
Specifies whether a line separator should be used between media item rows.
Parameters | |
---|---|
hasSeparator |
boolean : true if a separator should be displayed, false otherwise.
|
setThemeId
void setThemeId (int themeId)
Sets the theme used to style a media item row components.
Parameters | |
---|---|
themeId |
int : The resource id of the theme that defines attributes controlling the
appearance of different widgets in a media item row.
|
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. |
getMediaPlayState
int getMediaPlayState (Object item)
Returns the current play state of the given media item. By default, this method returns
PLAY_STATE_INITIAL which causes the media item number
getMediaItemNameView()
to be displayed for different
playback states. Users of this class should override this method in order to provide the
play state of their custom media item data model.
Parameters | |
---|---|
item |
Object : The media item |
Returns | |
---|---|
int |
The current play state of this media item |
isClippingChildren
boolean isClippingChildren ()
Returns true if the Row view should clip its children. The clipChildren
flag is set on view in initializeRowViewHolder(ViewHolder)
. Note that
Slide transition or explode transition need turn off clipChildren.
Default value is false.
Returns | |
---|---|
boolean |
onBindMediaDetails
void onBindMediaDetails (AbstractMediaItemPresenter.ViewHolder vh, Object item)
Binds the media item details to their views provided by the
AbstractMediaItemPresenter
.
This method is to be overridden by the users of this presenter.
The subclasses of this presenter can access and bind individual views for either of the
media item number, name, or duration (depending on whichever views are visible according to
the providing theme attributes), by calling getMediaItemNumberView()
,
getMediaItemNameView()
, and getMediaItemDurationView()
,
on the AbstractMediaItemPresenter.ViewHolder
provided as the argument vh
of this presenter.
Parameters | |
---|---|
vh |
AbstractMediaItemPresenter.ViewHolder : The ViewHolder for this AbstractMediaItemPresenter . |
item |
Object : The media item row object being presented.
|
onBindRowActions
void onBindRowActions (AbstractMediaItemPresenter.ViewHolder vh)
Binds the given media item object action to the given ViewHolder's action views.
Parameters | |
---|---|
vh |
AbstractMediaItemPresenter.ViewHolder : ViewHolder for the media item.
|
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 |
onUnbindMediaDetails
void onUnbindMediaDetails (AbstractMediaItemPresenter.ViewHolder vh)
Unbinds the media item details from their views provided by the
AbstractMediaItemPresenter
.
This method can be overridden by the subclasses of this presenter if required.
Parameters | |
---|---|
vh |
AbstractMediaItemPresenter.ViewHolder : ViewHolder to unbind from.
|
Interfaces
- BaseGridView.OnKeyInterceptListener
- BaseGridView.OnMotionInterceptListener
- BaseGridView.OnTouchInterceptListener
- BaseGridView.OnUnhandledKeyListener
- BaseOnItemViewClickedListener
- BaseOnItemViewSelectedListener
- BrowseFrameLayout.OnChildFocusListener
- BrowseFrameLayout.OnFocusSearchListener
- FacetProvider
- FacetProviderAdapter
- FocusHighlight
- FragmentAnimationProvider
- ImeKeyMonitor
- ImeKeyMonitor.ImeKeyListener
- MultiActionsProvider
- OnActionClickedListener
- OnChildLaidOutListener
- OnChildSelectedListener
- OnItemViewClickedListener
- OnItemViewSelectedListener
- PlaybackSeekUi
- SearchBar.SearchBarListener
- SearchBar.SearchBarPermissionListener
- SearchEditText.OnKeyboardDismissListener
- SpeechRecognitionCallback
- TitleViewAdapter.Provider
- ViewHolderTask
Classes
- AbstractDetailsDescriptionPresenter
- AbstractDetailsDescriptionPresenter.ViewHolder
- AbstractMediaItemPresenter
- AbstractMediaItemPresenter.ViewHolder
- AbstractMediaListHeaderPresenter
- AbstractMediaListHeaderPresenter.ViewHolder
- Action
- ArrayObjectAdapter
- BaseCardView
- BaseCardView.LayoutParams
- BaseGridView
- BrowseFrameLayout
- ClassPresenterSelector
- ControlButtonPresenterSelector
- CursorObjectAdapter
- DetailsOverviewLogoPresenter
- DetailsOverviewLogoPresenter.ViewHolder
- DetailsOverviewRow
- DetailsOverviewRow.Listener
- DetailsOverviewRowPresenter
- DetailsOverviewRowPresenter.ViewHolder
- DetailsParallax
- DiffCallback
- DividerPresenter
- DividerRow
- FocusHighlightHelper
- FullWidthDetailsOverviewRowPresenter
- FullWidthDetailsOverviewRowPresenter.Listener
- FullWidthDetailsOverviewRowPresenter.ViewHolder
- FullWidthDetailsOverviewRowPresenter.ViewHolder.DetailsOverviewRowListener
- FullWidthDetailsOverviewSharedElementHelper
- GuidanceStylist
- GuidanceStylist.Guidance
- GuidedAction
- GuidedAction.Builder
- GuidedAction.BuilderBase
- GuidedActionDiffCallback
- GuidedActionEditText
- GuidedActionsStylist
- GuidedActionsStylist.ViewHolder
- GuidedDatePickerAction
- GuidedDatePickerAction.Builder
- GuidedDatePickerAction.BuilderBase
- HeaderItem
- HorizontalGridView
- HorizontalHoverCardSwitcher
- ImageCardView
- ItemAlignmentFacet
- ItemAlignmentFacet.ItemAlignmentDef
- ItemBridgeAdapter
- ItemBridgeAdapter.AdapterListener
- ItemBridgeAdapter.ViewHolder
- ItemBridgeAdapter.Wrapper
- ItemBridgeAdapterShadowOverlayWrapper
- ListRow
- ListRowHoverCardView
- ListRowPresenter
- ListRowPresenter.SelectItemViewHolderTask
- ListRowPresenter.ViewHolder
- ListRowView
- MultiActionsProvider.MultiAction
- ObjectAdapter
- ObjectAdapter.DataObserver
- OnChildViewHolderSelectedListener
- PageRow
- Parallax
- Parallax.FloatProperty
- Parallax.IntProperty
- Parallax.PropertyMarkerValue
- ParallaxEffect
- ParallaxTarget
- ParallaxTarget.DirectPropertyTarget
- ParallaxTarget.PropertyValuesHolderTarget
- PlaybackControlsRow
- PlaybackControlsRow.ClosedCaptioningAction
- PlaybackControlsRow.FastForwardAction
- PlaybackControlsRow.HighQualityAction
- PlaybackControlsRow.MoreActions
- PlaybackControlsRow.MultiAction
- PlaybackControlsRow.OnPlaybackProgressCallback
- PlaybackControlsRow.PictureInPictureAction
- PlaybackControlsRow.PlayPauseAction
- PlaybackControlsRow.RepeatAction
- PlaybackControlsRow.RewindAction
- PlaybackControlsRow.ShuffleAction
- PlaybackControlsRow.SkipNextAction
- PlaybackControlsRow.SkipPreviousAction
- PlaybackControlsRow.ThumbsAction
- PlaybackControlsRow.ThumbsDownAction
- PlaybackControlsRow.ThumbsUpAction
- PlaybackControlsRowPresenter
- PlaybackControlsRowPresenter.ViewHolder
- PlaybackRowPresenter
- PlaybackRowPresenter.ViewHolder
- PlaybackSeekDataProvider
- PlaybackSeekDataProvider.ResultCallback
- PlaybackSeekUi.Client
- PlaybackTransportRowPresenter
- PlaybackTransportRowPresenter.ViewHolder
- Presenter
- Presenter.ViewHolder
- Presenter.ViewHolderTask
- PresenterSelector
- PresenterSwitcher
- RecyclerViewParallax
- RecyclerViewParallax.ChildPositionProperty
- Row
- RowHeaderPresenter
- RowHeaderPresenter.ViewHolder
- RowHeaderView
- RowPresenter
- RowPresenter.ViewHolder
- SearchBar
- SearchEditText
- SearchOrbView
- SearchOrbView.Colors
- SectionRow
- ShadowOverlayContainer
- ShadowOverlayHelper
- ShadowOverlayHelper.Builder
- ShadowOverlayHelper.Options
- SinglePresenterSelector
- SparseArrayObjectAdapter
- SpeechOrbView
- TitleHelper
- TitleView
- TitleViewAdapter
- VerticalGridPresenter
- VerticalGridPresenter.ViewHolder
- VerticalGridView
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-04-11 UTC.