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); }
@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; }
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()); }
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); } }
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); }
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); }
@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; }
@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; }
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(); }
@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; }