Simplify preferences visiblity by using dependencies

This commit is contained in:
Bnyro 2023-04-27 09:39:45 +02:00
parent e8b2d8d02c
commit 13bd7427a2
9 changed files with 62 additions and 121 deletions

View File

@ -63,10 +63,7 @@ class AppearanceSettings : BasePreferenceFragment() {
val navBarOptions = findPreference<Preference>(PreferenceKeys.NAVBAR_ITEMS) val navBarOptions = findPreference<Preference>(PreferenceKeys.NAVBAR_ITEMS)
navBarOptions?.setOnPreferenceClickListener { navBarOptions?.setOnPreferenceClickListener {
NavBarOptionsDialog().show( NavBarOptionsDialog().show(childFragmentManager, null)
childFragmentManager,
null
)
true true
} }

View File

@ -52,8 +52,6 @@ class InstanceSettings : BasePreferenceFragment() {
true true
} }
// hide auth instance if option deselected
authInstance.isVisible = authInstanceToggle.isChecked
authInstance.setOnPreferenceChangeListener { _, newValue -> authInstance.setOnPreferenceChangeListener { _, newValue ->
// save new auth url // save new auth url
RetrofitInstance.authUrl = newValue.toString() RetrofitInstance.authUrl = newValue.toString()
@ -63,7 +61,6 @@ class InstanceSettings : BasePreferenceFragment() {
} }
authInstanceToggle.setOnPreferenceChangeListener { _, newValue -> authInstanceToggle.setOnPreferenceChangeListener { _, newValue ->
authInstance.isVisible = newValue == true
// either use new auth url or the normal api url if auth instance disabled // either use new auth url or the normal api url if auth instance disabled
RetrofitInstance.authUrl = if (newValue == false) { RetrofitInstance.authUrl = if (newValue == false) {
RetrofitInstance.url RetrofitInstance.url

View File

@ -8,7 +8,6 @@ import com.github.libretube.R
import com.github.libretube.constants.PreferenceKeys import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.helpers.NotificationHelper import com.github.libretube.helpers.NotificationHelper
import com.github.libretube.ui.base.BasePreferenceFragment import com.github.libretube.ui.base.BasePreferenceFragment
import com.github.libretube.ui.views.TimePickerPreference
class NotificationSettings : BasePreferenceFragment() { class NotificationSettings : BasePreferenceFragment() {
override val titleResourceId: Int = R.string.notifications override val titleResourceId: Int = R.string.notifications
@ -21,43 +20,20 @@ class NotificationSettings : BasePreferenceFragment() {
val checkingFrequency = findPreference<ListPreference>(PreferenceKeys.CHECKING_FREQUENCY) val checkingFrequency = findPreference<ListPreference>(PreferenceKeys.CHECKING_FREQUENCY)
val requiredNetwork = findPreference<ListPreference>(PreferenceKeys.REQUIRED_NETWORK) val requiredNetwork = findPreference<ListPreference>(PreferenceKeys.REQUIRED_NETWORK)
notificationsEnabled?.setOnPreferenceChangeListener { _, newValue -> notificationsEnabled?.setOnPreferenceChangeListener { _, _ ->
checkingFrequency?.isEnabled = newValue as Boolean
requiredNetwork?.isEnabled = newValue
updateNotificationPrefs() updateNotificationPrefs()
true true
} }
checkingFrequency?.isEnabled = notificationsEnabled!!.isChecked
checkingFrequency?.setOnPreferenceChangeListener { _, _ -> checkingFrequency?.setOnPreferenceChangeListener { _, _ ->
updateNotificationPrefs() updateNotificationPrefs()
true true
} }
requiredNetwork?.isEnabled = notificationsEnabled.isChecked
requiredNetwork?.setOnPreferenceChangeListener { _, _ -> requiredNetwork?.setOnPreferenceChangeListener { _, _ ->
updateNotificationPrefs() updateNotificationPrefs()
true true
} }
val notificationTime = findPreference<SwitchPreferenceCompat>(
PreferenceKeys.NOTIFICATION_TIME_ENABLED
)
val notificationStartTime = findPreference<TimePickerPreference>(
PreferenceKeys.NOTIFICATION_START_TIME
)
val notificationEndTime = findPreference<TimePickerPreference>(
PreferenceKeys.NOTIFICATION_END_TIME
)
listOf(notificationStartTime, notificationEndTime).forEach {
it?.isEnabled = notificationTime?.isChecked == true
}
notificationTime?.setOnPreferenceChangeListener { _, newValue ->
listOf(notificationStartTime, notificationEndTime).forEach {
it?.isEnabled = newValue as Boolean
}
true
}
} }
private fun updateNotificationPrefs() { private fun updateNotificationPrefs() {

View File

@ -12,9 +12,7 @@ import com.github.libretube.R
import com.github.libretube.compat.PictureInPictureCompat import com.github.libretube.compat.PictureInPictureCompat
import com.github.libretube.constants.PreferenceKeys import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.helpers.LocaleHelper import com.github.libretube.helpers.LocaleHelper
import com.github.libretube.helpers.PreferenceHelper
import com.github.libretube.ui.base.BasePreferenceFragment import com.github.libretube.ui.base.BasePreferenceFragment
import com.github.libretube.ui.views.SliderPreference
class PlayerSettings : BasePreferenceFragment() { class PlayerSettings : BasePreferenceFragment() {
override val titleResourceId: Int = R.string.player override val titleResourceId: Int = R.string.player
@ -22,33 +20,10 @@ class PlayerSettings : BasePreferenceFragment() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.player_settings, rootKey) setPreferencesFromResource(R.xml.player_settings, rootKey)
val playerOrientation =
findPreference<ListPreference>(PreferenceKeys.FULLSCREEN_ORIENTATION)
val autoRotateToFullscreen =
findPreference<SwitchPreferenceCompat>(PreferenceKeys.AUTO_FULLSCREEN)
// only show the player orientation option if auto fullscreen is disabled
playerOrientation?.isEnabled = autoRotateToFullscreen?.isChecked != true
autoRotateToFullscreen?.setOnPreferenceChangeListener { _, newValue ->
playerOrientation?.isEnabled = newValue != true
true
}
val defaultSubtitle = findPreference<ListPreference>(PreferenceKeys.DEFAULT_SUBTITLE) val defaultSubtitle = findPreference<ListPreference>(PreferenceKeys.DEFAULT_SUBTITLE)
defaultSubtitle?.let { setupSubtitlePref(it) } defaultSubtitle?.let { setupSubtitlePref(it) }
val systemCaptionStyle =
findPreference<SwitchPreferenceCompat>(PreferenceKeys.SYSTEM_CAPTION_STYLE)
val captionSettings = findPreference<Preference>(PreferenceKeys.CAPTION_SETTINGS) val captionSettings = findPreference<Preference>(PreferenceKeys.CAPTION_SETTINGS)
captionSettings?.isVisible =
PreferenceHelper.getBoolean(PreferenceKeys.SYSTEM_CAPTION_STYLE, true)
systemCaptionStyle?.setOnPreferenceChangeListener { _, newValue ->
captionSettings?.isVisible = newValue as Boolean
true
}
captionSettings?.setOnPreferenceClickListener { captionSettings?.setOnPreferenceClickListener {
try { try {
val captionSettingsIntent = Intent(Settings.ACTION_CAPTIONING_SETTINGS) val captionSettingsIntent = Intent(Settings.ACTION_CAPTIONING_SETTINGS)
@ -70,26 +45,6 @@ class PlayerSettings : BasePreferenceFragment() {
val isPipEnabled = pictureInPicture.isVisible && pictureInPicture.isChecked val isPipEnabled = pictureInPicture.isVisible && pictureInPicture.isChecked
pauseOnQuit?.isVisible = !isPipEnabled pauseOnQuit?.isVisible = !isPipEnabled
alternativePipControls?.isVisible = isPipEnabled alternativePipControls?.isVisible = isPipEnabled
pictureInPicture.setOnPreferenceChangeListener { _, newValue ->
val isChecked = newValue as Boolean
pauseOnQuit?.isVisible = !isChecked
alternativePipControls?.isVisible = isChecked
true
}
val customBackgroundSpeed = findPreference<SwitchPreferenceCompat>(
PreferenceKeys.CUSTOM_PLAYBACK_SPEED
)
val backgroundSpeed = findPreference<SliderPreference>(
PreferenceKeys.BACKGROUND_PLAYBACK_SPEED
)
backgroundSpeed?.isEnabled = customBackgroundSpeed?.isChecked == true
customBackgroundSpeed?.setOnPreferenceChangeListener { _, newValue ->
backgroundSpeed?.isEnabled = newValue as Boolean
true
}
} }
private fun setupSubtitlePref(preference: ListPreference) { private fun setupSubtitlePref(preference: ListPreference) {

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory app:title="@string/search_history"> <PreferenceCategory app:title="@string/search_history">
@ -9,19 +9,19 @@
android:icon="@drawable/ic_history_filled" android:icon="@drawable/ic_history_filled"
android:summary="@string/search_history_summary" android:summary="@string/search_history_summary"
app:key="search_history_toggle" app:key="search_history_toggle"
app:title="@string/search_history" /> app:title="@string/search_history"/>
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:dependency="search_history_toggle" android:dependency="search_history_toggle"
android:defaultValue="false" android:defaultValue="false"
android:icon="@drawable/ic_search" android:icon="@drawable/ic_search"
app:key="unlimited_search_history" app:key="unlimited_search_history"
app:title="@string/unlimited_search_history" /> app:title="@string/unlimited_search_history"/>
<Preference <Preference
android:icon="@drawable/ic_trash" android:icon="@drawable/ic_trash"
app:key="clear_search_history" app:key="clear_search_history"
app:title="@string/clear_history" /> app:title="@string/clear_history"/>
</PreferenceCategory> </PreferenceCategory>
@ -32,7 +32,7 @@
android:icon="@drawable/ic_time_outlined" android:icon="@drawable/ic_time_outlined"
android:summary="@string/watch_history_summary" android:summary="@string/watch_history_summary"
app:key="watch_history_toggle" app:key="watch_history_toggle"
app:title="@string/watch_history" /> app:title="@string/watch_history"/>
<ListPreference <ListPreference
android:defaultValue="100" android:defaultValue="100"
@ -40,13 +40,14 @@
android:entryValues="@array/historySizeValues" android:entryValues="@array/historySizeValues"
android:icon="@drawable/ic_list" android:icon="@drawable/ic_list"
app:key="watch_history_size" app:key="watch_history_size"
android:dependency="watch_history_toggle"
app:title="@string/history_size" app:title="@string/history_size"
app:useSimpleSummaryProvider="true" /> app:useSimpleSummaryProvider="true"/>
<Preference <Preference
android:icon="@drawable/ic_trash" android:icon="@drawable/ic_trash"
app:key="clear_watch_history" app:key="clear_watch_history"
app:title="@string/clear_history" /> app:title="@string/clear_history"/>
</PreferenceCategory> </PreferenceCategory>
@ -59,12 +60,12 @@
android:icon="@drawable/ic_play_filled" android:icon="@drawable/ic_play_filled"
app:key="watch_positions" app:key="watch_positions"
app:summary="@string/watch_positions_summary" app:summary="@string/watch_positions_summary"
app:title="@string/watch_positions" /> app:title="@string/watch_positions"/>
<Preference <Preference
android:icon="@drawable/ic_reset" android:icon="@drawable/ic_reset"
app:key="clear_watch_positions" app:key="clear_watch_positions"
app:title="@string/reset_watch_positions" /> app:title="@string/reset_watch_positions"/>
</PreferenceCategory> </PreferenceCategory>
@ -73,7 +74,7 @@
<Preference <Preference
android:title="@string/clear_bookmarks" android:title="@string/clear_bookmarks"
app:icon="@drawable/ic_bookmark" app:icon="@drawable/ic_bookmark"
app:key="clear_bookmarks" /> app:key="clear_bookmarks"/>
</PreferenceCategory> </PreferenceCategory>

View File

@ -32,6 +32,7 @@
<ListPreference <ListPreference
android:icon="@drawable/ic_server" android:icon="@drawable/ic_server"
android:dependency="auth_instance_toggle"
app:defaultValue="https://pipedapi.kavin.rocks" app:defaultValue="https://pipedapi.kavin.rocks"
app:entries="@array/instances" app:entries="@array/instances"
app:entryValues="@array/instancesValue" app:entryValues="@array/instancesValue"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory app:title="@string/notifications"> <PreferenceCategory app:title="@string/notifications">
@ -9,14 +9,15 @@
android:summary="@string/notify_new_streams_summary" android:summary="@string/notify_new_streams_summary"
app:defaultValue="true" app:defaultValue="true"
app:key="notification_toggle" app:key="notification_toggle"
app:title="@string/notify_new_streams" /> app:title="@string/notify_new_streams"/>
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:icon="@drawable/ic_image" android:icon="@drawable/ic_image"
app:defaultValue="false" app:defaultValue="false"
app:key="show_stream_thumbnails" app:key="show_stream_thumbnails"
android:dependency="notification_toggle"
app:title="@string/show_stream_thumbnails" app:title="@string/show_stream_thumbnails"
app:summary="@string/show_stream_thumbnails_summary" /> app:summary="@string/show_stream_thumbnails_summary"/>
<ListPreference <ListPreference
android:icon="@drawable/ic_time" android:icon="@drawable/ic_time"
@ -24,17 +25,19 @@
app:entries="@array/checkingFrequency" app:entries="@array/checkingFrequency"
app:entryValues="@array/checkingFrequencyValues" app:entryValues="@array/checkingFrequencyValues"
app:key="checking_frequency" app:key="checking_frequency"
android:dependency="notification_toggle"
app:title="@string/checking_frequency" app:title="@string/checking_frequency"
app:useSimpleSummaryProvider="true" /> app:useSimpleSummaryProvider="true"/>
<ListPreference <ListPreference
android:icon="@drawable/ic_signal" android:icon="@drawable/ic_signal"
app:defaultValue="all" app:defaultValue="all"
android:dependency="notification_toggle"
app:entries="@array/requiredNetwork" app:entries="@array/requiredNetwork"
app:entryValues="@array/requiredNetworkValues" app:entryValues="@array/requiredNetworkValues"
app:key="required_network" app:key="required_network"
app:title="@string/required_network" app:title="@string/required_network"
app:useSimpleSummaryProvider="true" /> app:useSimpleSummaryProvider="true"/>
</PreferenceCategory> </PreferenceCategory>
@ -43,15 +46,17 @@
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:summary="@string/notification_time_summary" android:summary="@string/notification_time_summary"
app:key="notification_time" app:key="notification_time"
app:title="@string/notification_time" /> app:title="@string/notification_time"/>
<com.github.libretube.ui.views.TimePickerPreference <com.github.libretube.ui.views.TimePickerPreference
app:key="notification_start_time" app:key="notification_start_time"
app:title="@string/start_time" /> android:dependency="notification_time"
app:title="@string/start_time"/>
<com.github.libretube.ui.views.TimePickerPreference <com.github.libretube.ui.views.TimePickerPreference
app:key="notification_end_time" app:key="notification_end_time"
app:title="@string/end_time" /> android:dependency="notification_time"
app:title="@string/end_time"/>
</PreferenceCategory> </PreferenceCategory>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory app:title="@string/behavior"> <PreferenceCategory app:title="@string/behavior">
@ -9,60 +9,63 @@
android:icon="@drawable/ic_swipe_gesture" android:icon="@drawable/ic_swipe_gesture"
android:summary="@string/swipe_controls_summary" android:summary="@string/swipe_controls_summary"
app:key="player_swipe_controls" app:key="player_swipe_controls"
app:title="@string/swipe_controls" /> app:title="@string/swipe_controls"/>
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:defaultValue="false" android:defaultValue="false"
android:icon="@drawable/ic_fullscreen" android:icon="@drawable/ic_fullscreen"
app:key="fullscreen_gestures" app:key="fullscreen_gestures"
app:title="@string/fullscreen_gestures" /> app:title="@string/fullscreen_gestures"/>
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:defaultValue="true" android:defaultValue="true"
android:icon="@drawable/ic_pinch_gesture" android:icon="@drawable/ic_pinch_gesture"
android:summary="@string/pinch_control_summary" android:summary="@string/pinch_control_summary"
app:key="player_pinch_control" app:key="player_pinch_control"
app:title="@string/pinch_control" /> app:title="@string/pinch_control"/>
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:defaultValue="false" android:defaultValue="false"
android:icon="@drawable/ic_next" android:icon="@drawable/ic_next"
android:summary="@string/skip_buttons_summary" android:summary="@string/skip_buttons_summary"
app:key="skip_buttons" app:key="skip_buttons"
app:title="@string/skip_buttons" /> app:title="@string/skip_buttons"/>
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:defaultValue="true" android:defaultValue="true"
android:icon="@drawable/ic_skip" android:icon="@drawable/ic_skip"
android:summary="@string/double_tap_seek_summary" android:summary="@string/double_tap_seek_summary"
app:key="double_tap_seek" app:key="double_tap_seek"
app:title="@string/double_tap_seek" /> app:title="@string/double_tap_seek"/>
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:defaultValue="true" android:defaultValue="true"
android:icon="@drawable/ic_window" android:icon="@drawable/ic_window"
app:key="picture_in_picture" app:key="picture_in_picture"
app:title="@string/picture_in_picture" /> app:title="@string/picture_in_picture"/>
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:defaultValue="false" android:defaultValue="false"
android:icon="@drawable/ic_headphones" android:icon="@drawable/ic_headphones"
android:summary="@string/alternative_pip_controls_summary" android:summary="@string/alternative_pip_controls_summary"
android:dependency="picture_in_picture"
app:key="alternative_pip_controls" app:key="alternative_pip_controls"
app:title="@string/alternative_pip_controls" /> app:title="@string/alternative_pip_controls"/>
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:defaultValue="false" android:defaultValue="false"
android:icon="@drawable/ic_pause_filled" android:icon="@drawable/ic_pause_filled"
app:key="pause_on_quit" app:key="pause_on_quit"
app:title="@string/pause_on_quit" /> android:dependency="picture_in_picture"
app:title="@string/pause_on_quit"/>
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:icon="@drawable/ic_rotating_circle" android:icon="@drawable/ic_rotating_circle"
android:summary="@string/autoRotatePlayer_summary" android:summary="@string/autoRotatePlayer_summary"
app:defaultValue="false" app:defaultValue="false"
app:key="auto_fullscreen" app:key="auto_fullscreen"
app:title="@string/autoRotatePlayer" /> android:disableDependentsState="true"
app:title="@string/autoRotatePlayer"/>
<ListPreference <ListPreference
android:icon="@drawable/ic_flip" android:icon="@drawable/ic_flip"
@ -70,8 +73,9 @@
app:entries="@array/fullscreenOrientation" app:entries="@array/fullscreenOrientation"
app:entryValues="@array/fullscreenOrientationValues" app:entryValues="@array/fullscreenOrientationValues"
app:key="fullscreen_orientation" app:key="fullscreen_orientation"
android:dependency="auto_fullscreen"
app:title="@string/fullscreen_orientation" app:title="@string/fullscreen_orientation"
app:useSimpleSummaryProvider="true" /> app:useSimpleSummaryProvider="true"/>
</PreferenceCategory> </PreferenceCategory>
@ -84,7 +88,7 @@
app:stepSize="5.0" app:stepSize="5.0"
app:title="@string/seek_increment" app:title="@string/seek_increment"
app:valueFrom="5.0" app:valueFrom="5.0"
app:valueTo="60.0" /> app:valueTo="60.0"/>
<ListPreference <ListPreference
android:icon="@drawable/ic_time" android:icon="@drawable/ic_time"
@ -93,7 +97,7 @@
app:entryValues="@array/bufferingGoalValues" app:entryValues="@array/bufferingGoalValues"
app:key="buffering_goal" app:key="buffering_goal"
app:summary="@string/buffering_goal_summary" app:summary="@string/buffering_goal_summary"
app:title="@string/buffering_goal" /> app:title="@string/buffering_goal"/>
<com.github.libretube.ui.views.SliderPreference <com.github.libretube.ui.views.SliderPreference
android:icon="@drawable/ic_text" android:icon="@drawable/ic_text"
@ -102,7 +106,7 @@
app:defValue="18" app:defValue="18"
app:stepSize="1" app:stepSize="1"
app:valueFrom="8" app:valueFrom="8"
app:valueTo="30" /> app:valueTo="30"/>
</PreferenceCategory> </PreferenceCategory>
@ -112,12 +116,13 @@
android:icon="@drawable/ic_caption" android:icon="@drawable/ic_caption"
app:defaultValue="true" app:defaultValue="true"
app:key="system_caption_style" app:key="system_caption_style"
app:title="@string/system_caption_style" /> app:title="@string/system_caption_style"/>
<Preference <Preference
android:icon="@drawable/ic_settings" android:icon="@drawable/ic_settings"
app:key="caption_settings" app:key="caption_settings"
app:title="@string/caption_settings" /> android:dependency="system_caption_style"
app:title="@string/caption_settings"/>
</PreferenceCategory> </PreferenceCategory>
@ -127,7 +132,7 @@
android:defaultValue="true" android:defaultValue="true"
android:icon="@drawable/ic_list" android:icon="@drawable/ic_list"
android:title="@string/queue_insert_related_videos" android:title="@string/queue_insert_related_videos"
app:key="queue_insert_related_videos" /> app:key="queue_insert_related_videos"/>
</PreferenceCategory> </PreferenceCategory>
@ -141,13 +146,13 @@
app:stepSize="0.1" app:stepSize="0.1"
app:title="@string/playback_speed" app:title="@string/playback_speed"
app:valueFrom="0.2" app:valueFrom="0.2"
app:valueTo="4.0" /> app:valueTo="4.0"/>
<ListPreference <ListPreference
android:defaultValue="" android:defaultValue=""
android:icon="@drawable/ic_caption" android:icon="@drawable/ic_caption"
app:key="default_subtitle" app:key="default_subtitle"
app:title="@string/default_subtitle_language" /> app:title="@string/default_subtitle_language"/>
<ListPreference <ListPreference
android:defaultValue="fit" android:defaultValue="fit"
@ -156,27 +161,27 @@
android:icon="@drawable/ic_zoom" android:icon="@drawable/ic_zoom"
app:key="player_resize_mode" app:key="player_resize_mode"
app:title="@string/player_resize_mode" app:title="@string/player_resize_mode"
app:useSimpleSummaryProvider="true" /> app:useSimpleSummaryProvider="true"/>
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:icon="@drawable/ic_play_filled" android:icon="@drawable/ic_play_filled"
android:summary="@string/autoplay_summary" android:summary="@string/autoplay_summary"
app:defaultValue="true" app:defaultValue="true"
app:key="autoplay" app:key="autoplay"
app:title="@string/player_autoplay" /> app:title="@string/player_autoplay"/>
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:icon="@drawable/ic_speed" android:icon="@drawable/ic_speed"
android:summary="@string/autoplay_countdown_summary" android:summary="@string/autoplay_countdown_summary"
app:defaultValue="false" app:defaultValue="false"
app:key="autoplay_countdown" app:key="autoplay_countdown"
app:title="@string/autoplay_countdown" /> app:title="@string/autoplay_countdown"/>
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:defaultValue="false" android:defaultValue="false"
android:icon="@drawable/ic_fullscreen" android:icon="@drawable/ic_fullscreen"
android:title="@string/auto_fullscreen_shorts" android:title="@string/auto_fullscreen_shorts"
app:key="auto_fullscreen_shorts" /> app:key="auto_fullscreen_shorts"/>
</PreferenceCategory> </PreferenceCategory>
@ -187,7 +192,7 @@
android:summary="@string/custom_playback_speed_summary" android:summary="@string/custom_playback_speed_summary"
app:defaultValue="false" app:defaultValue="false"
app:key="custom_playback_speed" app:key="custom_playback_speed"
app:title="@string/custom_playback_speed" /> app:title="@string/custom_playback_speed"/>
<com.github.libretube.ui.views.SliderPreference <com.github.libretube.ui.views.SliderPreference
android:icon="@drawable/ic_speed" android:icon="@drawable/ic_speed"
@ -195,8 +200,9 @@
app:key="background_playback_speed" app:key="background_playback_speed"
app:stepSize="0.1" app:stepSize="0.1"
app:title="@string/playback_speed" app:title="@string/playback_speed"
android:dependency="custom_playback_speed"
app:valueFrom="0.2" app:valueFrom="0.2"
app:valueTo="4.0" /> app:valueTo="4.0"/>
</PreferenceCategory> </PreferenceCategory>
@ -207,7 +213,7 @@
android:summary="@string/pauseOnScreenOff_summary" android:summary="@string/pauseOnScreenOff_summary"
app:defaultValue="false" app:defaultValue="false"
app:key="pause_screen_off" app:key="pause_screen_off"
app:title="@string/pauseOnScreenOff" /> app:title="@string/pauseOnScreenOff"/>
</PreferenceCategory> </PreferenceCategory>

View File

@ -12,6 +12,7 @@
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:summaryOff="@string/disabled" android:summaryOff="@string/disabled"
android:summaryOn="@string/enabled" android:summaryOn="@string/enabled"
android:dependency="sb_enabled_key"
app:defaultValue="true" app:defaultValue="true"
app:key="sb_notifications_key" app:key="sb_notifications_key"
app:title="@string/sponsorblock_notifications" /> app:title="@string/sponsorblock_notifications" />
@ -19,12 +20,14 @@
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:summary="@string/sb_markers_summary" android:summary="@string/sb_markers_summary"
app:defaultValue="true" app:defaultValue="true"
android:dependency="sb_enabled_key"
app:key="sb_show_markers" app:key="sb_show_markers"
app:title="@string/sb_markers" /> app:title="@string/sb_markers" />
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:summary="@string/sb_skip_manual_summary" android:summary="@string/sb_skip_manual_summary"
app:defaultValue="false" app:defaultValue="false"
android:dependency="sb_enabled_key"
app:key="sb_skip_manually_key" app:key="sb_skip_manually_key"
app:title="@string/sb_skip_manual" /> app:title="@string/sb_skip_manual" />