Java 类android.support.v17.leanback.widget.ControlButtonPresenterSelector 实例源码

项目:lostfilm-android-client    文件:PlayerActivity.java   
private void setupUI() {
    VideoFragment videoFragment = (VideoFragment) getFragmentManager().findFragmentById(R.id.video_fragment);
    mGlue = new VideoFragmentGlueHost(videoFragment);
    mGlue.setSurfaceHolderCallback(this);
    mGlue.setOnActionClickedListener(this);

    mControlsRow = new PlaybackControlsRow(mSelectedLink);

    ArrayObjectAdapter adapter = new ArrayObjectAdapter(new ControlButtonPresenterSelector());
    mPlayPauseAction = new PlaybackControlsRow.PlayPauseAction(this);
    mPlayPauseAction.nextIndex(); // set to play
    adapter.add(new PlaybackControlsRow.RewindAction(this));
    adapter.add(mPlayPauseAction);
    adapter.add(new PlaybackControlsRow.FastForwardAction(this));
    mControlsRow.setPrimaryActionsAdapter(adapter);

    PlaybackControlsRowPresenter presenter = new PlaybackControlsRowPresenter(new DetailsPresenter());

    mGlue.setPlaybackRow(mControlsRow);
    mGlue.setPlaybackRowPresenter(presenter);
}
项目:chaosflix-leanback    文件:PlaybackHelper.java   
@Override
public PlaybackControlsRowPresenter createControlsRowAndPresenter() {
    PlaybackControlsRowPresenter presenter = super.createControlsRowAndPresenter();
    adapter = new ArrayObjectAdapter(new ControlButtonPresenterSelector());
    getControlsRow().setSecondaryActionsAdapter(adapter);

    mFastForwardAction = (PlaybackControlsRow.FastForwardAction) getPrimaryActionsAdapter()
            .lookup(ACTION_FAST_FORWARD);

    mRewindAction = (PlaybackControlsRow.RewindAction) getPrimaryActionsAdapter()
            .lookup(ACTION_REWIND);

    presenter.setOnActionClickedListener(new OnActionClickedListener() {
        @Override
        public void onActionClicked(Action action) {
            dispatchAction(action);
        }
    });
    return presenter;
}
项目:chaosflix    文件:PlaybackHelper.java   
@Override
public PlaybackControlsRowPresenter createControlsRowAndPresenter() {
    PlaybackControlsRowPresenter presenter = super.createControlsRowAndPresenter();
    adapter = new ArrayObjectAdapter(new ControlButtonPresenterSelector());
    getControlsRow().setSecondaryActionsAdapter(adapter);

    mFastForwardAction = (PlaybackControlsRow.FastForwardAction) getPrimaryActionsAdapter()
            .lookup(ACTION_FAST_FORWARD);

    mRewindAction = (PlaybackControlsRow.RewindAction) getPrimaryActionsAdapter()
            .lookup(ACTION_REWIND);

    presenter.setOnActionClickedListener(new OnActionClickedListener() {
        @Override
        public void onActionClicked(Action action) {
            dispatchAction(action);
        }
    });
    return presenter;
}
项目:popcorn-android    文件:PTVPlaybackOverlayFragment.java   
private void setupPlaybackControlItemsToInitialisingState() {
    mRowsAdapter.clear();
    mPlaybackControlsRow = new PlaybackControlsRow(mStreamInfo);
    mPlaybackControlsRow.setCurrentTime(0);
    mPlaybackControlsRow.setBufferedProgress(0);

    ControlButtonPresenterSelector presenterSelector = new ControlButtonPresenterSelector();
    mPrimaryActionsAdapter = new ArrayObjectAdapter(presenterSelector);
    mPlaybackControlsRow.setPrimaryActionsAdapter(mPrimaryActionsAdapter);

    Activity activity = getActivity();
    mPlayPauseAction = new PlayPauseAction(activity);
    mPrimaryActionsAdapter.add(mPlayPauseAction);

    setupSecondaryRowPlaybackControl(presenterSelector);

    mRowsAdapter.add(mPlaybackControlsRow);
    mRowsAdapter.notifyArrayItemRangeChanged(0, mRowsAdapter.size());
}
项目:popcorn-android    文件:PTVPlaybackOverlayFragment.java   
private void setupPrimaryRowPlaybackControl(@NonNull ControlButtonPresenterSelector presenterSelector) {
    mPrimaryActionsAdapter = new ArrayObjectAdapter(presenterSelector);
    mPlaybackControlsRow.setPrimaryActionsAdapter(mPrimaryActionsAdapter);

    Activity activity = getActivity();
    mPlayPauseAction = new PlayPauseAction(activity);
    mFastForwardAction = new FastForwardAction(activity);
    mRewindAction = new RewindAction(activity);

    if (mPreviousEpisode != null) {
        mSkipPreviousAction = new PlaybackControlsRow.SkipPreviousAction(activity);
        mPrimaryActionsAdapter.add(mSkipPreviousAction);
    }

    // Add main controls to primary adapter.
    mPrimaryActionsAdapter.add(mRewindAction);
    mPrimaryActionsAdapter.add(mPlayPauseAction);
    mPrimaryActionsAdapter.add(mFastForwardAction);

    if (mNextEpisode != null) {
        mSkipNextAction = new PlaybackControlsRow.SkipNextAction(activity);
        mPrimaryActionsAdapter.add(mSkipNextAction);
    }
}
项目:MrinalMusicPlayer    文件:TvPlaybackFragment.java   
private void addPlaybackControlsRow(MediaMetadata metadata) {

        mPlaybackControlsRow = new PlaybackControlsRow(new MutableMediaMetadataHolder(metadata));
        mRowsAdapter.add(mPlaybackControlsRow);

        resetPlaybackRow();

        ControlButtonPresenterSelector presenterSelector = new ControlButtonPresenterSelector();
        mPrimaryActionsAdapter = new ArrayObjectAdapter(presenterSelector);
        mPlaybackControlsRow.setPrimaryActionsAdapter(mPrimaryActionsAdapter);

        mPlayPauseAction = new PlayPauseAction(getActivity());
        mSkipNextAction = new PlaybackControlsRow.SkipNextAction(getActivity());
        mSkipPreviousAction = new PlaybackControlsRow.SkipPreviousAction(getActivity());

        mPrimaryActionsAdapter.add(mSkipPreviousAction);
        mPrimaryActionsAdapter.add(mPlayPauseAction);
        mPrimaryActionsAdapter.add(mSkipNextAction);
    }
