Skip to content

Commit b0a10f0

Browse files
committed
Merged extremely similar code together / parity between video and popup player
* Removed ``player.getPlayPauseButton().requestFocus();`` as there is no reason why it was introduced there documented * Use the same delay to hide the controls on both players
1 parent 478ad42 commit b0a10f0

1 file changed

Lines changed: 13 additions & 17 deletions

File tree

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

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -69,26 +69,22 @@ public void onSingleTap(@NotNull final MainPlayer.PlayerType playerType) {
6969
if (DEBUG) {
7070
Log.d(TAG, "onSingleTap called with playerType = [" + player.getPlayerType() + "]");
7171
}
72-
if (playerType == MainPlayer.PlayerType.POPUP) {
7372

74-
if (player.isControlsVisible()) {
75-
player.hideControls(100, 100);
76-
} else {
77-
player.getPlayPauseButton().requestFocus();
78-
player.showControlsThenHide();
79-
}
73+
if (player.isControlsVisible()) {
8074

81-
} else /* playerType == MainPlayer.PlayerType.VIDEO */ {
75+
// -- Controls visible --
8276

83-
if (player.isControlsVisible()) {
84-
player.hideControls(150, 0);
85-
} else {
86-
if (player.getCurrentState() == Player.STATE_COMPLETED) {
87-
player.showControls(0);
88-
} else {
89-
player.showControlsThenHide();
90-
}
91-
}
77+
player.hideControls(150, 0);
78+
return;
79+
}
80+
81+
// -- Controls are not visible --
82+
83+
// When player is completed show controls and don't hide them later
84+
if (player.getCurrentState() == Player.STATE_COMPLETED) {
85+
player.showControls(0);
86+
} else {
87+
player.showControlsThenHide();
9288
}
9389
}
9490

0 commit comments

Comments
 (0)