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

The following examples show how to use androidx.leanback.widget.PlaybackControlsRow#MultiAction . 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 tv-samples with Apache License 2.0 6 votes vote down vote up
private void notifyActionChanged(PlaybackControlsRow.MultiAction action) {
    int index = -1;
    if (getPrimaryActionsAdapter() != null) {
        index = getPrimaryActionsAdapter().indexOf(action);
    }
    if (index >= 0) {
        getPrimaryActionsAdapter().notifyArrayItemRangeChanged(index, 1);
    } else {
        if (getSecondaryActionsAdapter() != null) {
            index = getSecondaryActionsAdapter().indexOf(action);
            if (index >= 0) {
                getSecondaryActionsAdapter().notifyArrayItemRangeChanged(index, 1);
            }
        }
    }
}
 
Example 2
Source File: VideoPlayerGlue.java    From tv-samples with Apache License 2.0 6 votes vote down vote up
private void dispatchAction(Action action) {
    // Primary actions are handled manually.
    if (action == mRewindAction) {
        rewind();
    } else if (action == mFastForwardAction) {
        fastForward();
    } else if (action instanceof PlaybackControlsRow.MultiAction) {
        PlaybackControlsRow.MultiAction multiAction = (PlaybackControlsRow.MultiAction) action;
        multiAction.nextIndex();
        // Notify adapter of action changes to handle secondary actions, such as, thumbs up/down
        // and repeat.
        notifyActionChanged(
                multiAction,
                (ArrayObjectAdapter) getControlsRow().getSecondaryActionsAdapter());
    }
}
 
Example 3
Source File: VideoPlayerGlue.java    From androidtv-Leanback with Apache License 2.0 6 votes vote down vote up
private void dispatchAction(Action action) {
    // Primary actions are handled manually.
    if (action == mRewindAction) {
        rewind();
    } else if (action == mFastForwardAction) {
        fastForward();
    } else if (action instanceof PlaybackControlsRow.MultiAction) {
        PlaybackControlsRow.MultiAction multiAction = (PlaybackControlsRow.MultiAction) action;
        multiAction.nextIndex();
        // Notify adapter of action changes to handle secondary actions, such as, thumbs up/down
        // and repeat.
        notifyActionChanged(
                multiAction,
                (ArrayObjectAdapter) getControlsRow().getSecondaryActionsAdapter());
    }
}
 
Example 4
Source File: VideoMediaPlayerGlue.java    From tv-samples with Apache License 2.0 5 votes vote down vote up
private void dispatchAction(Action action) {
    if (action == mPipAction) {
        ((Activity) getContext()).enterPictureInPictureMode();
    } else {
        Toast.makeText(getContext(), action.toString(), Toast.LENGTH_SHORT).show();
        PlaybackControlsRow.MultiAction multiAction = (PlaybackControlsRow.MultiAction) action;
        multiAction.nextIndex();
        notifyActionChanged(multiAction);
    }
}
 
Example 5
Source File: VideoPlayerGlue.java    From tv-samples with Apache License 2.0 5 votes vote down vote up
private void notifyActionChanged(
        PlaybackControlsRow.MultiAction action, ArrayObjectAdapter adapter) {
    if (adapter != null) {
        int index = adapter.indexOf(action);
        if (index >= 0) {
            adapter.notifyArrayItemRangeChanged(index, 1);
        }
    }
}
 
Example 6
Source File: VideoPlayerGlue.java    From androidtv-Leanback with Apache License 2.0 5 votes vote down vote up
private void notifyActionChanged(
        PlaybackControlsRow.MultiAction action, ArrayObjectAdapter adapter) {
    if (adapter != null) {
        int index = adapter.indexOf(action);
        if (index >= 0) {
            adapter.notifyArrayItemRangeChanged(index, 1);
        }
    }
}