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

项目: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;
}
项目:androidtv-sample    文件:PlaybackControlHelper.java   
@TargetApi(VERSION_CODES.N)
public void dispatchAction(Action action) {
    if (action instanceof PlaybackControlsRow.MultiAction) {
        PlaybackControlsRow.MultiAction multiAction = (PlaybackControlsRow.MultiAction) action;
        multiAction.nextIndex();
        notifyActionChanged(multiAction);
    }

    if (action == mFastForwardAction) {
        mTransportControls.fastForward();
    } else if (action == mRewindAction) {
        mTransportControls.rewind();
    } else if (action.getId() == mPipAction.getId()) {
        ((Activity) getContext()).enterPictureInPictureMode();
    } else {
        super.onActionClicked(action);
    }
}
项目: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;
}
项目:chilly    文件:PlaybackControlHelper.java   
@TargetApi(VERSION_CODES.N)
public void dispatchAction(Action action) {
    if (action instanceof PlaybackControlsRow.MultiAction) {
        PlaybackControlsRow.MultiAction multiAction = (PlaybackControlsRow.MultiAction) action;
        multiAction.nextIndex();
        notifyActionChanged(multiAction);
    }

    if (action == mFastForwardAction) {
        mTransportControls.fastForward();
    } else if (action == mRewindAction) {
        mTransportControls.rewind();
    } else if (action.getId() == mPipAction.getId()) {
        ((Activity) getContext()).enterPictureInPictureMode();
    } else {
        super.onActionClicked(action);
    }
}
项目:popcorn-android    文件:PTVPlaybackOverlayFragment.java   
@Override
public void onActionClicked(@NonNull Action action) {
    if (action.getId() == mPlayPauseAction.getId()) {
        invokeTogglePlaybackAction(mPlayPauseAction.getIndex() == PlayPauseAction.PLAY);
    }
    else if (action.getId() == mScaleVideoAction.getId()) {
        invokeScaleVideoAction();
    }
    else if (action.getId() == mClosedCaptioningAction.getId()) {
        invokeOpenSubtitleSettingsAction();
    }
    if (mSkipPreviousAction != null && action.getId() == mSkipPreviousAction.getId()) {
        playSelectedEpisode(mPreviousEpisode);
    }
    if (mSkipNextAction != null && action.getId() == mSkipNextAction.getId()) {
        playSelectedEpisode(mNextEpisode);
    }

    if (action instanceof PlaybackControlsRow.MultiAction) {
        notifyPlaybackControlActionChanged(action);
    }
}
项目: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);
    }
}
项目:leanback-showcase    文件:VideoMediaPlayerGlue.java   
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);
            }
        }
    }
}
项目: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);
    }
