PlaybackControlsRowPresenter
public class PlaybackControlsRowPresenter extends PlaybackRowPresenter
| java.lang.Object | ||||
| ↳ | androidx.leanback.widget.Presenter | |||
| ↳ | androidx.leanback.widget.RowPresenter | |||
| ↳ | androidx.leanback.widget.PlaybackRowPresenter | |||
| ↳ | androidx.leanback.widget.PlaybackControlsRowPresenter |
A PlaybackControlsRowPresenter renders a PlaybackControlsRow to display a series of playback control buttons. Typically this row will be the first row in a fragment such as the androidx.leanback.app.PlaybackFragment.
The detailed description is rendered using a Presenter passed in PlaybackControlsRowPresenter. Typically this will be an instance of AbstractDetailsDescriptionPresenter. The application can access the detailed description ViewHolder from mDescriptionViewHolder.
Summary
Nested types |
|---|
public inner class PlaybackControlsRowPresenter.ViewHolder extends PlaybackRowPresenter.ViewHolderA ViewHolder for the PlaybackControlsRow. |
Public constructors |
|---|
|
Constructor for a PlaybackControlsRowPresenter. |
PlaybackControlsRowPresenter(@Nullable Presenter descriptionPresenter)Constructor for a PlaybackControlsRowPresenter. |
Public methods |
|
|---|---|
boolean |
Returns true if secondary actions are hidden. |
@ColorInt int |
Returns the background color. |
@Nullable OnActionClickedListener |
Returns the listener for |
@ColorInt int |
Returns the primary color for the progress bar. |
void |
onReappear(@NonNull RowPresenter.ViewHolder rowViewHolder)Provides hook to update the UI when the view reappears. |
void |
setBackgroundColor(@ColorInt int color)Sets the background color. |
void |
Sets the listener for |
void |
setProgressColor(@ColorInt int color)Sets the primary color for the progress bar. |
void |
setSecondaryActionsHidden(boolean hidden)Sets the secondary actions to be hidden behind a "more actions" button. |
void |
showBottomSpace(Shows or hides space at the bottom of the playback controls row. |
void |
Displays the primary actions. |
Protected methods |
|
|---|---|
@NonNull RowPresenter.ViewHolder |
createRowViewHolder(@NonNull ViewGroup parent)Called to create a ViewHolder object for a Row. |
void |
onBindRowViewHolder(Binds the given row object to the given ViewHolder. |
void |
Invoked when the row view is attached to the window. |
void |
Invoked when the row view is detached from the window. |
void |
onRowViewSelected(@NonNull RowPresenter.ViewHolder vh, boolean selected)Called when the given row view changes selection state. |
void |
Unbinds the given ViewHolder. |
Inherited Constants |
||||||||
|---|---|---|---|---|---|---|---|---|
|
Inherited methods |
||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
Public constructors
PlaybackControlsRowPresenter
public PlaybackControlsRowPresenter()
Constructor for a PlaybackControlsRowPresenter.
Public methods
areSecondaryActionsHidden
public boolean areSecondaryActionsHidden()
Returns true if secondary actions are hidden.
getBackgroundColor
public @ColorInt int getBackgroundColor()
Returns the background color. If no background color was set, transparent is returned.
getOnActionClickedListener
public @Nullable OnActionClickedListener getOnActionClickedListener()
Returns the listener for Action click events.
getProgressColor
public @ColorInt int getProgressColor()
Returns the primary color for the progress bar. If no color was set, transparent is returned.
onReappear
public void onReappear(@NonNull RowPresenter.ViewHolder rowViewHolder)
Provides hook to update the UI when the view reappears.
setBackgroundColor
public void setBackgroundColor(@ColorInt int color)
Sets the background color. If not set, a default from the theme will be used.
setOnActionClickedListener
public void setOnActionClickedListener(@Nullable OnActionClickedListener listener)
Sets the listener for Action click events.
setProgressColor
public void setProgressColor(@ColorInt int color)
Sets the primary color for the progress bar. If not set, a default from the theme will be used.
setSecondaryActionsHidden
public void setSecondaryActionsHidden(boolean hidden)
Sets the secondary actions to be hidden behind a "more actions" button. When "more actions" is selected, the primary actions are replaced with the secondary actions.
showBottomSpace
public void showBottomSpace(
@NonNull PlaybackControlsRowPresenter.ViewHolder vh,
boolean show
)
Shows or hides space at the bottom of the playback controls row. This allows the row to hug the bottom of the display when no other rows are present.
showPrimaryActions
public void showPrimaryActions(@NonNull PlaybackControlsRowPresenter.ViewHolder vh)
Displays the primary actions. This will override the user having selected "more actions" to display the secondary actions; see setSecondaryActionsHidden.
Protected methods
createRowViewHolder
protected @NonNull RowPresenter.ViewHolder createRowViewHolder(@NonNull ViewGroup parent)
Called to create a ViewHolder object for a Row. Subclasses will override this method to return a different concrete ViewHolder object.
| Returns | |
|---|---|
@NonNull RowPresenter.ViewHolder |
A ViewHolder for the Row's View. |
onBindRowViewHolder
protected void onBindRowViewHolder(
@NonNull RowPresenter.ViewHolder holder,
@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.
onRowViewAttachedToWindow
protected void onRowViewAttachedToWindow(@NonNull RowPresenter.ViewHolder vh)
Invoked when the row view is attached to the window.
onRowViewDetachedFromWindow
protected void onRowViewDetachedFromWindow(@NonNull RowPresenter.ViewHolder vh)
Invoked when the row view is detached from the window.
onRowViewSelected
protected void onRowViewSelected(@NonNull RowPresenter.ViewHolder vh, boolean selected)
Called when the given row view changes selection state. A subclass may override this to respond to selected state changes of a Row. A subclass may make visual changes to Row view but must not create animation on the Row view.
onUnbindRowViewHolder
protected void onUnbindRowViewHolder(@NonNull RowPresenter.ViewHolder holder)
Unbinds the given ViewHolder. Derived classes of RowPresenter overriding onUnbindRowViewHolder must call through the super class's implementation of this method.