Skip to content

Commit 478ad42

Browse files
committed
De-Duplicated some code
1 parent 0764983 commit 478ad42

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

app/src/main/java/org/schabi/newpipe/player/event/PlayerGestureListener.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,11 @@ public void onScrollEnd(@NotNull final MainPlayer.PlayerType playerType,
210210
Log.d(TAG, "onScrollEnd called with playerType = ["
211211
+ player.getPlayerType() + "]");
212212
}
213-
213+
214+
if (player.isControlsVisible() && player.getCurrentState() == STATE_PLAYING) {
215+
player.hideControls(DEFAULT_CONTROLS_DURATION, DEFAULT_CONTROLS_HIDE_TIME);
216+
}
217+
214218
if (playerType == MainPlayer.PlayerType.VIDEO) {
215219
if (player.getVolumeRelativeLayout().getVisibility() == View.VISIBLE) {
216220
animate(player.getVolumeRelativeLayout(), false, 200, SCALE_AND_ALPHA,
@@ -220,15 +224,7 @@ public void onScrollEnd(@NotNull final MainPlayer.PlayerType playerType,
220224
animate(player.getBrightnessRelativeLayout(), false, 200, SCALE_AND_ALPHA,
221225
200);
222226
}
223-
224-
if (player.isControlsVisible() && player.getCurrentState() == STATE_PLAYING) {
225-
player.hideControls(DEFAULT_CONTROLS_DURATION, DEFAULT_CONTROLS_HIDE_TIME);
226-
}
227227
} else /* Popup-Player */ {
228-
if (player.isControlsVisible() && player.getCurrentState() == STATE_PLAYING) {
229-
player.hideControls(DEFAULT_CONTROLS_DURATION, DEFAULT_CONTROLS_HIDE_TIME);
230-
}
231-
232228
if (player.isInsideClosingRadius(event)) {
233229
player.closePopup();
234230
} else if (!player.isPopupClosing()) {

0 commit comments

Comments
 (0)