我在我的 Android TV 应用程序中使用播放覆盖片段进行视频控制。问题是我想知道按钮是否被连续按下。但在回调中我只知道何时按下。
this.mPlayBackControlsRowPresenter.setOnActionClickedListener(new OnActionClickedListener() {
public void onActionClicked(Action action) {
PlaybackControlFragment playbackControlFragment = (PlaybackControlFragment)getFragmentManager().findFragmentById(R.id.playback_controls_fragment);
if (action.getId() == playbackControlFragment.getPlayPause().getId()) {
/* PlayPause action */
} else if (action.getId() == playbackControlFragment.getPlayNext().getId()) {
/* SkipNext action */
// mMediaController.getTransportControls().skipToNext();
} else if (action.getId() == playbackControlFragment.getPlayPrevious().getId()) {
/* SkipPrevious action */
// mMediaController.getTransportControls().skipToPrevious();
} else if (action.getId() == playbackControlFragment.getForward().getId()) {
/* FastForward action */
// mMediaController.getTransportControls().fastForward();
} else if (action.getId() == playbackControlFragment.getRewind().getId()) {
/* Rewind action */
// mMediaController.getTransportControls().rewind();
}
}
});