PlaybackControlsRow


public class PlaybackControlsRow extends Row


A Row of playback controls to be displayed by a PlaybackControlsRowPresenter. This row consists of some optional item detail, a series of primary actions, and an optional series of secondary actions.

Controls are specified via an ObjectAdapter containing one or more Actions.

Adapters should have their PresenterSelector set to an instance of ControlButtonPresenterSelector.

Summary

Nested types

An action for displaying a CC (Closed Captioning) icon.

An action displaying an icon for fast forward.

An action for displaying a HQ (High Quality) icon.

An action displaying an icon for "more actions".

public abstract class PlaybackControlsRow.MultiAction extends Action

Base class for an action comprised of a series of icons.

Listener for progress or duration change.

An action displaying an icon for picture-in-picture.

An action displaying icons for play and pause.

An action for displaying three repeat states: none, one, or all.

An action displaying an icon for rewind.

An action for displaying a shuffle icon.

An action displaying an icon for skip next.

An action displaying an icon for skip previous.

A base class for displaying a thumbs action.

An action displaying an icon for thumbs down.

An action displaying an icon for thumbs up.

Public constructors

Constructor for a PlaybackControlsRow that has no item details.

Constructor for a PlaybackControlsRow that displays some details from the given item.

Public methods

Action
getActionForKeyCode(int keyCode)

Returns the Action associated with the given keycode, or null if no associated action exists.

Action
getActionForKeyCode(ObjectAdapter adapter, int keyCode)

Returns the Action associated with the given keycode, or null if no associated action exists.

long

Returns the buffered progress of long type for the playback controls row.

int

This method is deprecated.

Use getBufferedPosition

long

This method is deprecated.

Use getBufferedPosition

long

Returns the current time in milliseconds of long type for playback controls row.

int

This method is deprecated.

Use getCurrentPosition

long

This method is deprecated.

Use getCurrentPosition

long

Returns duration in milliseconds.

final Drawable

Returns the image Drawable of this row.

final Object

Returns the main item for the details page.

final ObjectAdapter

Returns the primary actions ObjectAdapter.

final ObjectAdapter

Returns the secondary actions ObjectAdapter.

int

This method is deprecated.

use getDuration

long

This method is deprecated.

use getDuration

void

Sets the buffered progress for the playback controls row.

void

This method is deprecated.

Use setBufferedPosition

void

This method is deprecated.

Use setBufferedPosition

void

Sets the current time in milliseconds for the playback controls row.

void

This method is deprecated.

use setCurrentPosition

void

This method is deprecated.

use setCurrentPosition

void
setDuration(long ms)

Sets the total time in milliseconds (long type) for the playback controls row.

final void
setImageBitmap(Context context, Bitmap bm)

Sets a Bitmap for this row.

final void

Sets a {link @Drawable} image for this row.

void

Sets a listener to be called when the playback state changes.

final void

Sets the primary actions ObjectAdapter.

final void

Sets the secondary actions ObjectAdapter.

void
setTotalTime(int ms)

This method is deprecated.

Use setDuration

void

This method is deprecated.

Use setDuration

Inherited methods

From androidx.leanback.widget.Row
final HeaderItem

Returns the HeaderItem that represents metadata for the row.

final long

Returns a unique identifier for this row.

boolean

Returns true if this Row can be rendered in a visible row view, false otherwise.

final void

Sets the HeaderItem that represents metadata for the row.

final void
setId(long id)

Sets the id for this row.

Public constructors

PlaybackControlsRow

Added in 1.1.0
public PlaybackControlsRow()

Constructor for a PlaybackControlsRow that has no item details.

PlaybackControlsRow

Added in 1.1.0
public PlaybackControlsRow(Object item)

Constructor for a PlaybackControlsRow that displays some details from the given item.

Parameters
Object item

The main item for the row.

Public methods

getActionForKeyCode

Added in 1.1.0
public Action getActionForKeyCode(int keyCode)

Returns the Action associated with the given keycode, or null if no associated action exists. Searches the primary adapter first, then the secondary adapter.

getActionForKeyCode

Added in 1.1.0
public Action getActionForKeyCode(ObjectAdapter adapter, int keyCode)

Returns the Action associated with the given keycode, or null if no associated action exists.

getBufferedPosition

Added in 1.1.0
public long getBufferedPosition()

Returns the buffered progress of long type for the playback controls row.

getBufferedProgress

Added in 1.1.0
Deprecated in 1.1.0
public int getBufferedProgress()

Returns the buffered progress for the playback controls row.

Throws
java.lang.ArithmeticException

If buffered progress in milliseconds overflows int.

getBufferedProgressLong

Added in 1.1.0
Deprecated in 1.1.0
public long getBufferedProgressLong()

Returns the buffered progress of long type for the playback controls row.

getCurrentPosition

Added in 1.1.0
public long getCurrentPosition()

Returns the current time in milliseconds of long type for playback controls row.

getCurrentTime

Added in 1.1.0
Deprecated in 1.1.0
public int getCurrentTime()

