2

I am using playback overlay fragment in my Android TV app for video controls.The problem is I want to know whether the buttons are continuously pressed or not.But in callback I only come to know when its pressed .

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


        }
    });
prit
  • 643
  • 7
  • 21
  • Even if there is a way to know where the current focus is in playback controls it will be beneficial. – prit Aug 17 '16 at 18:03

1 Answers1

0

If user continuously presses the button then multiple events will be triggered, you can write a logic around that for successive events and modify behavior according to the state

NIPHIN
  • 1,071
  • 1
  • 8
  • 16