From 080c4ba68051e37930c512c40c644866dd253a35 Mon Sep 17 00:00:00 2001 From: XiangRongLin <41164160+XiangRongLin@users.noreply.github.com> Date: Thu, 10 Mar 2022 20:20:34 +0100 Subject: [PATCH 1/7] Extract 2 view click listeners from Player --- .../org/schabi/newpipe/player/Player.java | 26 +++++++---- .../listeners/view/PlaybackSpeedListener.kt | 46 +++++++++++++++++++ .../listeners/view/QualityTextListener.kt | 41 +++++++++++++++++ 3 files changed, 105 insertions(+), 8 deletions(-) create mode 100644 app/src/main/java/org/schabi/newpipe/player/listeners/view/PlaybackSpeedListener.kt create mode 100644 app/src/main/java/org/schabi/newpipe/player/listeners/view/QualityTextListener.kt diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java index 481f9a6d8..a32ae247d 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -167,6 +167,8 @@ import org.schabi.newpipe.player.helper.MediaSessionManager; import org.schabi.newpipe.player.helper.PlaybackParameterDialog; import org.schabi.newpipe.player.helper.PlayerDataSource; import org.schabi.newpipe.player.helper.PlayerHelper; +import org.schabi.newpipe.player.listeners.view.PlaybackSpeedListener; +import org.schabi.newpipe.player.listeners.view.QualityTextListener; import org.schabi.newpipe.player.playback.CustomTrackSelector; import org.schabi.newpipe.player.playback.MediaSourceManager; import org.schabi.newpipe.player.playback.PlaybackListener; @@ -530,9 +532,12 @@ public final class Player implements } private void initListeners() { + binding.qualityTextView.setOnClickListener( + new QualityTextListener(this, qualityPopupMenu)); + binding.playbackSpeed.setOnClickListener( + new PlaybackSpeedListener(this, playbackSpeedPopupMenu)); + binding.playbackSeekBar.setOnSeekBarChangeListener(this); - binding.playbackSpeed.setOnClickListener(this); - binding.qualityTextView.setOnClickListener(this); binding.captionTextView.setOnClickListener(this); binding.resizeTextView.setOnClickListener(this); binding.playbackLiveSync.setOnClickListener(this); @@ -1926,7 +1931,7 @@ public final class Player implements }, delay); } - private void showHideShadow(final boolean show, final long duration) { + public void showHideShadow(final boolean show, final long duration) { animate(binding.playbackControlsShadow, show, duration, AnimationType.ALPHA, 0, null); animate(binding.playerTopShadow, show, duration, AnimationType.ALPHA, 0, null); animate(binding.playerBottomShadow, show, duration, AnimationType.ALPHA, 0, null); @@ -3742,11 +3747,7 @@ public final class Player implements if (DEBUG) { Log.d(TAG, "onClick() called with: v = [" + v + "]"); } - if (v.getId() == binding.qualityTextView.getId()) { - onQualitySelectorClicked(); - } else if (v.getId() == binding.playbackSpeed.getId()) { - onPlaybackSpeedClicked(); - } else if (v.getId() == binding.resizeTextView.getId()) { + if (v.getId() == binding.resizeTextView.getId()) { onResizeClicked(); } else if (v.getId() == binding.captionTextView.getId()) { onCaptionClicked(); @@ -4446,6 +4447,10 @@ public final class Player implements return isSomePopupMenuVisible; } + public void setSomePopupMenuVisible(final boolean somePopupMenuVisible) { + isSomePopupMenuVisible = somePopupMenuVisible; + } + public ImageButton getPlayPauseButton() { return binding.playPauseButton; } @@ -4527,6 +4532,11 @@ public final class Player implements public PlayQueueAdapter getPlayQueueAdapter() { return playQueueAdapter; } + + public PlayerBinding getBinding() { + return binding; + } + //endregion diff --git a/app/src/main/java/org/schabi/newpipe/player/listeners/view/PlaybackSpeedListener.kt b/app/src/main/java/org/schabi/newpipe/player/listeners/view/PlaybackSpeedListener.kt new file mode 100644 index 000000000..a616e3c7e --- /dev/null +++ b/app/src/main/java/org/schabi/newpipe/player/listeners/view/PlaybackSpeedListener.kt @@ -0,0 +1,46 @@ +package org.schabi.newpipe.player.listeners.view + +import android.util.Log +import android.view.View +import android.widget.PopupMenu +import org.schabi.newpipe.MainActivity +import org.schabi.newpipe.player.Player +import org.schabi.newpipe.player.helper.PlaybackParameterDialog + +class PlaybackSpeedListener( + private val player: Player, + private val playbackSpeedPopupMenu: PopupMenu + +) : View.OnClickListener { + + companion object { + private val DEBUG = MainActivity.DEBUG + private val TAG: String = PlaybackSpeedListener::class.java.simpleName + } + + override fun onClick(v: View) { + if (player.binding.qualityTextView.id == v.id) { + if (DEBUG) { + Log.d(TAG, "onPlaybackSpeedClicked() called") + } + + if (player.videoPlayerSelected()) { + PlaybackParameterDialog.newInstance( + player.playbackSpeed.toDouble(), + player.playbackPitch.toDouble(), + player.playbackSkipSilence + ) { speed: Float, pitch: Float, skipSilence: Boolean -> + player.setPlaybackParameters( + speed, + pitch, + skipSilence + ) + } + .show(player.parentActivity!!.supportFragmentManager, null) + } else { + playbackSpeedPopupMenu.show() + player.isSomePopupMenuVisible = true + } + } + } +} diff --git a/app/src/main/java/org/schabi/newpipe/player/listeners/view/QualityTextListener.kt b/app/src/main/java/org/schabi/newpipe/player/listeners/view/QualityTextListener.kt new file mode 100644 index 000000000..58d4db9ea --- /dev/null +++ b/app/src/main/java/org/schabi/newpipe/player/listeners/view/QualityTextListener.kt @@ -0,0 +1,41 @@ +package org.schabi.newpipe.player.listeners.view + +import android.util.Log +import android.view.View +import android.widget.PopupMenu +import org.schabi.newpipe.MainActivity +import org.schabi.newpipe.extractor.MediaFormat +import org.schabi.newpipe.player.Player + +class QualityTextListener( + private val player: Player, + private val qualityPopupMenu: PopupMenu +) : View.OnClickListener { + + companion object { + private val DEBUG = MainActivity.DEBUG + private val TAG: String = QualityTextListener::class.java.simpleName + } + + override fun onClick(v: View) { + if (player.binding.qualityTextView.id == v.id) { + if (DEBUG) { + Log.d(TAG, "onQualitySelectorClicked() called") + } + + qualityPopupMenu.show() + player.isSomePopupMenuVisible = true + + val videoStream = player.selectedVideoStream + if (videoStream != null) { + val qualityText = ( + MediaFormat.getNameById(videoStream.formatId) + " " + + videoStream.resolution + ) + player.binding.qualityTextView.text = qualityText + } + + player.saveWasPlaying() + } + } +} From 6a400dda7bdd910fb3f26b1b0bb1b31b7eaa5975 Mon Sep 17 00:00:00 2001 From: XiangRongLin <41164160+XiangRongLin@users.noreply.github.com> Date: Thu, 10 Mar 2022 20:41:06 +0100 Subject: [PATCH 2/7] delete unused methods --- .../org/schabi/newpipe/player/Player.java | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java index a32ae247d..7c3e20d41 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -3612,37 +3612,6 @@ public final class Player implements } } - private void onQualitySelectorClicked() { - if (DEBUG) { - Log.d(TAG, "onQualitySelectorClicked() called"); - } - qualityPopupMenu.show(); - isSomePopupMenuVisible = true; - - final VideoStream videoStream = getSelectedVideoStream(); - if (videoStream != null) { - final String qualityText = MediaFormat.getNameById(videoStream.getFormatId()) + " " - + videoStream.resolution; - binding.qualityTextView.setText(qualityText); - } - - saveWasPlaying(); - } - - private void onPlaybackSpeedClicked() { - if (DEBUG) { - Log.d(TAG, "onPlaybackSpeedClicked() called"); - } - if (videoPlayerSelected()) { - PlaybackParameterDialog.newInstance(getPlaybackSpeed(), getPlaybackPitch(), - getPlaybackSkipSilence(), this::setPlaybackParameters) - .show(getParentActivity().getSupportFragmentManager(), null); - } else { - playbackSpeedPopupMenu.show(); - isSomePopupMenuVisible = true; - } - } - private void onCaptionClicked() { if (DEBUG) { Log.d(TAG, "onCaptionClicked() called"); From d348c2099e2d84988c4ae385564952517ae904b8 Mon Sep 17 00:00:00 2001 From: XiangRongLin <41164160+XiangRongLin@users.noreply.github.com> Date: Thu, 10 Mar 2022 20:49:16 +0100 Subject: [PATCH 3/7] stupid checkstyle --- app/src/main/java/org/schabi/newpipe/player/Player.java | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java index 7c3e20d41..54f12db8b 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -164,7 +164,6 @@ import org.schabi.newpipe.player.event.PlayerServiceEventListener; import org.schabi.newpipe.player.helper.AudioReactor; import org.schabi.newpipe.player.helper.LoadController; import org.schabi.newpipe.player.helper.MediaSessionManager; -import org.schabi.newpipe.player.helper.PlaybackParameterDialog; import org.schabi.newpipe.player.helper.PlayerDataSource; import org.schabi.newpipe.player.helper.PlayerHelper; import org.schabi.newpipe.player.listeners.view.PlaybackSpeedListener; From 30a8f25d525914e0b6104092f563a3647c7ff26f Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Wed, 16 Mar 2022 15:37:28 +0100 Subject: [PATCH 4/7] Refactored code --- .../org/schabi/newpipe/player/Player.java | 50 +++++++++++-------- .../view/PlaybackSpeedClickListener.kt | 47 +++++++++++++++++ .../listeners/view/PlaybackSpeedListener.kt | 46 ----------------- .../listeners/view/QualityClickListener.kt | 41 +++++++++++++++ .../listeners/view/QualityTextListener.kt | 41 --------------- 5 files changed, 118 insertions(+), 107 deletions(-) create mode 100644 app/src/main/java/org/schabi/newpipe/player/listeners/view/PlaybackSpeedClickListener.kt delete mode 100644 app/src/main/java/org/schabi/newpipe/player/listeners/view/PlaybackSpeedListener.kt create mode 100644 app/src/main/java/org/schabi/newpipe/player/listeners/view/QualityClickListener.kt delete mode 100644 app/src/main/java/org/schabi/newpipe/player/listeners/view/QualityTextListener.kt diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java index 54f12db8b..c06e2f2d4 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -166,8 +166,8 @@ import org.schabi.newpipe.player.helper.LoadController; import org.schabi.newpipe.player.helper.MediaSessionManager; import org.schabi.newpipe.player.helper.PlayerDataSource; import org.schabi.newpipe.player.helper.PlayerHelper; -import org.schabi.newpipe.player.listeners.view.PlaybackSpeedListener; -import org.schabi.newpipe.player.listeners.view.QualityTextListener; +import org.schabi.newpipe.player.listeners.view.PlaybackSpeedClickListener; +import org.schabi.newpipe.player.listeners.view.QualityClickListener; import org.schabi.newpipe.player.playback.CustomTrackSelector; import org.schabi.newpipe.player.playback.MediaSourceManager; import org.schabi.newpipe.player.playback.PlaybackListener; @@ -532,9 +532,9 @@ public final class Player implements private void initListeners() { binding.qualityTextView.setOnClickListener( - new QualityTextListener(this, qualityPopupMenu)); + new QualityClickListener(this, qualityPopupMenu)); binding.playbackSpeed.setOnClickListener( - new PlaybackSpeedListener(this, playbackSpeedPopupMenu)); + new PlaybackSpeedClickListener(this, playbackSpeedPopupMenu)); binding.playbackSeekBar.setOnSeekBarChangeListener(this); binding.captionTextView.setOnClickListener(this); @@ -3772,23 +3772,33 @@ public final class Player implements context.sendBroadcast(new Intent(VideoDetailFragment.ACTION_HIDE_MAIN_PLAYER)); } - if (currentState != STATE_COMPLETED) { - controlsVisibilityHandler.removeCallbacksAndMessages(null); - showHideShadow(true, DEFAULT_CONTROLS_DURATION); - animate(binding.playbackControlRoot, true, DEFAULT_CONTROLS_DURATION, - AnimationType.ALPHA, 0, () -> { - if (currentState == STATE_PLAYING && !isSomePopupMenuVisible) { - if (v.getId() == binding.playPauseButton.getId() - // Hide controls in fullscreen immediately - || (v.getId() == binding.screenRotationButton.getId() - && isFullscreen)) { - hideControls(0, 0); - } else { - hideControls(DEFAULT_CONTROLS_DURATION, DEFAULT_CONTROLS_HIDE_TIME); - } - } - }); + afterOnClick(v); + } + + /** + * Function that should be executed after a click occured on the player UI. + * @param v – The view that was clicked + */ + public void afterOnClick(@NonNull final View v) { + if (currentState == STATE_COMPLETED) { + return; } + + controlsVisibilityHandler.removeCallbacksAndMessages(null); + showHideShadow(true, DEFAULT_CONTROLS_DURATION); + animate(binding.playbackControlRoot, true, DEFAULT_CONTROLS_DURATION, + AnimationType.ALPHA, 0, () -> { + if (currentState == STATE_PLAYING && !isSomePopupMenuVisible) { + if (v.getId() == binding.playPauseButton.getId() + // Hide controls in fullscreen immediately + || (v.getId() == binding.screenRotationButton.getId() + && isFullscreen)) { + hideControls(0, 0); + } else { + hideControls(DEFAULT_CONTROLS_DURATION, DEFAULT_CONTROLS_HIDE_TIME); + } + } + }); } @Override diff --git a/app/src/main/java/org/schabi/newpipe/player/listeners/view/PlaybackSpeedClickListener.kt b/app/src/main/java/org/schabi/newpipe/player/listeners/view/PlaybackSpeedClickListener.kt new file mode 100644 index 000000000..b256b084a --- /dev/null +++ b/app/src/main/java/org/schabi/newpipe/player/listeners/view/PlaybackSpeedClickListener.kt @@ -0,0 +1,47 @@ +package org.schabi.newpipe.player.listeners.view + +import android.util.Log +import android.view.View +import android.widget.PopupMenu +import org.schabi.newpipe.MainActivity +import org.schabi.newpipe.player.Player +import org.schabi.newpipe.player.helper.PlaybackParameterDialog + +/** + * Click listener for the playbackSpeed textview of the player + */ +class PlaybackSpeedClickListener( + private val player: Player, + private val playbackSpeedPopupMenu: PopupMenu +) : View.OnClickListener { + + companion object { + private const val TAG: String = "PlaybSpeedClickListener" + } + + override fun onClick(v: View) { + if (MainActivity.DEBUG) { + Log.d(TAG, "onPlaybackSpeedClicked() called") + } + + if (player.videoPlayerSelected()) { + PlaybackParameterDialog.newInstance( + player.playbackSpeed.toDouble(), + player.playbackPitch.toDouble(), + player.playbackSkipSilence + ) { speed: Float, pitch: Float, skipSilence: Boolean -> + player.setPlaybackParameters( + speed, + pitch, + skipSilence + ) + } + .show(player.parentActivity!!.supportFragmentManager, null) + } else { + playbackSpeedPopupMenu.show() + player.isSomePopupMenuVisible = true + } + + player.afterOnClick(v) + } +} diff --git a/app/src/main/java/org/schabi/newpipe/player/listeners/view/PlaybackSpeedListener.kt b/app/src/main/java/org/schabi/newpipe/player/listeners/view/PlaybackSpeedListener.kt deleted file mode 100644 index a616e3c7e..000000000 --- a/app/src/main/java/org/schabi/newpipe/player/listeners/view/PlaybackSpeedListener.kt +++ /dev/null @@ -1,46 +0,0 @@ -package org.schabi.newpipe.player.listeners.view - -import android.util.Log -import android.view.View -import android.widget.PopupMenu -import org.schabi.newpipe.MainActivity -import org.schabi.newpipe.player.Player -import org.schabi.newpipe.player.helper.PlaybackParameterDialog - -class PlaybackSpeedListener( - private val player: Player, - private val playbackSpeedPopupMenu: PopupMenu - -) : View.OnClickListener { - - companion object { - private val DEBUG = MainActivity.DEBUG - private val TAG: String = PlaybackSpeedListener::class.java.simpleName - } - - override fun onClick(v: View) { - if (player.binding.qualityTextView.id == v.id) { - if (DEBUG) { - Log.d(TAG, "onPlaybackSpeedClicked() called") - } - - if (player.videoPlayerSelected()) { - PlaybackParameterDialog.newInstance( - player.playbackSpeed.toDouble(), - player.playbackPitch.toDouble(), - player.playbackSkipSilence - ) { speed: Float, pitch: Float, skipSilence: Boolean -> - player.setPlaybackParameters( - speed, - pitch, - skipSilence - ) - } - .show(player.parentActivity!!.supportFragmentManager, null) - } else { - playbackSpeedPopupMenu.show() - player.isSomePopupMenuVisible = true - } - } - } -} diff --git a/app/src/main/java/org/schabi/newpipe/player/listeners/view/QualityClickListener.kt b/app/src/main/java/org/schabi/newpipe/player/listeners/view/QualityClickListener.kt new file mode 100644 index 000000000..17a77dc78 --- /dev/null +++ b/app/src/main/java/org/schabi/newpipe/player/listeners/view/QualityClickListener.kt @@ -0,0 +1,41 @@ +package org.schabi.newpipe.player.listeners.view + +import android.annotation.SuppressLint +import android.util.Log +import android.view.View +import android.widget.PopupMenu +import org.schabi.newpipe.MainActivity +import org.schabi.newpipe.extractor.MediaFormat +import org.schabi.newpipe.player.Player + +/** + * Click listener for the qualityTextView of the player + */ +class QualityClickListener( + private val player: Player, + private val qualityPopupMenu: PopupMenu +) : View.OnClickListener { + + companion object { + private const val TAG: String = "QualityClickListener" + } + + @SuppressLint("SetTextI18n") // we don't need I18N because of a " " + override fun onClick(v: View) { + if (MainActivity.DEBUG) { + Log.d(TAG, "onQualitySelectorClicked() called") + } + + qualityPopupMenu.show() + player.isSomePopupMenuVisible = true + + val videoStream = player.selectedVideoStream + if (videoStream != null) { + player.binding.qualityTextView.text = + MediaFormat.getNameById(videoStream.formatId) + " " + videoStream.resolution + } + + player.saveWasPlaying() + player.afterOnClick(v) + } +} diff --git a/app/src/main/java/org/schabi/newpipe/player/listeners/view/QualityTextListener.kt b/app/src/main/java/org/schabi/newpipe/player/listeners/view/QualityTextListener.kt deleted file mode 100644 index 58d4db9ea..000000000 --- a/app/src/main/java/org/schabi/newpipe/player/listeners/view/QualityTextListener.kt +++ /dev/null @@ -1,41 +0,0 @@ -package org.schabi.newpipe.player.listeners.view - -import android.util.Log -import android.view.View -import android.widget.PopupMenu -import org.schabi.newpipe.MainActivity -import org.schabi.newpipe.extractor.MediaFormat -import org.schabi.newpipe.player.Player - -class QualityTextListener( - private val player: Player, - private val qualityPopupMenu: PopupMenu -) : View.OnClickListener { - - companion object { - private val DEBUG = MainActivity.DEBUG - private val TAG: String = QualityTextListener::class.java.simpleName - } - - override fun onClick(v: View) { - if (player.binding.qualityTextView.id == v.id) { - if (DEBUG) { - Log.d(TAG, "onQualitySelectorClicked() called") - } - - qualityPopupMenu.show() - player.isSomePopupMenuVisible = true - - val videoStream = player.selectedVideoStream - if (videoStream != null) { - val qualityText = ( - MediaFormat.getNameById(videoStream.formatId) + " " + - videoStream.resolution - ) - player.binding.qualityTextView.text = qualityText - } - - player.saveWasPlaying() - } - } -} From ee5e0e13b7a2c484e95da2dccaae9db505dc8a0e Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Wed, 16 Mar 2022 15:44:34 +0100 Subject: [PATCH 5/7] Made ``onClick`` less (cognitive) complex --- .../org/schabi/newpipe/player/Player.java | 31 +++------ app/src/main/res/layout/player.xml | 63 ++++++++++--------- 2 files changed, 41 insertions(+), 53 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java index c06e2f2d4..e8d6cff18 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -545,11 +545,15 @@ public final class Player implements gestureDetector = new GestureDetectorCompat(context, playerGestureListener); binding.getRoot().setOnTouchListener(playerGestureListener); - binding.queueButton.setOnClickListener(this); - binding.segmentsButton.setOnClickListener(this); - binding.repeatButton.setOnClickListener(this); - binding.shuffleButton.setOnClickListener(this); - binding.addToPlaylistButton.setOnClickListener(this); + binding.queueButton.setOnClickListener(v -> onQueueClicked()); + binding.segmentsButton.setOnClickListener(v -> onSegmentsClicked()); + binding.repeatButton.setOnClickListener(v -> onRepeatClicked()); + binding.shuffleButton.setOnClickListener(v -> onShuffleClicked()); + binding.addToPlaylistButton.setOnClickListener(v -> { + if (getParentActivity() != null) { + onAddToPlaylistClicked(getParentActivity().getSupportFragmentManager()); + } + }); binding.playPauseButton.setOnClickListener(this); binding.playPreviousButton.setOnClickListener(this); @@ -3727,23 +3731,6 @@ public final class Player implements playPrevious(); } else if (v.getId() == binding.playNextButton.getId()) { playNext(); - } else if (v.getId() == binding.queueButton.getId()) { - onQueueClicked(); - return; - } else if (v.getId() == binding.segmentsButton.getId()) { - onSegmentsClicked(); - return; - } else if (v.getId() == binding.repeatButton.getId()) { - onRepeatClicked(); - return; - } else if (v.getId() == binding.shuffleButton.getId()) { - onShuffleClicked(); - return; - } else if (v.getId() == binding.addToPlaylistButton.getId()) { - if (getParentActivity() != null) { - onAddToPlaylistClicked(getParentActivity().getSupportFragmentManager()); - } - return; } else if (v.getId() == binding.moreOptionsButton.getId()) { onMoreOptionsClicked(); } else if (v.getId() == binding.share.getId()) { diff --git a/app/src/main/res/layout/player.xml b/app/src/main/res/layout/player.xml index f545fc0b9..d748942e0 100644 --- a/app/src/main/res/layout/player.xml +++ b/app/src/main/res/layout/player.xml @@ -563,37 +563,6 @@ android:textColor="@android:color/white" android:visibility="gone" /> - - - - + + + + + Date: Wed, 16 Mar 2022 15:46:07 +0100 Subject: [PATCH 6/7] Better naming --- app/src/main/java/org/schabi/newpipe/player/Player.java | 6 +++--- .../player/listeners/view/PlaybackSpeedClickListener.kt | 2 +- .../newpipe/player/listeners/view/QualityClickListener.kt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java index e8d6cff18..76f7a8101 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -3759,14 +3759,14 @@ public final class Player implements context.sendBroadcast(new Intent(VideoDetailFragment.ACTION_HIDE_MAIN_PLAYER)); } - afterOnClick(v); + manageControlsAfterOnClick(v); } /** - * Function that should be executed after a click occured on the player UI. + * Manages the controls after a click occurred on the player UI. * @param v – The view that was clicked */ - public void afterOnClick(@NonNull final View v) { + public void manageControlsAfterOnClick(@NonNull final View v) { if (currentState == STATE_COMPLETED) { return; } diff --git a/app/src/main/java/org/schabi/newpipe/player/listeners/view/PlaybackSpeedClickListener.kt b/app/src/main/java/org/schabi/newpipe/player/listeners/view/PlaybackSpeedClickListener.kt index b256b084a..fe4984c7c 100644 --- a/app/src/main/java/org/schabi/newpipe/player/listeners/view/PlaybackSpeedClickListener.kt +++ b/app/src/main/java/org/schabi/newpipe/player/listeners/view/PlaybackSpeedClickListener.kt @@ -42,6 +42,6 @@ class PlaybackSpeedClickListener( player.isSomePopupMenuVisible = true } - player.afterOnClick(v) + player.manageControlsAfterOnClick(v) } } diff --git a/app/src/main/java/org/schabi/newpipe/player/listeners/view/QualityClickListener.kt b/app/src/main/java/org/schabi/newpipe/player/listeners/view/QualityClickListener.kt index 17a77dc78..432fc79ae 100644 --- a/app/src/main/java/org/schabi/newpipe/player/listeners/view/QualityClickListener.kt +++ b/app/src/main/java/org/schabi/newpipe/player/listeners/view/QualityClickListener.kt @@ -36,6 +36,6 @@ class QualityClickListener( } player.saveWasPlaying() - player.afterOnClick(v) + player.manageControlsAfterOnClick(v) } } From 67651354d5880240259872a47774b96ebe152904 Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Wed, 16 Mar 2022 15:58:46 +0100 Subject: [PATCH 7/7] Fixed conflicts --- .../newpipe/player/listeners/view/PlaybackSpeedClickListener.kt | 2 +- .../newpipe/player/listeners/view/QualityClickListener.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/listeners/view/PlaybackSpeedClickListener.kt b/app/src/main/java/org/schabi/newpipe/player/listeners/view/PlaybackSpeedClickListener.kt index fe4984c7c..52eff5a1c 100644 --- a/app/src/main/java/org/schabi/newpipe/player/listeners/view/PlaybackSpeedClickListener.kt +++ b/app/src/main/java/org/schabi/newpipe/player/listeners/view/PlaybackSpeedClickListener.kt @@ -2,7 +2,7 @@ package org.schabi.newpipe.player.listeners.view import android.util.Log import android.view.View -import android.widget.PopupMenu +import androidx.appcompat.widget.PopupMenu import org.schabi.newpipe.MainActivity import org.schabi.newpipe.player.Player import org.schabi.newpipe.player.helper.PlaybackParameterDialog diff --git a/app/src/main/java/org/schabi/newpipe/player/listeners/view/QualityClickListener.kt b/app/src/main/java/org/schabi/newpipe/player/listeners/view/QualityClickListener.kt index 432fc79ae..b103ac0e6 100644 --- a/app/src/main/java/org/schabi/newpipe/player/listeners/view/QualityClickListener.kt +++ b/app/src/main/java/org/schabi/newpipe/player/listeners/view/QualityClickListener.kt @@ -3,7 +3,7 @@ package org.schabi.newpipe.player.listeners.view import android.annotation.SuppressLint import android.util.Log import android.view.View -import android.widget.PopupMenu +import androidx.appcompat.widget.PopupMenu import org.schabi.newpipe.MainActivity import org.schabi.newpipe.extractor.MediaFormat import org.schabi.newpipe.player.Player