From 478ad42977f90ca07f447361a7ebfc93530801cc Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Fri, 5 Nov 2021 18:07:21 +0100 Subject: [PATCH] De-Duplicated some code --- .../player/event/PlayerGestureListener.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/event/PlayerGestureListener.java b/app/src/main/java/org/schabi/newpipe/player/event/PlayerGestureListener.java index 005a0b2be..689c0c1ff 100644 --- a/app/src/main/java/org/schabi/newpipe/player/event/PlayerGestureListener.java +++ b/app/src/main/java/org/schabi/newpipe/player/event/PlayerGestureListener.java @@ -210,7 +210,11 @@ public class PlayerGestureListener Log.d(TAG, "onScrollEnd called with playerType = [" + player.getPlayerType() + "]"); } - + + if (player.isControlsVisible() && player.getCurrentState() == STATE_PLAYING) { + player.hideControls(DEFAULT_CONTROLS_DURATION, DEFAULT_CONTROLS_HIDE_TIME); + } + if (playerType == MainPlayer.PlayerType.VIDEO) { if (player.getVolumeRelativeLayout().getVisibility() == View.VISIBLE) { animate(player.getVolumeRelativeLayout(), false, 200, SCALE_AND_ALPHA, @@ -220,15 +224,7 @@ public class PlayerGestureListener animate(player.getBrightnessRelativeLayout(), false, 200, SCALE_AND_ALPHA, 200); } - - if (player.isControlsVisible() && player.getCurrentState() == STATE_PLAYING) { - player.hideControls(DEFAULT_CONTROLS_DURATION, DEFAULT_CONTROLS_HIDE_TIME); - } } else /* Popup-Player */ { - if (player.isControlsVisible() && player.getCurrentState() == STATE_PLAYING) { - player.hideControls(DEFAULT_CONTROLS_DURATION, DEFAULT_CONTROLS_HIDE_TIME); - } - if (player.isInsideClosingRadius(event)) { player.closePopup(); } else if (!player.isPopupClosing()) {