2

我在我的 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();
            }


        }
    });
4

1 回答 1

0

如果用户连续按下按钮,则会触发多个事件,您可以围绕连续事件编写逻辑并根据状态修改行为

于 2016-09-18T07:28:55.800 回答