mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +05:30
Hide alternative PiP controls setting if PiP is not enabled.
This commit is contained in:
parent
fe9a48e1d3
commit
e66c0b6674
@ -59,16 +59,22 @@ class PlayerSettings : BasePreferenceFragment() {
|
||||
true
|
||||
}
|
||||
|
||||
val pictureInPicture = findPreference<SwitchPreferenceCompat>(
|
||||
PreferenceKeys.PICTURE_IN_PICTURE
|
||||
)!!
|
||||
val pictureInPicture =
|
||||
findPreference<SwitchPreferenceCompat>(PreferenceKeys.PICTURE_IN_PICTURE)!!
|
||||
pictureInPicture.isVisible =
|
||||
PictureInPictureCompat.isPictureInPictureAvailable(requireContext())
|
||||
|
||||
val pauseOnQuit = findPreference<SwitchPreferenceCompat>(PreferenceKeys.PAUSE_ON_QUIT)
|
||||
pictureInPicture.isVisible = PictureInPictureCompat
|
||||
.isPictureInPictureAvailable(requireContext())
|
||||
pauseOnQuit?.isVisible = !pictureInPicture.isVisible || !pictureInPicture.isChecked
|
||||
val alternativePipControls =
|
||||
findPreference<SwitchPreferenceCompat>(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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user