mirror of
https://github.com/mihonapp/mihon.git
synced 2025-10-29 13:27:57 +01:00
Use getEnum for theme preferences too
This commit is contained in:
@@ -5,21 +5,24 @@ package eu.kanade.tachiyomi.data.preference
|
||||
*/
|
||||
object PreferenceValues {
|
||||
|
||||
enum class ThemeMode(val value: String) {
|
||||
LIGHT("light"),
|
||||
DARK("dark"),
|
||||
SYSTEM("system"),
|
||||
// Keys are lowercase to match legacy string values
|
||||
enum class ThemeMode {
|
||||
light,
|
||||
dark,
|
||||
system,
|
||||
}
|
||||
|
||||
enum class LightThemeVariant(val value: String) {
|
||||
DEFAULT("default"),
|
||||
BLUE("blue"),
|
||||
// Keys are lowercase to match legacy string values
|
||||
enum class LightThemeVariant {
|
||||
default,
|
||||
blue,
|
||||
}
|
||||
|
||||
enum class DarkThemeVariant(val value: String) {
|
||||
DEFAULT("default"),
|
||||
BLUE("blue"),
|
||||
AMOLED("amoled"),
|
||||
// Keys are lowercase to match legacy string values
|
||||
enum class DarkThemeVariant {
|
||||
default,
|
||||
blue,
|
||||
amoled,
|
||||
}
|
||||
|
||||
enum class DisplayMode {
|
||||
|
||||
@@ -69,11 +69,11 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun clear() = prefs.edit().clear().apply()
|
||||
|
||||
fun themeMode() = flowPrefs.getString(Keys.themeMode, Values.ThemeMode.SYSTEM.value)
|
||||
fun themeMode() = flowPrefs.getEnum(Keys.themeMode, Values.ThemeMode.system)
|
||||
|
||||
fun themeLight() = flowPrefs.getString(Keys.themeLight, Values.LightThemeVariant.DEFAULT.value)
|
||||
fun themeLight() = flowPrefs.getEnum(Keys.themeLight, Values.LightThemeVariant.default)
|
||||
|
||||
fun themeDark() = flowPrefs.getString(Keys.themeDark, Values.DarkThemeVariant.DEFAULT.value)
|
||||
fun themeDark() = flowPrefs.getEnum(Keys.themeDark, Values.DarkThemeVariant.default)
|
||||
|
||||
fun rotation() = flowPrefs.getInt(Keys.rotation, 1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user