mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +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
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
val pictureInPicture = findPreference<SwitchPreferenceCompat>(
|
val pictureInPicture =
|
||||||
PreferenceKeys.PICTURE_IN_PICTURE
|
findPreference<SwitchPreferenceCompat>(PreferenceKeys.PICTURE_IN_PICTURE)!!
|
||||||
)!!
|
pictureInPicture.isVisible =
|
||||||
|
PictureInPictureCompat.isPictureInPictureAvailable(requireContext())
|
||||||
|
|
||||||
val pauseOnQuit = findPreference<SwitchPreferenceCompat>(PreferenceKeys.PAUSE_ON_QUIT)
|
val pauseOnQuit = findPreference<SwitchPreferenceCompat>(PreferenceKeys.PAUSE_ON_QUIT)
|
||||||
pictureInPicture.isVisible = PictureInPictureCompat
|
val alternativePipControls =
|
||||||
.isPictureInPictureAvailable(requireContext())
|
findPreference<SwitchPreferenceCompat>(PreferenceKeys.ALTERNATIVE_PIP_CONTROLS)
|
||||||
pauseOnQuit?.isVisible = !pictureInPicture.isVisible || !pictureInPicture.isChecked
|
val isPipEnabled = pictureInPicture.isVisible && pictureInPicture.isChecked
|
||||||
|
pauseOnQuit?.isVisible = !isPipEnabled
|
||||||
|
alternativePipControls?.isVisible = isPipEnabled
|
||||||
|
|
||||||
pictureInPicture.setOnPreferenceChangeListener { _, newValue ->
|
pictureInPicture.setOnPreferenceChangeListener { _, newValue ->
|
||||||
pauseOnQuit?.isVisible = !(newValue as Boolean)
|
val isChecked = newValue as Boolean
|
||||||
|
pauseOnQuit?.isVisible = !isChecked
|
||||||
|
alternativePipControls?.isVisible = isChecked
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user