项目:youtubetv    文件:VideoPlayerFragment.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    youtubeTvView = (YoutubeTvView) getActivity().findViewById(R.id.youtubetv_view);

    youtubeTvView.updateView(getArguments());

    youtubeTvView.playVideo(getArguments().getString("videoId", ""));

    mGlue = new VideoMediaPlayerGlue(getActivity(), this, youtubeTvView) {

        @Override
        protected void onRowChanged(PlaybackControlsRow row) {
            if (mRowsAdapter == null) return;
            mRowsAdapter.notifyArrayItemRangeChanged(0, 1);
        }
    };
    mGlue.setOnMediaFileFinishedPlayingListener(this);

    mGlue.prepareMediaForPlaying();

    setBackgroundType(PlaybackOverlayFragment.BG_LIGHT);
    addPlaybackControlsRow();
}
项目: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-Leanback    文件:VideoPlayerGlue.java   
public VideoPlayerGlue(
        Context context,
        LeanbackPlayerAdapter playerAdapter,
        OnActionClickedListener actionListener) {
    super(context, playerAdapter);

    mActionListener = actionListener;

    mSkipPreviousAction = new PlaybackControlsRow.SkipPreviousAction(context);
    mSkipNextAction = new PlaybackControlsRow.SkipNextAction(context);
    mFastForwardAction = new PlaybackControlsRow.FastForwardAction(context);
    mRewindAction = new PlaybackControlsRow.RewindAction(context);

    mThumbsUpAction = new PlaybackControlsRow.ThumbsUpAction(context);
    mThumbsUpAction.setIndex(PlaybackControlsRow.ThumbsUpAction.INDEX_OUTLINE);
    mThumbsDownAction = new PlaybackControlsRow.ThumbsDownAction(context);
    mThumbsDownAction.setIndex(PlaybackControlsRow.ThumbsDownAction.INDEX_OUTLINE);
    mRepeatAction = new PlaybackControlsRow.RepeatAction(context);
}
项目:androidtv-Leanback    文件:VideoPlayerGlue.java   
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());
    }
}
项目:lostfilm-android-client    文件:PlayerActivity.java   
@Override
public void onActionClicked(Action action) {
    if (action == mPlayPauseAction) {
        mPlayPauseAction.nextIndex();
        if (mPlayer != null) {
            mPlayer.setPlayWhenReady(mPlayPauseAction.getIndex() == PlaybackControlsRow.PlayPauseAction.PAUSE);
        }
        mGlue.notifyPlaybackRowChanged();
    }
}
项目:chaosflix-leanback    文件:PlaybackHelper.java   
@TargetApi(Build.VERSION_CODES.N)
public void dispatchAction(Action action) {
    if (action instanceof PlaybackControlsRow.MultiAction) {
        PlaybackControlsRow.MultiAction multiAction = (PlaybackControlsRow.MultiAction) action;
        multiAction.nextIndex();
        notifyActionChanged(multiAction);
    }
    if (action == mFastForwardAction) {
        mTransportControls.fastForward();
    } else if (action == mRewindAction) {
        mTransportControls.rewind();
    } else {
        super.onActionClicked(action);
    }
}
项目:chaosflix-leanback    文件:PlaybackHelper.java   
private void notifyActionChanged(PlaybackControlsRow.MultiAction multiAction) {
    int index;
    index = getPrimaryActionsAdapter().indexOf(multiAction);
    if (index >= 0) {
        getPrimaryActionsAdapter().notifyArrayItemRangeChanged(index, 1);
    } else {
        index = getSecondaryActionsAdapter().indexOf(multiAction);
        if (index >= 0) {
            getSecondaryActionsAdapter().notifyArrayItemRangeChanged(index, 1);
        }
    }
}
项目:androidtv-sample    文件:PlaybackControlHelper.java   
public PlaybackControlHelper(Context context, PlaybackOverlayFragment fragment, Video video) {
    super(context, fragment, SEEK_SPEEDS);
    mFragment = fragment;
    mVideo = video;
    mMediaController = mFragment.getActivity().getMediaController();
    mTransportControls = mMediaController.getTransportControls();

    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);
}
项目: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;
}
项目:androidtv-sample    文件:PlaybackControlHelper.java   
private void notifyActionChanged(PlaybackControlsRow.MultiAction action) {
    int index;
    index = getPrimaryActionsAdapter().indexOf(action);
    if (index >= 0) {
        getPrimaryActionsAdapter().notifyArrayItemRangeChanged(index, 1);
    } else {
        index = getSecondaryActionsAdapter().indexOf(action);
        if (index >= 0) {
            getSecondaryActionsAdapter().notifyArrayItemRangeChanged(index, 1);
        }
    }
}
项目:androidtv-sample    文件:PlaybackOverlayFragment.java   
@Override
public void onStart() {
    super.onStart();

    // Set up UI
    Video video = getActivity().getIntent().getParcelableExtra(VideoDetailsActivity.VIDEO);
    if (!updateSelectedVideo(video)) {
        return;
    }

    mGlue = new PlaybackControlHelper(getActivity(), this, mSelectedVideo);
    PlaybackControlsRowPresenter controlsRowPresenter = mGlue.createControlsRowAndPresenter();
    PlaybackControlsRow controlsRow = mGlue.getControlsRow();
    mMediaControllerCallback = mGlue.createMediaControllerCallback();

    mMediaController = getActivity().getMediaController();
    mMediaController.registerCallback(mMediaControllerCallback);

    ClassPresenterSelector ps = new ClassPresenterSelector();
    ps.addClassPresenter(PlaybackControlsRow.class, controlsRowPresenter);
    ps.addClassPresenter(ListRow.class, new ListRowPresenter());
    mRowsAdapter = new ArrayObjectAdapter(ps);
    mRowsAdapter.add(controlsRow);
    addOtherRows();
    updatePlaybackRow();
    setAdapter(mRowsAdapter);

    startPlaying();
}
项目:chaosflix    文件:PlaybackHelper.java   
@TargetApi(Build.VERSION_CODES.N)
public void dispatchAction(Action action) {
    if (action instanceof PlaybackControlsRow.MultiAction) {
        PlaybackControlsRow.MultiAction multiAction = (PlaybackControlsRow.MultiAction) action;
        multiAction.nextIndex();
        notifyActionChanged(multiAction);
    }
    if (action == mFastForwardAction) {
        mTransportControls.fastForward();
    } else if (action == mRewindAction) {
        mTransportControls.rewind();
    } else {
        super.onActionClicked(action);
    }
}
项目:chaosflix    文件:PlaybackHelper.java   
private void notifyActionChanged(PlaybackControlsRow.MultiAction multiAction) {
    int index;
    index = getPrimaryActionsAdapter().indexOf(multiAction);
    if (index >= 0) {
        getPrimaryActionsAdapter().notifyArrayItemRangeChanged(index, 1);
    } else {
        index = getSecondaryActionsAdapter().indexOf(multiAction);
        if (index >= 0) {
            getSecondaryActionsAdapter().notifyArrayItemRangeChanged(index, 1);
        }
    }
}
项目:chilly    文件:PlaybackControlHelper.java   
public PlaybackControlHelper(Context context, PlaybackOverlayFragment fragment, Video video) {
    super(context, fragment, SEEK_SPEEDS);
    mFragment = fragment;
    mVideo = video;
    mMediaController = mFragment.getActivity().getMediaController();
    mTransportControls = mMediaController.getTransportControls();

    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);
}
项目: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;
}
项目:chilly    文件:PlaybackControlHelper.java   
private void notifyActionChanged(PlaybackControlsRow.MultiAction action) {
    int index;
    index = getPrimaryActionsAdapter().indexOf(action);
    if (index >= 0) {
        getPrimaryActionsAdapter().notifyArrayItemRangeChanged(index, 1);
    } else {
        index = getSecondaryActionsAdapter().indexOf(action);
        if (index >= 0) {
            getSecondaryActionsAdapter().notifyArrayItemRangeChanged(index, 1);
        }
    }
}
项目:chilly    文件:PlaybackOverlayFragment.java   
@Override
    public void onStart() {
        super.onStart();

        // Set up UI
        Video video = getActivity().getIntent().getParcelableExtra(VideoDetailsActivity.VIDEO);
        if (!updateSelectedVideo(video)) {
            return;
        }

        mGlue = new PlaybackControlHelper(getActivity(), this, mSelectedVideo);
        PlaybackControlsRowPresenter controlsRowPresenter = mGlue.createControlsRowAndPresenter();
        PlaybackControlsRow controlsRow = mGlue.getControlsRow();
        mMediaControllerCallback = mGlue.createMediaControllerCallback();
//
        mMediaController = getActivity().getMediaController();
        mMediaController.registerCallback(mMediaControllerCallback);
//
        ClassPresenterSelector ps = new ClassPresenterSelector();
        ps.addClassPresenter(PlaybackControlsRow.class, controlsRowPresenter);
        ps.addClassPresenter(ListRow.class, new ListRowPresenter());
        mRowsAdapter = new ArrayObjectAdapter(ps);
        mRowsAdapter.add(controlsRow);
        addOtherRows();
        updatePlaybackRow();
        setAdapter(mRowsAdapter);


        startPlaying();

    }