项目:android-UniversalMusicPlayer    文件:TvPlaybackFragment.java   
private void addPlaybackControlsRow(MediaMetadataCompat metadata) {

        mPlaybackControlsRow = new PlaybackControlsRow(new MutableMediaMetadataHolder(metadata));
        mRowsAdapter.add(mPlaybackControlsRow);

        resetPlaybackRow();

        ControlButtonPresenterSelector presenterSelector = new ControlButtonPresenterSelector();
        mPrimaryActionsAdapter = new ArrayObjectAdapter(presenterSelector);
        mPlaybackControlsRow.setPrimaryActionsAdapter(mPrimaryActionsAdapter);

        mPlayPauseAction = new PlayPauseAction(getActivity());
        mSkipNextAction = new PlaybackControlsRow.SkipNextAction(getActivity());
        mSkipPreviousAction = new PlaybackControlsRow.SkipPreviousAction(getActivity());

        mPrimaryActionsAdapter.add(mSkipPreviousAction);
        mPrimaryActionsAdapter.add(mPlayPauseAction);
        mPrimaryActionsAdapter.add(mSkipNextAction);
    }
项目:UniversalAndroidMusicPlayer    文件:TvPlaybackFragment.java   
private void addPlaybackControlsRow(MediaMetadata metadata) {

        mPlaybackControlsRow = new PlaybackControlsRow(new MutableMediaMetadataHolder(metadata));
        mRowsAdapter.add(mPlaybackControlsRow);

        resetPlaybackRow();

        ControlButtonPresenterSelector presenterSelector = new ControlButtonPresenterSelector();
        mPrimaryActionsAdapter = new ArrayObjectAdapter(presenterSelector);
        mPlaybackControlsRow.setPrimaryActionsAdapter(mPrimaryActionsAdapter);

        mPlayPauseAction = new PlayPauseAction(getActivity());
        mSkipNextAction = new PlaybackControlsRow.SkipNextAction(getActivity());
        mSkipPreviousAction = new PlaybackControlsRow.SkipPreviousAction(getActivity());

        mPrimaryActionsAdapter.add(mSkipPreviousAction);
        mPrimaryActionsAdapter.add(mPlayPauseAction);
        mPrimaryActionsAdapter.add(mSkipNextAction);
    }
