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
This commit is contained in:
litetex 2021-11-05 18:10:55 +01:00
parent 478ad42977
commit b0a10f0542
1 changed files with 13 additions and 17 deletions

View File

@ -69,28 +69,24 @@ public class PlayerGestureListener
if (DEBUG) { if (DEBUG) {
Log.d(TAG, "onSingleTap called with playerType = [" + player.getPlayerType() + "]"); Log.d(TAG, "onSingleTap called with playerType = [" + player.getPlayerType() + "]");
} }
if (playerType == MainPlayer.PlayerType.POPUP) {
if (player.isControlsVisible()) { if (player.isControlsVisible()) {
player.hideControls(100, 100);
} else { // -- Controls visible --
player.getPlayPauseButton().requestFocus();
player.showControlsThenHide(); player.hideControls(150, 0);
return;
} }
} else /* playerType == MainPlayer.PlayerType.VIDEO */ { // -- Controls are not visible --
if (player.isControlsVisible()) { // When player is completed show controls and don't hide them later
player.hideControls(150, 0);
} else {
if (player.getCurrentState() == Player.STATE_COMPLETED) { if (player.getCurrentState() == Player.STATE_COMPLETED) {
player.showControls(0); player.showControls(0);
} else { } else {
player.showControlsThenHide(); player.showControlsThenHide();
} }
} }
}
}
@Override @Override
public void onScroll(@NotNull final MainPlayer.PlayerType playerType, public void onScroll(@NotNull final MainPlayer.PlayerType playerType,