added in version 25.1.0
belongs to Maven artifact com.android.support:leanback-v17:28.0.0-alpha1

PlaybackControlGlue

public abstract class PlaybackControlGlue
extends PlaybackGlue implements OnActionClickedListener, View.OnKeyListener

java.lang.Object
   ↳ android.support.v17.leanback.media.PlaybackGlue
     ↳ android.support.v17.leanback.media.PlaybackControlGlue
Known Direct Subclasses


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(SparseArrayObjectAdapter). 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(Action).

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 setOnKeyListener(android.view.View.OnKeyListener).

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

Summary

Constants

int ACTION_CUSTOM_LEFT_FIRST

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

int ACTION_CUSTOM_RIGHT_FIRST

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

int ACTION_FAST_FORWARD

The adapter key for the fast forward control.

int ACTION_PLAY_PAUSE

The adapter key for the play/pause control.

int ACTION_REWIND

The adapter key for the rewind control.

int ACTION_SKIP_TO_NEXT

The adapter key for the skip to next control.

int ACTION_SKIP_TO_PREVIOUS

The adapter key for the skip to previous control.

int PL