项目:androidtv-sample    文件:PlaybackControlHelper.java   
@Override
public PlaybackControlsRowPresenter createControlsRowAndPresenter() {
    PlaybackControlsRowPresenter presenter = super.createControlsRowAndPresenter();

    ArrayObjectAdapter adapter = new ArrayObjectAdapter(new ControlButtonPresenterSelector());
    getControlsRow().setSecondaryActionsAdapter(adapter);

    mFastForwardAction = (PlaybackControlsRow.FastForwardAction) getPrimaryActionsAdapter()
            .lookup(ACTION_FAST_FORWARD);

    mRewindAction = (PlaybackControlsRow.RewindAction) getPrimaryActionsAdapter()
            .lookup(ACTION_REWIND);

    // odebrani zbytecnych tlacitek
    /*
    adapter.add(mThumbsDownAction);
    adapter.add(mRepeatAction);
    adapter.add(mThumbsUpAction);
    */
    if (PlaybackOverlayActivity.supportsPictureInPicture(getContext())) {
        adapter.add(mPipAction);
    }

    presenter.setOnActionClickedListener(new OnActionClickedListener() {
        @Override
        public void onActionClicked(Action action) {
            dispatchAction(action);
        }
    });

    return presenter;
}
项目:chilly    文件:PlaybackControlHelper.java   
@Override
public PlaybackControlsRowPresenter createControlsRowAndPresenter() {
    PlaybackControlsRowPresenter presenter = super.createControlsRowAndPresenter();

    ArrayObjectAdapter adapter = new ArrayObjectAdapter(new ControlButtonPresenterSelector());
    getControlsRow().setSecondaryActionsAdapter(adapter);

    mFastForwardAction = (PlaybackControlsRow.FastForwardAction) getPrimaryActionsAdapter()
            .lookup(ACTION_FAST_FORWARD);

    mRewindAction = (PlaybackControlsRow.RewindAction) getPrimaryActionsAdapter()
            .lookup(ACTION_REWIND);

    adapter.add(mThumbsDownAction);
    adapter.add(mRepeatAction);
    adapter.add(mThumbsUpAction);
    if (PlaybackOverlayActivity.supportsPictureInPicture(getContext())) {
        adapter.add(mPipAction);
    }

    presenter.setOnActionClickedListener(new OnActionClickedListener() {
        @Override
        public void onActionClicked(Action action) {
            dispatchAction(action);
        }
    });

    return presenter;
}
项目:popcorn-android    文件:PTVPlaybackOverlayFragment.java   
private void setupPlaybackControlItemsToReadyState() {
    mRowsAdapter.clear();
    mPlaybackControlsRow = new PlaybackControlsRow(mStreamInfo);
    mPlaybackControlsRow.setCurrentTime(0);
    mPlaybackControlsRow.setBufferedProgress(0);

    ControlButtonPresenterSelector presenterSelector = new ControlButtonPresenterSelector();
    setupPrimaryRowPlaybackControl(presenterSelector);
    setupSecondaryRowPlaybackControl(presenterSelector);

    mRowsAdapter.add(mPlaybackControlsRow);
    mRowsAdapter.notifyArrayItemRangeChanged(0, mRowsAdapter.size());

    setupPlaybackControlItemsActions();
}
项目:youtubetv    文件:MediaPlayerGlue.java   
@Override
public PlaybackControlsRowPresenter createControlsRowAndPresenter() {
    PlaybackControlsRowPresenter presenter = super.createControlsRowAndPresenter();
    mControlsRow = getControlsRow();

    // Add secondary actions and change the control row color.
    ArrayObjectAdapter secondaryActions = new ArrayObjectAdapter(
            new ControlButtonPresenterSelector());
    mControlsRow.setSecondaryActionsAdapter(secondaryActions);
    addSecondaryActions(secondaryActions);
    setupControlsRowPresenter(presenter);
    return presenter;
}