|
166 | 166 | import org.schabi.newpipe.player.helper.MediaSessionManager; |
167 | 167 | import org.schabi.newpipe.player.helper.PlayerDataSource; |
168 | 168 | import org.schabi.newpipe.player.helper.PlayerHelper; |
169 | | -import org.schabi.newpipe.player.listeners.view.PlaybackSpeedListener; |
170 | | -import org.schabi.newpipe.player.listeners.view.QualityTextListener; |
| 169 | +import org.schabi.newpipe.player.listeners.view.PlaybackSpeedClickListener; |
| 170 | +import org.schabi.newpipe.player.listeners.view.QualityClickListener; |
171 | 171 | import org.schabi.newpipe.player.playback.CustomTrackSelector; |
172 | 172 | import org.schabi.newpipe.player.playback.MediaSourceManager; |
173 | 173 | import org.schabi.newpipe.player.playback.PlaybackListener; |
@@ -532,9 +532,9 @@ private void initPlayer(final boolean playOnReady) { |
532 | 532 |
|
533 | 533 | private void initListeners() { |
534 | 534 | binding.qualityTextView.setOnClickListener( |
535 | | - new QualityTextListener(this, qualityPopupMenu)); |
| 535 | + new QualityClickListener(this, qualityPopupMenu)); |
536 | 536 | binding.playbackSpeed.setOnClickListener( |
537 | | - new PlaybackSpeedListener(this, playbackSpeedPopupMenu)); |
| 537 | + new PlaybackSpeedClickListener(this, playbackSpeedPopupMenu)); |
538 | 538 |
|
539 | 539 | binding.playbackSeekBar.setOnSeekBarChangeListener(this); |
540 | 540 | binding.captionTextView.setOnClickListener(this); |
@@ -3772,23 +3772,33 @@ public void onClick(final View v) { |
3772 | 3772 | context.sendBroadcast(new Intent(VideoDetailFragment.ACTION_HIDE_MAIN_PLAYER)); |
3773 | 3773 | } |
3774 | 3774 |
|
3775 | | - if (currentState != STATE_COMPLETED) { |
3776 | | - controlsVisibilityHandler.removeCallbacksAndMessages(null); |
3777 | | - showHideShadow(true, DEFAULT_CONTROLS_DURATION); |
3778 | | - animate(binding.playbackControlRoot, true, DEFAULT_CONTROLS_DURATION, |
3779 | | - AnimationType.ALPHA, 0, () -> { |
3780 | | - if (currentState == STATE_PLAYING && !isSomePopupMenuVisible) { |
3781 | | - if (v.getId() == binding.playPauseButton.getId() |
3782 | | - // Hide controls in fullscreen immediately |
3783 | | - || (v.getId() == binding.screenRotationButton.getId() |
3784 | | - && isFullscreen)) { |
3785 | | - hideControls(0, 0); |
3786 | | - } else { |
3787 | | - hideControls(DEFAULT_CONTROLS_DURATION, DEFAULT_CONTROLS_HIDE_TIME); |
3788 | | - } |
3789 | | - } |
3790 | | - }); |
| 3775 | + afterOnClick(v); |
| 3776 | + } |
| 3777 | + |
| 3778 | + /** |
| 3779 | + * Function that should be executed after a click occured on the player UI. |
| 3780 | + * @param v – The view that was clicked |
| 3781 | + */ |
| 3782 | + public void afterOnClick(@NonNull final View v) { |
| 3783 | + if (currentState == STATE_COMPLETED) { |
| 3784 | + return; |
3791 | 3785 | } |
| 3786 | + |
| 3787 | + controlsVisibilityHandler.removeCallbacksAndMessages(null); |
| 3788 | + showHideShadow(true, DEFAULT_CONTROLS_DURATION); |
| 3789 | + animate(binding.playbackControlRoot, true, DEFAULT_CONTROLS_DURATION, |
| 3790 | + AnimationType.ALPHA, 0, () -> { |
| 3791 | + if (currentState == STATE_PLAYING && !isSomePopupMenuVisible) { |
| 3792 | + if (v.getId() == binding.playPauseButton.getId() |
| 3793 | + // Hide controls in fullscreen immediately |
| 3794 | + || (v.getId() == binding.screenRotationButton.getId() |
| 3795 | + && isFullscreen)) { |
| 3796 | + hideControls(0, 0); |
| 3797 | + } else { |
| 3798 | + hideControls(DEFAULT_CONTROLS_DURATION, DEFAULT_CONTROLS_HIDE_TIME); |
| 3799 | + } |
| 3800 | + } |
| 3801 | + }); |
3792 | 3802 | } |
3793 | 3803 |
|
3794 | 3804 | @Override |
|
0 commit comments