Java Code Examples for androidx.leanback.widget.PlaybackControlsRow#ShuffleAction

The following examples show how to use androidx.leanback.widget.PlaybackControlsRow#ShuffleAction . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MediaPlayerGlue.java    From tv-samples with Apache License 2.0 5 votes vote down vote up
public MediaPlayerGlue(Context context) {
    super(context, new int[]{1});
    mShuffleAction = new PlaybackControlsRow.ShuffleAction(getContext());
    mRepeatAction = new PlaybackControlsRow.RepeatAction(getContext());
    mThumbsDownAction = new PlaybackControlsRow.ThumbsDownAction(getContext());
    mThumbsUpAction = new PlaybackControlsRow.ThumbsUpAction(getContext());
    mThumbsDownAction.setIndex(PlaybackControlsRow.ThumbsAction.OUTLINE);
    mThumbsUpAction.setIndex(PlaybackControlsRow.ThumbsAction.OUTLINE);
}
 
Example 2
Source File: MediaPlayerGlue.java    From tv-samples with Apache License 2.0 5 votes vote down vote up
@Override public void onActionClicked(Action action) {
    if (action instanceof PlaybackControlsRow.ShuffleAction
            || action instanceof PlaybackControlsRow.RepeatAction) {
        ((PlaybackControlsRow.MultiAction) action).nextIndex();
        notifySecondaryActionChanged(action);
    } else if (action == mThumbsUpAction) {
        if (mThumbsUpAction.getIndex() == PlaybackControlsRow.ThumbsAction.SOLID) {
            mThumbsUpAction.setIndex(PlaybackControlsRow.ThumbsAction.OUTLINE);
            notifySecondaryActionChanged(mThumbsUpAction);
        } else {
            mThumbsUpAction.setIndex(PlaybackControlsRow.ThumbsAction.SOLID);
            mThumbsDownAction.setIndex(PlaybackControlsRow.ThumbsAction.OUTLINE);
            notifySecondaryActionChanged(mThumbsUpAction);
            notifySecondaryActionChanged(mThumbsDownAction);
        }
    } else if (action == mThumbsDownAction) {
        if (mThumbsDownAction.getIndex() == PlaybackControlsRow.ThumbsAction.SOLID) {
            mThumbsDownAction.setIndex(PlaybackControlsRow.ThumbsAction.OUTLINE);
            notifySecondaryActionChanged(mThumbsDownAction);
        } else {
            mThumbsDownAction.setIndex(PlaybackControlsRow.ThumbsAction.SOLID);
            mThumbsUpAction.setIndex(PlaybackControlsRow.ThumbsAction.OUTLINE);
            notifySecondaryActionChanged(mThumbsUpAction);
            notifySecondaryActionChanged(mThumbsDownAction);
        }
    } else {
        super.onActionClicked(action);
    }
}