From 2e582653fddccaacce545edb2eb7f9750b281fb7 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 14 Apr 2024 13:15:33 +0200 Subject: [PATCH] fix: don't show autoplay countdown controls in PiP mode --- .../github/libretube/ui/views/AutoplayCountdownView.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/java/com/github/libretube/ui/views/AutoplayCountdownView.kt b/app/src/main/java/com/github/libretube/ui/views/AutoplayCountdownView.kt index 2b785d1d2..5516c2a30 100644 --- a/app/src/main/java/com/github/libretube/ui/views/AutoplayCountdownView.kt +++ b/app/src/main/java/com/github/libretube/ui/views/AutoplayCountdownView.kt @@ -11,7 +11,9 @@ import androidx.core.view.isVisible import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.get import com.github.libretube.R +import com.github.libretube.compat.PictureInPictureCompat import com.github.libretube.databinding.AutoplayCountdownBinding +import com.github.libretube.helpers.ContextHelper import com.github.libretube.ui.activities.MainActivity import com.github.libretube.ui.models.PlayerViewModel @@ -60,6 +62,12 @@ class AutoplayCountdownView( return } + // don't show cancel and play next buttons in PiP mode + val context = ContextHelper.unwrapActivity(context) + val isInPipMode = PictureInPictureCompat.isInPictureInPictureMode(context) + binding.cancel.isVisible = !isInPipMode + binding.playNext.isVisible = !isInPipMode + // only show countdown when mini player not visible this.isVisible = playerViewModel.isMiniPlayerVisible.value == false binding.currentState.text = context.getString(