当前位置: 首页>>代码示例>>Java>>正文


Java PlaybackControlsRow类代码示例

本文整理汇总了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);
}
 
开发者ID:CrazyDude1994,项目名称:lostfilm-android-client,代码行数:22,代码来源:PlayerActivity.java

示例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;
}
 
开发者ID:NiciDieNase,项目名称:chaosflix-leanback,代码行数:21,代码来源:PlaybackHelper.java

示例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);
    }
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:19,代码来源:PlaybackControlHelper.java

示例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);
    }
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:23,代码来源:PTVPlaybackOverlayFragment.java

示例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());
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:20,代码来源:PTVPlaybackOverlayFragment.java

示例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);
    }
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:25,代码来源:PTVPlaybackOverlayFragment.java

示例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);
            }
        }
    }
}
 
开发者ID:googlesamples,项目名称:leanback-showcase,代码行数:17,代码来源:VideoMediaPlayerGlue.java

示例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);
    }
 
开发者ID:mrinalgit-dev,项目名称:MrinalMusicPlayer,代码行数:20,代码来源:TvPlaybackFragment.java

示例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();
}
 
开发者ID:bertrandmartel,项目名称:youtubetv,代码行数:26,代码来源:VideoPlayerFragment.java

示例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);
    }
 
开发者ID:googlesamples,项目名称:android-UniversalMusicPlayer,代码行数:20,代码来源:TvPlaybackFragment.java

示例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);
}
 
开发者ID:googlesamples,项目名称:androidtv-Leanback,代码行数:20,代码来源:VideoPlayerGlue.java

示例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());
    }
}
 
开发者ID:googlesamples,项目名称:androidtv-Leanback,代码行数:17,代码来源:VideoPlayerGlue.java

示例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();
    }
}
 
开发者ID:CrazyDude1994,项目名称:lostfilm-android-client,代码行数:11,代码来源:PlayerActivity.java

示例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);
	}
}
 
开发者ID:NiciDieNase,项目名称:chaosflix-leanback,代码行数:16,代码来源:PlaybackHelper.java

示例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);
		}
	}
}
 
开发者ID:NiciDieNase,项目名称:chaosflix-leanback,代码行数:13,代码来源:PlaybackHelper.java


注:本文中的android.support.v17.leanback.widget.PlaybackControlsRow类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。