-
- All Implemented Interfaces:
-
android.view.View.OnKeyListener,androidx.leanback.widget.OnActionClickedListener
public abstract class MLSPlaybackBaseControlGlue<T extends PlayerAdapter> extends PlaybackGlue implements OnActionClickedListener, View.OnKeyListener
-
-
Field Summary
Fields Modifier and Type Field Description public final static intACTION_CUSTOM_LEFT_FIRSTpublic final static intACTION_SKIP_TO_PREVIOUSpublic final static intACTION_REWINDpublic final static intACTION_PLAY_PAUSEpublic final static intACTION_FAST_FORWARDpublic final static intACTION_SKIP_TO_NEXTpublic final static intACTION_REPEATpublic final static intACTION_SHUFFLEpublic final static intACTION_CUSTOM_RIGHT_FIRSTpublic final TmPlayerAdapterpublic PlaybackControlsRowmControlsRowpublic MLSPlayPauseActionmPlayPauseActionpublic MLSRewindActionmRewindActionpublic MLSFastForwardActionmFastForwardActionpublic booleanmIsPlayingpublic booleanmFadeWhenPlaying
-
Constructor Summary
Constructors Constructor Description MLSPlaybackBaseControlGlue(Context context, T impl, MLSTVConfiguration config, ControllerAgent controllerAgent)Constructor for the glue.
-
Method Summary
Modifier and Type Method Description final TgetPlayerAdapter()voidsetControlsOverlayAutoHideEnabled(boolean enable)Sets the controls to auto hide after a timeout when media is playing. booleanisControlsOverlayAutoHideEnabled()Returns true if the controls auto hides after a timeout when media is playing. voidsetControlsRow(PlaybackControlsRow controlsRow)Sets the controls row to be managed by the glue layer. voidsetPlaybackRowPresenter(PlaybackRowPresenter presenter)Sets the controls row Presenter to be managed by the glue layer. PlaybackControlsRowgetControlsRow()Returns the playback controls row managed by the glue layer. PlaybackRowPresentergetPlaybackRowPresenter()Returns the playback controls row Presenter managed by the glue layer. abstract voidonActionClicked(Action action)Handles action clicks. abstract booleanonKey(View v, int keyCode, KeyEvent event)Handles key events and returns true if handled. final booleanisPlaying()voidplay()voidpause()voidnext()voidprevious()voidrewind()voidfastForward()final longgetDuration()longgetCurrentPosition()final longgetBufferedPosition()final booleanisPrepared()voidsetArt(Drawable cover)Sets the drawable representing cover image. DrawablegetArt()voidsetSubtitle(CharSequence subtitle)Sets the media subtitle. CharSequencegetSubtitle()Return The media subtitle. voidsetTitle(CharSequence title)Sets the media title. CharSequencegetTitle()Returns the title of the media item. final voidseekTo(long position)Seek media to a new position. longgetSupportedActions()Returns a bitmask of actions supported by the media player. -
Methods inherited from class androidx.leanback.media.PlaybackGlue
addPlayerCallback, getContext, getHost, isPlaying, isPrepared, next, pause, play, playWhenPrepared, previous, removePlayerCallback, setHost -
Methods inherited from class androidx.leanback.widget.OnActionClickedListener
onActionClicked -
Methods inherited from class android.view.View.OnKeyListener
onKey -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
MLSPlaybackBaseControlGlue
MLSPlaybackBaseControlGlue(Context context, T impl, MLSTVConfiguration config, ControllerAgent controllerAgent)
Constructor for the glue.- Parameters:
impl- Implementation to underlying media player.
-
-
Method Detail
-
getPlayerAdapter
final T getPlayerAdapter()
-
setControlsOverlayAutoHideEnabled
void setControlsOverlayAutoHideEnabled(boolean enable)
Sets the controls to auto hide after a timeout when media is playing.
- Parameters:
enable- True to enable auto hide after a timeout when media is playing.
-
isControlsOverlayAutoHideEnabled
boolean isControlsOverlayAutoHideEnabled()
Returns true if the controls auto hides after a timeout when media is playing.
-
setControlsRow
void setControlsRow(PlaybackControlsRow controlsRow)
Sets the controls row to be managed by the glue layer. If getPrimaryActionsAdapter is not provided, a default ArrayObjectAdapter will be created and initialized in onCreatePrimaryActions. If getSecondaryActionsAdapter is not provided, a default ArrayObjectAdapter will be created and initialized in onCreateSecondaryActions.The primary actions and playback state related aspects of the roware updated by the glue.
-
setPlaybackRowPresenter
void setPlaybackRowPresenter(PlaybackRowPresenter presenter)
Sets the controls row Presenter to be managed by the glue layer.
-
getControlsRow
PlaybackControlsRow getControlsRow()
Returns the playback controls row managed by the glue layer.
-
getPlaybackRowPresenter
PlaybackRowPresenter getPlaybackRowPresenter()
Returns the playback controls row Presenter managed by the glue layer.
-
onActionClicked
abstract void onActionClicked(Action action)
Handles action clicks. A subclass may override this add support for additional actions.
-
onKey
abstract boolean onKey(View v, int keyCode, KeyEvent event)
Handles key events and returns true if handled. A subclass may override this to provideadditional support.
-
isPlaying
final boolean isPlaying()
-
play
void play()
-
pause
void pause()
-
next
void next()
-
previous
void previous()
-
rewind
void rewind()
-
fastForward
void fastForward()
-
getDuration
final long getDuration()
-
getCurrentPosition
long getCurrentPosition()
-
getBufferedPosition
final long getBufferedPosition()
-
isPrepared
final boolean isPrepared()
-
setArt
void setArt(Drawable cover)
Sets the drawable representing cover image. The drawable will be rendered by defaultdescription presenter in setDescriptionPresenter.
- Parameters:
cover- The drawable representing cover image.
-
setSubtitle
void setSubtitle(CharSequence subtitle)
Sets the media subtitle. The subtitle will be rendered by default description presenter setDescriptionPresenter.
- Parameters:
subtitle- Subtitle to set.
-
getSubtitle
CharSequence getSubtitle()
Return The media subtitle.
-
setTitle
void setTitle(CharSequence title)
Sets the media title. The title will be rendered by default description presenter setDescriptionPresenter}.
-
getTitle
CharSequence getTitle()
Returns the title of the media item.
-
seekTo
final void seekTo(long position)
Seek media to a new position.
- Parameters:
position- New position.
-
getSupportedActions
long getSupportedActions()
Returns a bitmask of actions supported by the media player.
-
-
-
-