mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Show selected preference for "Library update order"
This commit is contained in:
parent
797553ce16
commit
ff999a6dda
2 changed files with 22 additions and 14 deletions
|
@ -114,33 +114,42 @@ class SettingsLibraryController : SettingsController() {
|
|||
selectedCategories.joinToString { it.name }
|
||||
}
|
||||
}
|
||||
intListPreference{
|
||||
intListPreference {
|
||||
key = Keys.libraryUpdatePrioritization
|
||||
titleRes = R.string.pref_library_update_prioritization
|
||||
// The following arrays are to be lined up with the list rankingScheme in:
|
||||
|
||||
// The following array lines up with the list rankingScheme in:
|
||||
// ../../data/library/LibraryUpdateRanker.kt
|
||||
entriesRes = arrayOf(
|
||||
R.string.action_sort_alpha,
|
||||
R.string.action_sort_last_updated
|
||||
val priorities = arrayOf(
|
||||
Pair("0", R.string.action_sort_alpha),
|
||||
Pair("1", R.string.action_sort_last_updated)
|
||||
)
|
||||
entryValues = arrayOf(
|
||||
"0",
|
||||
"1"
|
||||
)
|
||||
defaultValue = "0"
|
||||
summaryRes = R.string.pref_library_update_prioritization_summary
|
||||
val defaultPriority = priorities[0]
|
||||
|
||||
entriesRes = priorities.map { it.second }.toTypedArray()
|
||||
entryValues = priorities.map { it.first }.toTypedArray()
|
||||
defaultValue = defaultPriority.first
|
||||
|
||||
val selectedPriority = priorities.find { it.first.toInt() == preferences.libraryUpdatePrioritization().getOrDefault() }
|
||||
summaryRes = selectedPriority?.second ?: defaultPriority.second
|
||||
onChange { newValue ->
|
||||
summaryRes = priorities.find {
|
||||
it.first == (newValue as String)
|
||||
}?.second ?: defaultPriority.second
|
||||
true
|
||||
}
|
||||
}
|
||||
intListPreference {
|
||||
key = Keys.defaultCategory
|
||||
titleRes = R.string.default_category
|
||||
|
||||
val selectedCategory = categories.find { it.id == preferences.defaultCategory() }
|
||||
entries = arrayOf(context.getString(R.string.default_category_summary)) +
|
||||
categories.map { it.name }.toTypedArray()
|
||||
entryValues = arrayOf("-1") + categories.map { it.id.toString() }.toTypedArray()
|
||||
defaultValue = "-1"
|
||||
summary = selectedCategory?.name ?: context.getString(R.string.default_category_summary)
|
||||
|
||||
val selectedCategory = categories.find { it.id == preferences.defaultCategory() }
|
||||
summary = selectedCategory?.name ?: context.getString(R.string.default_category_summary)
|
||||
onChange { newValue ->
|
||||
summary = categories.find {
|
||||
it.id == (newValue as String).toInt()
|
||||
|
|
|
@ -147,7 +147,6 @@
|
|||
<string name="pref_library_update_categories">Categories to include in global update</string>
|
||||
<string name="all">All</string>
|
||||
<string name="pref_library_update_prioritization">Library update order</string>
|
||||
<string name="pref_library_update_prioritization_summary">Select the order in which Tachiyomi checks for update</string>
|
||||
<string name="pref_library_update_restriction">Library update restrictions</string>
|
||||
<string name="pref_library_update_restriction_summary">Update only when the conditions are met</string>
|
||||
<string name="wifi">Wi-Fi</string>
|
||||
|
|
Loading…
Reference in a new issue