O Google tem o compromisso de promover a igualdade racial para as comunidades negras. Saiba como.

PlaybackControlGlue

abstract class PlaybackControlGlue : PlaybackGlue, OnActionClickedListener, OnKeyListener
kotlin.Any
   ↳ androidx.leanback.media.PlaybackGlue
   ↳ androidx.leanback.media.PlaybackControlGlue

A helper class for managing a PlaybackControlsRow and PlaybackGlueHost that implements a recommended approach to handling standard playback control actions such as play/pause, fast forward/rewind at progressive speed levels, and skip to next/previous. This helper class is a glue layer in that manages the configuration of and interaction between the leanback UI components by defining a functional interface to the media player.

You can instantiate a concrete subclass such as MediaPlayerGlue or you must subclass this abstract helper. To create a subclass you must implement all of the abstract methods and the subclass must invoke onMetadataChanged() and onStateChanged() appropriately.

To use an instance of the glue layer, first construct an instance. Constructor parameters inform the glue what speed levels are supported for fast forward/rewind.

You may override onCreateControlsRowAndPresenter() which will create a PlaybackControlsRow and a PlaybackControlsRowPresenter. You may call setControlsRow(PlaybackControlsRow) and setPlaybackRowPresenter(PlaybackRowPresenter) to customize your own row and presenter.

The helper sets a SparseArrayObjectAdapter on the controls row as the primary actions adapter, and adds actions to it. You can provide additional actions by overriding onCreatePrimaryActions. This helper does not deal in secondary actions so those you may add separately.

Provide a click listener on your fragment and if an action is clicked, call onActionClicked.

This helper implements a key event handler. If you pass a PlaybackGlueHost, it will configure its fragment to intercept all key events. Otherwise, you should set the glue object as key event handler to the ViewHolder when bound by your row presenter; see RowPresenter.ViewHolder#setOnKeyListener(android.view.View.OnKeyListener).

To update the controls row progress during playback, override enableProgressUpdating to manage the lifecycle of a periodic callback to updateProgress(). getUpdatePeriod() provides a recommended update period.

Summary

Constants
static Int

The adapter key for the first custom control on the left side of the predefined primary controls.

static Int

The adapter key for the first custom control on the right side of the predefined primary controls.

static Int

The adapter key for the fast forward control.

static Int

The adapter key for the play/pause control.

static Int

The adapter key for the rewind control.

static Int

The adapter key for the skip to next control.

static Int

The adapter key for the skip to previous control.

static Int

The initial (level 0) fast forward playback speed.

static Int

The level 1 fast forward playback speed.

static Int

The level 2 fast forward playback speed.

static Int

The level 3 fast forward playback speed.

static Int

The level 4 fast forward playback speed.

static Int

Invalid playback speed.

static Int

Speed representing playback state that is playing normally.

static Int

Speed representing playback state that is paused.

Public constructors
<init>(context: Context!, seekSpeeds: IntArray!)

Constructor for the glue.

<init>(context: Context!, fastForwardSpeeds: IntArray!, rewindSpeeds: IntArray!)

Constructor for the glue.

Public methods
open Unit

Override this to start/stop a runnable to call updateProgress at an interval such as getUpdatePeriod.

open PlaybackControlsRow!

Returns the playback controls row managed by the glue layer.

open PlaybackControlsRowPresenter!

Returns the playback controls row Presenter managed by the glue layer.

abstract Int

Returns the current position of the media item in milliseconds.

abstract Int

Returns the current playback speed.

open IntArray!

Returns the fast forward speeds.

abstract Drawable!

Returns a bitmap of the art for the media item.

abstract Int

Returns the duration of the media item in milliseconds.

abstract CharSequence!

Returns the subtitle of the media item.

abstract CharSequence!

Returns the title of the media item.

open PlaybackRowPresenter!

Returns the playback row Presenter to be passed to PlaybackGlueHost in onAttachedToHost(PlaybackGlueHost).

open IntArray!

Returns the rewind speeds.

abstract Long