Google is committed to advancing racial equity for Black communities. See how.

PlaybackBaseControlGlue

abstract class PlaybackBaseControlGlue<T : PlayerAdapter!> : PlaybackGlue, OnActionClickedListener, OnKeyListener
kotlin.Any
   ↳ androidx.leanback.media.PlaybackGlue
   ↳ androidx.leanback.media.PlaybackBaseControlGlue

A base abstract class for managing a PlaybackControlsRow being displayed in PlaybackGlueHost. It supports standard playback control actions play/pause and skip next/previous. This helper class is a glue layer that manages interaction between the leanback UI components PlaybackControlsRowPlaybackRowPresenter and a functional PlayerAdapter which represents the underlying media player.

The app must pass a PlayerAdapter in constructor for a specific implementation e.g. a MediaPlayerAdapter.

The glue has two action bars: primary action bars and secondary action bars. Apps can provide additional actions by overriding onCreatePrimaryActions and / or onCreateSecondaryActions and respond to actions by overriding onActionClicked(Action).

The subclass is responsible for implementing the "repeat mode" in onPlayCompleted().

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 repeat control.

static Int

The adapter key for the rewind control.

static Int

The adapter key for the shuffle control.

static Int

The adapter key for the skip to next control.

static Int

The adapter key for the skip to previous control.

Public constructors
<init>(context: Context!, impl: T)

Constructor for the glue.

Public methods
open Drawable!

Long

open PlaybackControlsRow!

Returns the playback controls row managed by the glue layer.

open Long

Long

open PlaybackRowPresenter!

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

T

open CharSequence!

Return The media subtitle.

open Long

Returns a bitmask of actions supported by the media player.

open CharSequence!

Returns the title of the media item.

open Boolean

Returns true if the controls auto hides after a timeout when media is playing.

Boolean

Boolean

open Unit

abstract Unit

Handles action clicks.

abstract Boolean
onKey(v: View!, keyCode: Int, event: KeyEvent!)

Handles key events and returns true if handled.

open Unit

open Unit

open Unit

Unit
seekTo(position: Long)

Seek media to a new position.

open Unit
setArt(cover: Drawable!)

Sets the drawable representing cover image.

open Unit

Sets the controls to auto hide after a timeout when media is playing.

open Unit

Sets the controls row to be managed by the glue layer.

open Unit

Sets the controls row Presenter to be managed by the glue layer.

open Unit

Sets the media subtitle.

open Unit

Sets the media title.

Protected methods
open static Unit

open Unit

open Unit
onCreatePrimaryActions(primaryActionsAdapter: ArrayObjectAdapter!)

May be overridden to add primary actions to the adapter.

abstract PlaybackRowPresenter!

open Unit
onCreateSecondaryActions(secondaryActionsAdapter: ArrayObjectAdapter!)

May be overridden to add secondary actions to the adapter.

open Unit

open Unit

open Unit

open Unit

Event when metadata changed

open Unit

Event when play finishes, subclass may handling repeat mode here.

open Unit

Event when play state changed.

open Unit

Event when ready state for play changes.

open Unit

open Unit

open Unit

Inherited functions

Constants

ACTION_CUSTOM_LEFT_FIRST

static val ACTION_CUSTOM_LEFT_FIRST: Int

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

Value: 0x1

ACTION_CUSTOM_RIGHT_FIRST

static val ACTION_CUSTOM_RIGHT_FIRST: Int

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

Value: 0x1000