mirror of
https://github.com/mihonapp/mihon.git
synced 2025-10-28 21:07:57 +01:00
Use actual enum support for display mode preferences
This commit is contained in:
@@ -73,7 +73,7 @@ object PreferenceKeys {
|
||||
|
||||
const val lastUsedCategory = "last_used_category"
|
||||
|
||||
const val catalogueDisplayMode = "pref_catalogue_display_mode"
|
||||
const val catalogueDisplayMode = "pref_display_mode_catalogue"
|
||||
|
||||
const val enabledLanguages = "source_languages"
|
||||
|
||||
@@ -131,7 +131,7 @@ object PreferenceKeys {
|
||||
|
||||
const val downloadNewCategories = "download_new_categories"
|
||||
|
||||
const val libraryDisplayMode = "pref_library_display_mode"
|
||||
const val libraryDisplayMode = "pref_display_mode_library"
|
||||
|
||||
const val lang = "app_language"
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ object PreferenceValues {
|
||||
AMOLED("amoled"),
|
||||
}
|
||||
|
||||
enum class DisplayMode(val value: Int) {
|
||||
COMPACT_GRID(0),
|
||||
COMFORTABLE_GRID(1),
|
||||
LIST(2),
|
||||
enum class DisplayMode {
|
||||
COMPACT_GRID,
|
||||
COMFORTABLE_GRID,
|
||||
LIST,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun lastVersionCode() = flowPrefs.getInt("last_version_code", 0)
|
||||
|
||||
fun catalogueDisplayMode() = flowPrefs.getInt(Keys.catalogueDisplayMode, DisplayMode.COMPACT_GRID.value)
|
||||
fun catalogueDisplayMode() = flowPrefs.getEnum(Keys.catalogueDisplayMode, DisplayMode.COMPACT_GRID)
|
||||
|
||||
fun enabledLanguages() = flowPrefs.getStringSet(Keys.enabledLanguages, setOf("en", Locale.getDefault().language))
|
||||
|
||||
@@ -185,7 +185,7 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun libraryUpdatePrioritization() = flowPrefs.getInt(Keys.libraryUpdatePrioritization, 0)
|
||||
|
||||
fun libraryDisplayMode() = flowPrefs.getInt(Keys.libraryDisplayMode, DisplayMode.COMPACT_GRID.value)
|
||||
fun libraryDisplayMode() = flowPrefs.getEnum(Keys.libraryDisplayMode, DisplayMode.COMPACT_GRID)
|
||||
|
||||
fun downloadBadge() = flowPrefs.getBoolean(Keys.downloadBadge, false)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user