mirror of
https://github.com/mihonapp/mihon.git
synced 2025-10-29 13:27:57 +01:00
Use enums for other PreferenceValues
This commit is contained in:
@@ -5,16 +5,22 @@ package eu.kanade.tachiyomi.data.preference
|
||||
*/
|
||||
object PreferenceValues {
|
||||
|
||||
const val THEME_MODE_LIGHT = "light"
|
||||
const val THEME_MODE_DARK = "dark"
|
||||
const val THEME_MODE_SYSTEM = "system"
|
||||
enum class ThemeMode(val value: String) {
|
||||
LIGHT("light"),
|
||||
DARK("dark"),
|
||||
SYSTEM("system"),
|
||||
}
|
||||
|
||||
const val THEME_LIGHT_DEFAULT = "default"
|
||||
const val THEME_LIGHT_BLUE = "blue"
|
||||
enum class LightThemeVariant(val value: String) {
|
||||
DEFAULT("default"),
|
||||
BLUE("blue"),
|
||||
}
|
||||
|
||||
const val THEME_DARK_DEFAULT = "default"
|
||||
const val THEME_DARK_BLUE = "blue"
|
||||
const val THEME_DARK_AMOLED = "amoled"
|
||||
enum class DarkThemeVariant(val value: String) {
|
||||
DEFAULT("default"),
|
||||
BLUE("blue"),
|
||||
AMOLED("amoled"),
|
||||
}
|
||||
|
||||
enum class DisplayMode(val value: Int) {
|
||||
COMPACT_GRID(0),
|
||||
|
||||
@@ -69,11 +69,11 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun clear() = prefs.edit().clear().apply()
|
||||
|
||||
fun themeMode() = flowPrefs.getString(Keys.themeMode, Values.THEME_MODE_SYSTEM)
|
||||
fun themeMode() = flowPrefs.getString(Keys.themeMode, Values.ThemeMode.SYSTEM.value)
|
||||
|
||||
fun themeLight() = flowPrefs.getString(Keys.themeLight, Values.THEME_LIGHT_DEFAULT)
|
||||
fun themeLight() = flowPrefs.getString(Keys.themeLight, Values.LightThemeVariant.DEFAULT.value)
|
||||
|
||||
fun themeDark() = flowPrefs.getString(Keys.themeDark, Values.THEME_DARK_DEFAULT)
|
||||
fun themeDark() = flowPrefs.getString(Keys.themeDark, Values.DarkThemeVariant.DEFAULT.value)
|
||||
|
||||
fun rotation() = flowPrefs.getInt(Keys.rotation, 1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user