Merge pull request #5905 from Bnyro/master

fix: don't show autoplay countdown controls in PiP mode
This commit is contained in:
Bnyro 2024-04-14 13:16:02 +02:00 committed by GitHub
commit d2976cbbdc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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(