A helper class for managing a
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
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
setPlaybackRowPresenter(PlaybackRowPresenter) to customize your own row and presenter.
The helper sets a
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
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
To update the controls row progress during playback, override
to manage the lifecycle of a periodic callback to
getUpdatePeriod() provides a recommended update period.
The adapter key for the first custom control on the left side of the predefined primary controls.
The adapter key for the first custom control on the right side of the predefined primary controls.