From b42bcf66c77083d62a25c0d79140b53bbc2de9c8 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Mon, 7 Aug 2023 19:07:04 +0200 Subject: [PATCH] feat: hide status bar if player locked --- .../com/github/libretube/ui/views/CustomExoPlayerView.kt | 7 +++++++ .../java/com/github/libretube/ui/views/OnlinePlayerView.kt | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) 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 37b06c7b0..ed33c0a59 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 @@ -18,6 +18,7 @@ import androidx.appcompat.app.AppCompatActivity import androidx.core.content.ContextCompat import androidx.core.os.postDelayed import androidx.core.view.ViewCompat +import androidx.core.view.WindowInsetsCompat import androidx.core.view.isGone import androidx.core.view.isVisible import androidx.core.view.marginStart @@ -47,6 +48,7 @@ import com.github.libretube.helpers.PlayerHelper import com.github.libretube.helpers.PreferenceHelper import com.github.libretube.obj.BottomSheetItem import com.github.libretube.ui.base.BaseActivity +import com.github.libretube.ui.extensions.toggleSystemBars import com.github.libretube.ui.interfaces.PlayerGestureOptions import com.github.libretube.ui.interfaces.PlayerOptions import com.github.libretube.ui.listeners.PlayerGestureController @@ -138,6 +140,11 @@ open class CustomExoPlayerView( // change locked status isPlayerLocked = !isPlayerLocked + + activity.toggleSystemBars( + types = WindowInsetsCompat.Type.statusBars(), + showBars = !isPlayerLocked + ) } resizeMode = when (resizeModePref) { diff --git a/app/src/main/java/com/github/libretube/ui/views/OnlinePlayerView.kt b/app/src/main/java/com/github/libretube/ui/views/OnlinePlayerView.kt index f5ce88fa8..d12492baa 100644 --- a/app/src/main/java/com/github/libretube/ui/views/OnlinePlayerView.kt +++ b/app/src/main/java/com/github/libretube/ui/views/OnlinePlayerView.kt @@ -129,7 +129,7 @@ class OnlinePlayerView( // Show status bar only not navigation bar if the player controls are visible and hide it otherwise activity.toggleSystemBars( types = WindowInsetsCompat.Type.statusBars(), - showBars = visibility == View.VISIBLE + showBars = visibility == View.VISIBLE && !isPlayerLocked ) } }