From c6489b9cbda41e668b377a437b3a92ddaf55f7b0 Mon Sep 17 00:00:00 2001 From: Secozzi Date: Sun, 29 Dec 2024 23:14:52 +0100 Subject: [PATCH 1/3] Move slider preferences to gestures --- .../player/PlayerSettingsGesturesScreen.kt | 21 +++++++++++++++++++ .../player/PlayerSettingsPlayerScreen.kt | 10 --------- .../ui/player/controls/GestureHandler.kt | 4 ++-- .../ui/player/controls/PlayerControls.kt | 2 +- .../ui/player/settings/GesturePreferences.kt | 7 +++++++ .../ui/player/settings/PlayerPreferences.kt | 5 ----- .../moko-resources/base/strings.xml | 6 ++++-- 7 files changed, 35 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/player/PlayerSettingsGesturesScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/player/PlayerSettingsGesturesScreen.kt index 0778f3970e..e257e2b2bc 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/player/PlayerSettingsGesturesScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/player/PlayerSettingsGesturesScreen.kt @@ -42,12 +42,33 @@ object PlayerSettingsGesturesScreen : SearchableSettings { val gesturePreferences = remember { Injekt.get() } return listOf( + getSlidersGroup(gesturePreferences = gesturePreferences), getSeekingGroup(gesturePreferences = gesturePreferences), getDoubleTapGroup(gesturePreferences = gesturePreferences), getMediaControlsGroup(gesturePreferences = gesturePreferences), ) } + @Composable + private fun getSlidersGroup(gesturePreferences: GesturePreferences): Preference.PreferenceGroup { + val enableVolumeBrightnessGestures = gesturePreferences.gestureVolumeBrightness() + val swapVol = gesturePreferences.swapVolumeBrightness() + + return Preference.PreferenceGroup( + title = stringResource(MR.strings.pref_category_player_sliders), + preferenceItems = persistentListOf( + Preference.PreferenceItem.SwitchPreference( + pref = enableVolumeBrightnessGestures, + title = stringResource(MR.strings.enable_volume_brightness_gestures), + ), + Preference.PreferenceItem.SwitchPreference( + pref = swapVol, + title = stringResource(MR.strings.pref_controls_swap_vol_brightness), + ), + ), + ) + } + @Composable private fun getSeekingGroup(gesturePreferences: GesturePreferences): Preference.PreferenceGroup { val scope = rememberCoroutineScope() diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/player/PlayerSettingsPlayerScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/player/PlayerSettingsPlayerScreen.kt index 8a438faf7c..76f8450223 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/player/PlayerSettingsPlayerScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/player/PlayerSettingsPlayerScreen.kt @@ -83,10 +83,8 @@ object PlayerSettingsPlayerScreen : SearchableSettings { private fun getControlsGroup(playerPreferences: PlayerPreferences): Preference.PreferenceGroup { val allowGestures = playerPreferences.allowGestures() val displayVol = playerPreferences.displayVolPer() - val swapVol = playerPreferences.swapVolumeBrightness() val showLoading = playerPreferences.showLoadingCircle() val showChapter = playerPreferences.showCurrentChapter() - val enableVolumeBrightnessGestures = playerPreferences.gestureVolumeBrightness() val rememberPlayerBrightness = playerPreferences.rememberPlayerBrightness() val rememberPlayerVolume = playerPreferences.rememberPlayerVolume() @@ -106,18 +104,10 @@ object PlayerSettingsPlayerScreen : SearchableSettings { title = stringResource(MR.strings.pref_controls_show_chapter_indicator), subtitle = stringResource(MR.strings.pref_controls_show_chapter_indicator_info), ), - Preference.PreferenceItem.SwitchPreference( - pref = enableVolumeBrightnessGestures, - title = stringResource(MR.strings.enable_volume_brightness_gestures), - ), Preference.PreferenceItem.SwitchPreference( pref = displayVol, title = stringResource(MR.strings.pref_controls_display_volume_percentage), ), - Preference.PreferenceItem.SwitchPreference( - pref = swapVol, - title = stringResource(MR.strings.pref_controls_swap_vol_brightness), - ), Preference.PreferenceItem.SwitchPreference( pref = rememberPlayerBrightness, title = stringResource(MR.strings.pref_remember_brightness), diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/player/controls/GestureHandler.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/player/controls/GestureHandler.kt index ad0aa2d9dd..8a13427a21 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/player/controls/GestureHandler.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/player/controls/GestureHandler.kt @@ -102,8 +102,8 @@ fun GestureHandler( viewModel.hideSeekBar() } - val gestureVolumeBrightness = playerPreferences.gestureVolumeBrightness().get() - val swapVolumeBrightness by playerPreferences.swapVolumeBrightness().collectAsState() + val gestureVolumeBrightness = gesturePreferences.gestureVolumeBrightness().get() + val swapVolumeBrightness by gesturePreferences.swapVolumeBrightness().collectAsState() val seekGesture by gesturePreferences.gestureHorizontalSeek().collectAsState() val preciseSeeking by gesturePreferences.playerSmoothSeek().collectAsState() val showSeekbar by gesturePreferences.showSeekBar().collectAsState() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/player/controls/PlayerControls.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/player/controls/PlayerControls.kt index d7f58c70d1..2f151fa86e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/player/controls/PlayerControls.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/player/controls/PlayerControls.kt @@ -216,7 +216,7 @@ fun PlayerControls( val brightness by viewModel.currentBrightness.collectAsState() val volume by viewModel.currentVolume.collectAsState() val mpvVolume by viewModel.currentMPVVolume.collectAsState() - val swapVolumeAndBrightness by playerPreferences.swapVolumeBrightness().collectAsState() + val swapVolumeAndBrightness by gesturePreferences.swapVolumeBrightness().collectAsState() val reduceMotion by playerPreferences.reduceMotion().collectAsState() LaunchedEffect(volume, mpvVolume, isVolumeSliderShown) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/GesturePreferences.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/GesturePreferences.kt index b3ffaaf0fc..f97b1d55cb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/GesturePreferences.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/GesturePreferences.kt @@ -7,6 +7,13 @@ import tachiyomi.core.common.preference.getEnum class GesturePreferences( private val preferenceStore: PreferenceStore, ) { + // Sliders + fun gestureVolumeBrightness() = preferenceStore.getBoolean( + "pref_gesture_volume_brightness", + true, + ) + fun swapVolumeBrightness() = preferenceStore.getBoolean("pref_swap_volume_and_brightness", false) + // Seeking fun gestureHorizontalSeek() = preferenceStore.getBoolean("pref_gesture_horizontal_seek", true) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/PlayerPreferences.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/PlayerPreferences.kt index dbd90eb2eb..5819c0e6e0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/PlayerPreferences.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/PlayerPreferences.kt @@ -22,13 +22,8 @@ class PlayerPreferences( fun allowGestures() = preferenceStore.getBoolean("pref_allow_gestures_in_panels", false) fun displayVolPer() = preferenceStore.getBoolean("pref_display_vol_as_per", true) - fun swapVolumeBrightness() = preferenceStore.getBoolean("pref_swap_volume_and_brightness", false) fun showLoadingCircle() = preferenceStore.getBoolean("pref_show_loading", true) fun showCurrentChapter() = preferenceStore.getBoolean("pref_show_current_chapter", true) - fun gestureVolumeBrightness() = preferenceStore.getBoolean( - "pref_gesture_volume_brightness", - true, - ) fun rememberPlayerBrightness() = preferenceStore.getBoolean("pref_remember_brightness", false) fun playerBrightnessValue() = preferenceStore.getFloat("player_brightness_value", -1.0F) fun rememberPlayerVolume() = preferenceStore.getBoolean("pref_remember_volume", false) diff --git a/i18n/src/commonMain/moko-resources/base/strings.xml b/i18n/src/commonMain/moko-resources/base/strings.xml index 74683a7530..77993bc8f7 100644 --- a/i18n/src/commonMain/moko-resources/base/strings.xml +++ b/i18n/src/commonMain/moko-resources/base/strings.xml @@ -206,9 +206,7 @@ Show loading circle Show current chapter indicator Only appears if the video has chapters - Enable Volume and Brightness Gestures Display volume as percentage - Swap volume and brightness slider Remember and switch to the last used brightness Remember and switch to the last used volume @@ -234,6 +232,10 @@ Gestures Seeking, double tap, media controls + Sliders + Enable Volume and Brightness Gestures + Swap volume and brightness slider + Seeking Enable Horizontal Seek Gesture Show seekbar when seeking From 40783019ee7a21ae7050500488e8865d23a34a98 Mon Sep 17 00:00:00 2001 From: Secozzi Date: Sun, 29 Dec 2024 23:19:21 +0100 Subject: [PATCH 2/3] Move display volume as percentage --- .../screen/player/PlayerSettingsPlayerScreen.kt | 10 +++++----- .../tachiyomi/ui/player/settings/PlayerPreferences.kt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/player/PlayerSettingsPlayerScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/player/PlayerSettingsPlayerScreen.kt index 76f8450223..045eab3e7c 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/player/PlayerSettingsPlayerScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/player/PlayerSettingsPlayerScreen.kt @@ -82,7 +82,6 @@ object PlayerSettingsPlayerScreen : SearchableSettings { @Composable private fun getControlsGroup(playerPreferences: PlayerPreferences): Preference.PreferenceGroup { val allowGestures = playerPreferences.allowGestures() - val displayVol = playerPreferences.displayVolPer() val showLoading = playerPreferences.showLoadingCircle() val showChapter = playerPreferences.showCurrentChapter() val rememberPlayerBrightness = playerPreferences.rememberPlayerBrightness() @@ -104,10 +103,6 @@ object PlayerSettingsPlayerScreen : SearchableSettings { title = stringResource(MR.strings.pref_controls_show_chapter_indicator), subtitle = stringResource(MR.strings.pref_controls_show_chapter_indicator_info), ), - Preference.PreferenceItem.SwitchPreference( - pref = displayVol, - title = stringResource(MR.strings.pref_controls_display_volume_percentage), - ), Preference.PreferenceItem.SwitchPreference( pref = rememberPlayerBrightness, title = stringResource(MR.strings.pref_remember_brightness), @@ -124,6 +119,7 @@ object PlayerSettingsPlayerScreen : SearchableSettings { private fun getDisplayGroup(playerPreferences: PlayerPreferences): Preference.PreferenceGroup { val fullScreen = playerPreferences.playerFullscreen() val hideControls = playerPreferences.hideControls() + val displayVol = playerPreferences.displayVolPer() val showSystemBar = playerPreferences.showSystemStatusBar() val reduceMotion = playerPreferences.reduceMotion() val hideTime = playerPreferences.playerTimeToDisappear() @@ -144,6 +140,10 @@ object PlayerSettingsPlayerScreen : SearchableSettings { pref = hideControls, title = stringResource(MR.strings.pref_player_hide_controls), ), + Preference.PreferenceItem.SwitchPreference( + pref = displayVol, + title = stringResource(MR.strings.pref_controls_display_volume_percentage), + ), Preference.PreferenceItem.SwitchPreference( pref = showSystemBar, title = stringResource(MR.strings.pref_show_system_bar), diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/PlayerPreferences.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/PlayerPreferences.kt index 5819c0e6e0..0a22ccc670 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/PlayerPreferences.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/PlayerPreferences.kt @@ -21,7 +21,6 @@ class PlayerPreferences( // Controls fun allowGestures() = preferenceStore.getBoolean("pref_allow_gestures_in_panels", false) - fun displayVolPer() = preferenceStore.getBoolean("pref_display_vol_as_per", true) fun showLoadingCircle() = preferenceStore.getBoolean("pref_show_loading", true) fun showCurrentChapter() = preferenceStore.getBoolean("pref_show_current_chapter", true) fun rememberPlayerBrightness() = preferenceStore.getBoolean("pref_remember_brightness", false) @@ -33,6 +32,7 @@ class PlayerPreferences( fun playerFullscreen() = preferenceStore.getBoolean("player_fullscreen", true) fun hideControls() = preferenceStore.getBoolean("player_hide_controls", false) + fun displayVolPer() = preferenceStore.getBoolean("pref_display_vol_as_per", true) fun showSystemStatusBar() = preferenceStore.getBoolean("pref_show_system_status_bar", false) fun reduceMotion() = preferenceStore.getBoolean("pref_reduce_motion", false) fun playerTimeToDisappear() = preferenceStore.getInt("pref_player_time_to_disappear", 4000) From bdb77f9c71d1b4442395a3e5d02e9da327368dd1 Mon Sep 17 00:00:00 2001 From: Secozzi Date: Mon, 30 Dec 2024 16:48:19 +0100 Subject: [PATCH 3/3] Remove "remember ... delay" settings --- .../more/settings/screen/player/PlayerSettingsAudioScreen.kt | 5 ----- .../settings/screen/player/PlayerSettingsSubtitleScreen.kt | 5 ----- .../kanade/tachiyomi/ui/player/settings/AudioPreferences.kt | 1 - .../tachiyomi/ui/player/settings/SubtitlePreferences.kt | 5 ----- i18n/src/commonMain/moko-resources/base/strings.xml | 2 -- 5 files changed, 18 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/player/PlayerSettingsAudioScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/player/PlayerSettingsAudioScreen.kt index 6d1810ab55..6f8663c4c0 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/player/PlayerSettingsAudioScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/player/PlayerSettingsAudioScreen.kt @@ -25,7 +25,6 @@ object PlayerSettingsAudioScreen : SearchableSettings { override fun getPreferences(): List { val audioPreferences = remember { Injekt.get() } - val rememberDelay = audioPreferences.rememberAudioDelay() val prefLangs = audioPreferences.preferredAudioLanguages() val pitchCorrection = audioPreferences.enablePitchCorrection() val audioChannels = audioPreferences.audioChannels() @@ -33,10 +32,6 @@ object PlayerSettingsAudioScreen : SearchableSettings { val boostCap by boostCapPref.collectAsState() return listOf( - Preference.PreferenceItem.SwitchPreference( - pref = rememberDelay, - title = stringResource(MR.strings.player_audio_remember_delay), - ), Preference.PreferenceItem.EditTextInfoPreference( pref = prefLangs, title = stringResource(MR.strings.pref_player_audio_lang), diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/player/PlayerSettingsSubtitleScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/player/PlayerSettingsSubtitleScreen.kt index 3469353837..b3eba85b67 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/player/PlayerSettingsSubtitleScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/player/PlayerSettingsSubtitleScreen.kt @@ -21,16 +21,11 @@ object PlayerSettingsSubtitleScreen : SearchableSettings { override fun getPreferences(): List { val subtitlePreferences = remember { Injekt.get() } - val rememberDelay = subtitlePreferences.rememberSubtitlesDelay() val langPref = subtitlePreferences.preferredSubLanguages() val whitelist = subtitlePreferences.subtitleWhitelist() val blacklist = subtitlePreferences.subtitleBlacklist() return listOf( - Preference.PreferenceItem.SwitchPreference( - pref = rememberDelay, - title = stringResource(MR.strings.player_subtitle_remember_delay), - ), Preference.PreferenceItem.EditTextInfoPreference( pref = langPref, title = stringResource(MR.strings.pref_player_subtitle_lang), diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/AudioPreferences.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/AudioPreferences.kt index 00e77057f9..857d8c5805 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/AudioPreferences.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/AudioPreferences.kt @@ -8,7 +8,6 @@ import tachiyomi.i18n.MR class AudioPreferences( private val preferenceStore: PreferenceStore, ) { - fun rememberAudioDelay() = preferenceStore.getBoolean("pref_remember_audio_delay", false) fun preferredAudioLanguages() = preferenceStore.getString("pref_audio_lang", "") fun enablePitchCorrection() = preferenceStore.getBoolean("pref_audio_pitch_correction", true) fun audioChannels() = preferenceStore.getEnum("pref_audio_config", AudioChannels.AutoSafe) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/SubtitlePreferences.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/SubtitlePreferences.kt index 5a855ee3a3..af9e7a51b6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/SubtitlePreferences.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/SubtitlePreferences.kt @@ -15,11 +15,6 @@ import tachiyomi.core.common.preference.getEnum class SubtitlePreferences( private val preferenceStore: PreferenceStore, ) { - fun rememberSubtitlesDelay() = preferenceStore.getBoolean( - "pref_remember_subtitles_delay", - false, - ) - fun preferredSubLanguages() = preferenceStore.getString("pref_subtitle_lang", "") fun subtitleWhitelist() = preferenceStore.getString("pref_subtitle_whitelist", "") fun subtitleBlacklist() = preferenceStore.getString("pref_subtitle_blacklist", "") diff --git a/i18n/src/commonMain/moko-resources/base/strings.xml b/i18n/src/commonMain/moko-resources/base/strings.xml index 77993bc8f7..9710a4a924 100644 --- a/i18n/src/commonMain/moko-resources/base/strings.xml +++ b/i18n/src/commonMain/moko-resources/base/strings.xml @@ -296,7 +296,6 @@ Subtitles Preferred languages, whitelist, blacklist - Remember subtitle delay Preferred languages Subtitle language(s) to be selected by default on a video with multiple subtitles, Two- or three-letter languages codes work. Multiple values can be delimited by a comma. Whitelist @@ -307,7 +306,6 @@ Audio Preferred languages, pitch correction, audio channels - Remember audio delay Preferred languages Audio language(s) to be selected by default on a video with multiple audio streams, Two- or three-letter languages codes work. Multiple values can be delimited by a comma. Enable audio pitch correction