diff --git a/app/src/main/java/com/github/libretube/ui/preferences/PlayerSettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/PlayerSettings.kt index cb5d20a6f..a40168fed 100644 --- a/app/src/main/java/com/github/libretube/ui/preferences/PlayerSettings.kt +++ b/app/src/main/java/com/github/libretube/ui/preferences/PlayerSettings.kt @@ -59,16 +59,22 @@ class PlayerSettings : BasePreferenceFragment() { true } - val pictureInPicture = findPreference( - PreferenceKeys.PICTURE_IN_PICTURE - )!! + val pictureInPicture = + findPreference(PreferenceKeys.PICTURE_IN_PICTURE)!! + pictureInPicture.isVisible = + PictureInPictureCompat.isPictureInPictureAvailable(requireContext()) + val pauseOnQuit = findPreference(PreferenceKeys.PAUSE_ON_QUIT) - pictureInPicture.isVisible = PictureInPictureCompat - .isPictureInPictureAvailable(requireContext()) - pauseOnQuit?.isVisible = !pictureInPicture.isVisible || !pictureInPicture.isChecked + val alternativePipControls = + findPreference(PreferenceKeys.ALTERNATIVE_PIP_CONTROLS) + val isPipEnabled = pictureInPicture.isVisible && pictureInPicture.isChecked + pauseOnQuit?.isVisible = !isPipEnabled + alternativePipControls?.isVisible = isPipEnabled pictureInPicture.setOnPreferenceChangeListener { _, newValue -> - pauseOnQuit?.isVisible = !(newValue as Boolean) + val isChecked = newValue as Boolean + pauseOnQuit?.isVisible = !isChecked + alternativePipControls?.isVisible = isChecked true }