Java Code Examples for android.support.v17.leanback.widget.PlaybackControlsRow#RepeatAction

The following examples show how to use android.support.v17.leanback.widget.PlaybackControlsRow#RepeatAction . 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: VideoMediaPlayerGlue.java    From leanback-showcase with Apache License 2.0 5 votes vote down vote up
public VideoMediaPlayerGlue(Activity context, T impl) {
    super(context, impl);
    mClosedCaptioningAction = new PlaybackControlsRow.ClosedCaptioningAction(context);
    mThumbsUpAction = new PlaybackControlsRow.ThumbsUpAction(context);
    mThumbsUpAction.setIndex(PlaybackControlsRow.ThumbsUpAction.OUTLINE);
    mThumbsDownAction = new PlaybackControlsRow.ThumbsDownAction(context);
    mThumbsDownAction.setIndex(PlaybackControlsRow.ThumbsDownAction.OUTLINE);
    mRepeatAction = new PlaybackControlsRow.RepeatAction(context);
    mPipAction = new PlaybackControlsRow.PictureInPictureAction(context);
}
 
Example 2
Source File: MusicMediaPlayerGlue.java    From leanback-showcase with Apache License 2.0 5 votes vote down vote up
@Override public void onActionClicked(Action action) {
    // If either 'Shuffle' or 'Repeat' has been clicked we need to make sure the acitons index
    // is incremented and the UI updated such that we can display the new state.
    super.onActionClicked(action);
    if (action instanceof PlaybackControlsRow.RepeatAction) {
        int index = ((PlaybackControlsRow.RepeatAction) action).getIndex();
        if (mPlaybackService != null) {
            mPlaybackService.setRepeatState(mapActionIndexToServiceRepeatState(index));
        }
    }
}
 
Example 3
Source File: MediaPlayerGlue.java    From leanback-showcase 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 4
Source File: MediaPlayerGlue.java    From leanback-showcase 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);
    }
}