Returns the current time in milliseconds for the playback controls row.

Throws
java.lang.ArithmeticException

If current time in milliseconds overflows int.

getCurrentTimeLong

Added in 1.1.0
Deprecated in 1.1.0
public long getCurrentTimeLong()

Returns the current time in milliseconds of long type for playback controls row.

getDuration

Added in 1.1.0
public long getDuration()

Returns duration in milliseconds.

Returns
long

Duration in milliseconds.

getImageDrawable

Added in 1.1.0
public final Drawable getImageDrawable()

Returns the image Drawable of this row.

Returns
Drawable

The overview's image drawable, or null if no drawable has been assigned.

getItem

Added in 1.1.0
public final Object getItem()

Returns the main item for the details page.

getPrimaryActionsAdapter

Added in 1.1.0
public final ObjectAdapter getPrimaryActionsAdapter()

Returns the primary actions ObjectAdapter.

getSecondaryActionsAdapter

Added in 1.1.0
public final ObjectAdapter getSecondaryActionsAdapter()

Returns the secondary actions ObjectAdapter.

getTotalTime

Added in 1.1.0
Deprecated in 1.1.0
public int getTotalTime()

Returns the total time in milliseconds for the playback controls row.

Throws
java.lang.ArithmeticException

If total time in milliseconds overflows int.

getTotalTimeLong

Added in 1.1.0
Deprecated in 1.1.0
public long getTotalTimeLong()

Returns the total time in milliseconds of long type for the playback controls row.

setBufferedPosition

Added in 1.1.0
public void setBufferedPosition(long ms)

Sets the buffered progress for the playback controls row.

Parameters
long ms

Buffered progress in milliseconds of long type.

setBufferedProgress

Added in 1.1.0
Deprecated in 1.1.0
public void setBufferedProgress(int ms)

Sets the buffered progress for the playback controls row. If this row is bound to a view, the view will automatically be updated to reflect the new value.

setBufferedProgressLong

Added in 1.1.0
Deprecated in 1.1.0
public void setBufferedProgressLong(long ms)

Sets the buffered progress for the playback controls row.

Parameters
long ms

Buffered progress in milliseconds of long type.

setCurrentPosition

Added in 1.1.0
public void setCurrentPosition(long ms)

Sets the current time in milliseconds for the playback controls row. If this row is bound to a view, the view will automatically be updated to reflect the new value.

Parameters
long ms

Current time in milliseconds of long type.

setCurrentTime

Added in 1.1.0
Deprecated in 1.1.0
public void setCurrentTime(int ms)

Sets the current time in milliseconds for the playback controls row. If this row is bound to a view, the view will automatically be updated to reflect the new value.

setCurrentTimeLong

Added in 1.1.0
Deprecated in 1.1.0
public void setCurrentTimeLong(long ms)

Sets the current time in milliseconds for playback controls row in long type.

Parameters
long ms

Current time in milliseconds of long type.

setDuration

Added in 1.1.0
public void setDuration(long ms)

Sets the total time in milliseconds (long type) for the playback controls row. If this row is bound to a view, the view will automatically be updated to reflect the new value.

Parameters
long ms

Total time in milliseconds of long type.

setImageBitmap

Added in 1.1.0
public final void setImageBitmap(Context context, Bitmap bm)

Sets a Bitmap for this row.

If set after the row has been bound to a view, the adapter must be notified that this row has changed.

Parameters
Context context

The context to retrieve display metrics from.

Bitmap bm

The bitmap to set.

setImageDrawable

Added in 1.1.0
public final void setImageDrawable(Drawable drawable)

Sets a {link @Drawable} image for this row.

If set after the row has been bound to a view, the adapter must be notified that this row has changed.

Parameters
Drawable drawable

The drawable to set.

setOnPlaybackProgressChangedListener

Added in 1.1.0
public void setOnPlaybackProgressChangedListener(
    PlaybackControlsRow.OnPlaybackProgressCallback listener
)

Sets a listener to be called when the playback state changes.

setPrimaryActionsAdapter

Added in 1.1.0
public final void setPrimaryActionsAdapter(ObjectAdapter adapter)

Sets the primary actions ObjectAdapter.

If set after the row has been bound to a view, the adapter must be notified that this row has changed.

setSecondaryActionsAdapter

Added in 1.1.0
public final void setSecondaryActionsAdapter(ObjectAdapter adapter)

Sets the secondary actions ObjectAdapter.

If set after the row has been bound to a view, the adapter must be notified that this row has changed.

setTotalTime

Added in 1.1.0
Deprecated in 1.1.0
public void setTotalTime(int ms)

Sets the total time in milliseconds for the playback controls row.

If set after the row has been bound to a view, the adapter must be notified that this row has changed.

setTotalTimeLong

Added in 1.1.0
Deprecated in 1.1.0
public void setTotalTimeLong(long ms)

Sets the total time in milliseconds (long type) for the playback controls row.

Parameters
long ms

Total time in milliseconds of long type.