PlaybackControlsRowPresenter


public class PlaybackControlsRowPresenter extends PlaybackRowPresenter


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

A ViewHolder for the PlaybackControlsRow.

Public constructors

Constructor for a PlaybackControlsRowPresenter.

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 Action click events.

@ColorInt int

Returns the primary color for the progress bar.

void

Provides hook to update the UI when the view reappears.

void

Sets the background color.

void

Sets the listener for Action click events.

void

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

Shows or hides space at the bottom of the playback controls row.

void

Displays the primary actions.

Protected methods

@NonNull RowPresenter.ViewHolder

Called to create a ViewHolder object for a Row.

void

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

Called when the given row view changes selection state.

void

Unbinds the given ViewHolder.

Inherited Constants

From androidx.leanback.widget.RowPresenter
static final int

Don't synchronize row view activated status with selected status or expanded status, application will do its own through setActivated.

static final int

Synchronizes row view's activated status to expand status of the row view holder.

static final int

Sets the row view's activated status to true when both expand and selected are true.

static final int

Synchronizes row view's activated status to selected status of the row view holder.

Inherited methods

From androidx.leanback.widget.FacetProvider
abstract @Nullable Object
getFacet(@NonNull Class<Object> facetClass)

Queries optional implemented facet.

From androidx.leanback.widget.Presenter
static void

Utility method for removing all running animations on a view.

final Object
getFacet(Class<Object> facetClass)

Queries optional implemented facet.

abstract void
onBindViewHolder(
    @NonNull Presenter.ViewHolder viewHolder,
    @Nullable Object item
)

Binds a View to an item.

void
onBindViewHolder(
    @NonNull Presenter.ViewHolder viewHolder,
    @NonNull Object item,
    @NonNull List<Object> payloads
)

Binds a View to an item with a list of payloads.

abstract @NonNull Presenter.ViewHolder

Creates a new View.

abstract void

Unbinds a View from an item.

void

Called when a view created by this presenter has been attached to a window.

void

Called when a view created by this presenter has been detached from its window.

final void
setFacet(Class<Object> facetClass, Object facetImpl)

Sets dynamic implemented facet in addition to basic Presenter functions.

void

Called to set a click listener for the given view holder.

From androidx.leanback.widget.RowPresenter
void
dispatchItemSelectedListener(
    RowPresenter.ViewHolder vh,
    boolean selected
)

This method is only called from onRowViewSelected onRowViewSelected.

void
freeze(@NonNull RowPresenter.ViewHolder holder, boolean freeze)

Freezes/unfreezes the row, typically used when a transition starts/ends.

final RowHeaderPresenter

Returns the Presenter used for rendering the header, or null if none has been set.

final RowPresenter.ViewHolder

Returns the RowPresenter.ViewHolder from the given RowPresenter ViewHolder.

final boolean

Returns true if the row selection effect is enabled.

final float

Returns the current select level.

final int

Returns the policy of updating row view activated status.

void

Called after a RowPresenter.ViewHolder is created for a Row.

boolean

Returns true if the Row view should clip its children.

boolean

Returns true if this RowPresenter is using the default dimming effect.

final void
onBindViewHolder(
    @NonNull Presenter.ViewHolder viewHolder,
    @Nullable Object item
)

Binds a View to an item.

final Presenter.ViewHolder

Creates a new View.

void

Called when the row view's expanded state changes.

void

Callback when the select level changes.

final void

Unbinds a View from an item.

final void

Called when a view created by this presenter has been attached to a window.

final void

Called when a view created by this presenter has been detached from its window.

void
setEntranceTransitionState(
    @NonNull RowPresenter.ViewHolder holder,
    boolean afterEntrance
)

Changes the visibility of views.

final void

Sets the Presenter used for rendering the header.

final void
setRowViewExpanded(Presenter.ViewHolder holder, boolean expanded)

Sets the expanded state of a Row view.

final void
setRowViewSelected(Presenter.ViewHolder holder, boolean selected)

Sets the selected state of a Row view.

final void
setSelectEffectEnabled(boolean applyDimOnSelect)

Enables or disables the row selection effect.

final void

Sets the current select level to a value between 0 (unselected) and 1 (selected).

final void
setSyncActivatePolicy(int syncActivatePolicy)

Sets the policy of updating row view activated status.

Public constructors

PlaybackControlsRowPresenter

Added in 1.1.0
public PlaybackControlsRowPresenter()

Constructor for a PlaybackControlsRowPresenter.

PlaybackControlsRowPresenter

Added in 1.1.0
public PlaybackControlsRowPresenter(@Nullable Presenter descriptionPresenter)

Constructor for a PlaybackControlsRowPresenter.

Parameters
@Nullable Presenter descriptionPresenter

Presenter for displaying item details.

Public methods

areSecondaryActionsHidden

Added in 1.1.0
public boolean areSecondaryActionsHidden()

Returns true if secondary actions are hidden.

getBackgroundColor

Added in 1.1.0
public @ColorInt int getBackgroundColor()

Returns the background color. If no background color was set, transparent is returned.

getOnActionClickedListener

Added in 1.1.0
public @Nullable OnActionClickedListener getOnActionClickedListener()

Returns the listener for Action click events.

getProgressColor

Added in 1.1.0
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

Added in 1.1.0
public void setBackgroundColor(@ColorInt int color)

Sets the background color. If not set, a default from the theme will be used.

setOnActionClickedListener

Added in 1.1.0
public void setOnActionClickedListener(@Nullable OnActionClickedListener listener)

Sets the listener for Action click events.

setProgressColor

Added in 1.1.0
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

Added in 1.1.0
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

Added in 1.1.0
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

Added in 1.1.0
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

Added in 1.2.0-alpha04
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.

Parameters
@NonNull ViewGroup parent

The parent View for the Row's view holder.

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.