From 8017898c808a957e57ae8e061411fcd149332e89 Mon Sep 17 00:00:00 2001 From: Faisal Khan Date: Tue, 7 Feb 2023 21:58:27 +0530 Subject: [PATCH] Further double tap gesture improvements (#2988) --- .../github/libretube/ui/views/CustomExoPlayerView.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt b/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt index bc46f7f9c..557442136 100644 --- a/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt +++ b/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt @@ -118,6 +118,8 @@ internal class CustomExoPlayerView( // don't let the player view hide its controls automatically controllerShowTimeoutMs = -1 + // don't let the player view show its controls automatically + controllerAutoShow = false // locking the player binding.lockPlayer.setOnClickListener { @@ -172,6 +174,11 @@ internal class CustomExoPlayerView( // keep screen on if the video is playing keepScreenOn = player.isPlaying == true + + if (player.playbackState == Player.STATE_ENDED && !autoplayEnabled) { + showController() + cancelHideControllerTask() + } } } }) @@ -603,8 +610,9 @@ internal class CustomExoPlayerView( * Add extra margin to the top bar to not overlap the status bar */ private fun updateTopBarMargin() { - val isFullscreen = resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE || - playerViewModel?.isFullscreen?.value == true + val isFullscreen = + resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE || + playerViewModel?.isFullscreen?.value == true binding.topBar.updateLayoutParams { topMargin = (if (isFullscreen) 10 else 0).dpToPx().toInt() }