Optional to automatically go to new page on focus instead of clicking (#127)

Closes #95 

Adds a setting (defaults to enabled) to automatically go to a page when
the navigation drawer item is focused after a brief delay.

Basically, if you open the left nav drawer, and scroll down to "Movies"
after a brief delay (600ms), the app will switch to the Movies page
without having to click.

It can be disabled in advanced settings.
This commit is contained in:
damontecres 2025-10-31 15:09:13 -04:00 committed by GitHub
parent 26cc092402
commit 9f3691fd1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 137 additions and 17 deletions

View file

@ -590,13 +590,25 @@ sealed interface AppPreference<T> {
getter = { },
setter = { prefs, _ -> prefs },
)
val NavDrawerSwitchOnFocus =
AppSwitchPreference(
title = R.string.nav_drawer_switch_on_focus,
defaultValue = true,
getter = { it.interfacePreferences.navDrawerSwitchOnFocus },
setter = { prefs, value ->
prefs.updateInterfacePreferences { navDrawerSwitchOnFocus = value }
},
summaryOn = R.string.enabled,
summaryOff = R.string.nav_drawer_switch_on_focus_summary_off,
)
}
}
val basicPreferences =
listOf(
PreferenceGroup(
title = R.string.basic_interface,
title = R.string.ui_interface,
preferences =
listOf(
AppPreference.HomePageItems,
@ -648,6 +660,13 @@ val uiPreferences = listOf<PreferenceGroup>()
val advancedPreferences =
listOf(
PreferenceGroup(
title = R.string.ui_interface,
preferences =
listOf(
AppPreference.NavDrawerSwitchOnFocus,
),
),
PreferenceGroup(
title = R.string.playback,
preferences =

View file

@ -70,6 +70,8 @@ class AppPreferencesSerializer
.apply {
playThemeSongs = AppPreference.PlayThemeMusic.defaultValue
appThemeColors = AppPreference.ThemeColors.defaultValue
navDrawerSwitchOnFocus =
AppPreference.NavDrawerSwitchOnFocus.defaultValue
}.build()
}.build()