项目:leanback-assistant    文件:PrimaryPlaybackControlsGlue.java   
public PrimaryPlaybackControlsGlue(
        Context context, T adapter, MediaControllerCompat mediaController) {
    super(context, adapter);
    mMediaSessionTransportControls = mediaController.getTransportControls();

    mSkipPreviousAction = new PlaybackControlsRow.SkipPreviousAction(context);
    mSkipNextAction = new PlaybackControlsRow.SkipNextAction(context);
    mFastForwardAction = new PlaybackControlsRow.FastForwardAction(context);
    mRewindAction = new PlaybackControlsRow.RewindAction(context);
}
项目:android_packages_apps_tv    文件:DvrPlaybackOverlayFragment.java   
private void setUpRows() {
    PlaybackControlsRowPresenter controlsRowPresenter =
            mPlaybackControlHelper.createControlsRowAndPresenter();

    ClassPresenterSelector selector = new ClassPresenterSelector();
    selector.addClassPresenter(PlaybackControlsRow.class, controlsRowPresenter);
    selector.addClassPresenter(ListRow.class, new ListRowPresenter());

    mRowsAdapter = new ArrayObjectAdapter(selector);
    mRowsAdapter.add(mPlaybackControlHelper.getControlsRow());
    mRelatedRecordingsRow = getRelatedRecordingsRow();
    setAdapter(mRowsAdapter);
}
项目:popcorn-android    文件:PTVPlaybackOverlayFragment.java   
private void initialisePlaybackControlPresenter() {
    ClassPresenterSelector presenterSelector = new ClassPresenterSelector();
    mPlaybackControlsRowPresenter = new PlaybackControlsRowPresenter(new DescriptionPresenter());
    mPlaybackControlsRowPresenter.setSecondaryActionsHidden(false);

    presenterSelector.addClassPresenter(PlaybackControlsRow.class, mPlaybackControlsRowPresenter);
    presenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());

    mRowsAdapter = new ArrayObjectAdapter(presenterSelector);
    setAdapter(mRowsAdapter);
}
项目: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();
}
项目:itplayer    文件:ExoPlayerGlue.java   
@Override
protected void onCreatePrimaryActions(SparseArrayObjectAdapter primaryActionsAdapter) {
    this.primaryActionsAdapter = primaryActionsAdapter;

    closedCaptionAction = new PlaybackControlsRow.ClosedCaptioningAction(getContext());
    closedCaptionAction.setIndex(PlaybackControlsRow.ClosedCaptioningAction.ON);

    primaryActionsAdapter.notifyArrayItemRangeChanged(primaryActionsAdapter.indexOf(closedCaptionAction), 1);

    primaryActionsAdapter.set(ACTION_CUSTOM_RIGHT_FIRST, closedCaptionAction);
}
项目:itplayer    文件:ExoPlayerGlue.java   
@Override
public void onTrackSelectionsChanged(TrackSelections<? extends MappingTrackSelector.MappedTrackInfo> trackSelections) {
    int textRenderIndex = getRenderIndex(C.TRACK_TYPE_TEXT);
    boolean status = trackSelector.getRendererDisabled(textRenderIndex);
    closedCaptionAction.setIndex(status ? PlaybackControlsRow.ClosedCaptioningAction.ON : PlaybackControlsRow.ClosedCaptioningAction.OFF);
    primaryActionsAdapter.notifyArrayItemRangeChanged(primaryActionsAdapter.indexOf(closedCaptionAction), 1);
}
项目:leanback-showcase    文件:VideoMediaPlayerGlue.java   
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);
}
项目:leanback-showcase    文件:VideoMediaPlayerGlue.java   
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);
    }
}
项目:leanback-showcase    文件:VideoMediaPlayerGlue.java   
@Override
protected void onPlayCompleted() {
    super.onPlayCompleted();
    mHandler.post(new Runnable() {
        @Override
        public void run() {
            if (mRepeatAction.getIndex() != PlaybackControlsRow.RepeatAction.NONE) {
                play();
            }
        }
    });
}
项目:leanback-showcase    文件:MusicMediaPlayerGlue.java   
@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));
        }
    }
}
项目:leanback-showcase    文件:MusicMediaPlayerGlue.java   
public static int mapActionIndexToServiceRepeatState(int index) {
    if (index == PlaybackControlsRow.RepeatAction.ONE) {
        return MusicPlaybackService.MEDIA_ACTION_REPEAT_ONE;
    } else if (index == PlaybackControlsRow.RepeatAction.ALL) {
        return MusicPlaybackService.MEDIA_ACTION_REPEAT_ALL;
    } else {
        return MusicPlaybackService.MEDIA_ACTION_NO_REPEAT;
    }
}
项目:leanback-showcase    文件:MusicMediaPlayerGlue.java   
public static int mapServiceRepeatStateToActionIndex(int serviceRepeatState) {
    if (serviceRepeatState == MusicPlaybackService.MEDIA_ACTION_REPEAT_ONE) {
        return PlaybackControlsRow.RepeatAction.ONE;
    } else if (serviceRepeatState == MusicPlaybackService.MEDIA_ACTION_REPEAT_ALL) {
        return PlaybackControlsRow.RepeatAction.ALL;
    } else {
        return PlaybackControlsRow.RepeatAction.NONE;
    }
}