本文整理汇总了Java中android.support.v17.leanback.widget.PlaybackControlsRow类的典型用法代码示例。如果您正苦于以下问题:Java PlaybackControlsRow类的具体用法?Java PlaybackControlsRow怎么用?Java PlaybackControlsRow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlaybackControlsRow类属于android.support.v17.leanback.widget包,在下文中一共展示了PlaybackControlsRow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupUI
import android.support.v17.leanback.widget.PlaybackControlsRow; //导入依赖的package包/类
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);
}
示例2: createControlsRowAndPresenter
import android.support.v17.leanback.widget.PlaybackControlsRow; //导入依赖的package包/类
@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;
}
示例3: dispatchAction
import android.support.v17.leanback.widget.PlaybackControlsRow; //导入依赖的package包/类
@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);
}
}
示例4: onActionClicked
import android.support.v17.leanback.widget.PlaybackControlsRow; //导入依赖的package包/类
@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);
}
}
示例5: setupPlaybackControlItemsToInitialisingState
import android.support.v17.leanback.widget.PlaybackControlsRow; //导入依赖的package包/类
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());
}
示例6: setupPrimaryRowPlaybackControl
import android.support.v17.leanback.widget.PlaybackControlsRow; //导入依赖的package包/类
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);
}
}
示例7: notifyActionChanged
import android.support.v17.leanback.widget.PlaybackControlsRow; //导入依赖的package包/类
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);
}
}
}
}
示例8: addPlaybackControlsRow
import android.support.v17.leanback.widget.PlaybackControlsRow; //导入依赖的package包/类
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);
}
示例9: onCreate
import android.support.v17.leanback.widget.PlaybackControlsRow; //导入依赖的package包/类
@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();
}
示例10: addPlaybackControlsRow
import android.support.v17.leanback.widget.PlaybackControlsRow; //导入依赖的package包/类
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);
}
示例11: VideoPlayerGlue
import android.support.v17.leanback.widget.PlaybackControlsRow; //导入依赖的package包/类
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);
}
示例12: dispatchAction
import android.support.v17.leanback.widget.PlaybackControlsRow; //导入依赖的package包/类
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());
}
}
示例13: onActionClicked
import android.support.v17.leanback.widget.PlaybackControlsRow; //导入依赖的package包/类
@Override
public void onActionClicked(Action action) {
if (action == mPlayPauseAction) {
mPlayPauseAction.nextIndex();
if (mPlayer != null) {
mPlayer.setPlayWhenReady(mPlayPauseAction.getIndex() == PlaybackControlsRow.PlayPauseAction.PAUSE);
}
mGlue.notifyPlaybackRowChanged();
}
}
示例14: dispatchAction
import android.support.v17.leanback.widget.PlaybackControlsRow; //导入依赖的package包/类
@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);
}
}
示例15: notifyActionChanged
import android.support.v17.leanback.widget.PlaybackControlsRow; //导入依赖的package包/类
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);
}
}
}