mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-27 17:49:16 +03:00
Made 'Default' category selectable in global update settings (#2318)
(cherry picked from commit b55814a1c0
)
This commit is contained in:
parent
51e049ab78
commit
a24d670f54
2 changed files with 4 additions and 7 deletions
|
@ -249,7 +249,6 @@ class LibraryUpdateService(
|
||||||
else
|
else
|
||||||
db.getLibraryMangas().executeAsBlocking().distinctBy { it.id }
|
db.getLibraryMangas().executeAsBlocking().distinctBy { it.id }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target == Target.CHAPTERS && preferences.updateOnlyNonCompleted()) {
|
if (target == Target.CHAPTERS && preferences.updateOnlyNonCompleted()) {
|
||||||
listToUpdate = listToUpdate.filter { it.status != SManga.COMPLETED }
|
listToUpdate = listToUpdate.filter { it.status != SManga.COMPLETED }
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,17 +141,17 @@ class SettingsGeneralController : SettingsController() {
|
||||||
}
|
}
|
||||||
|
|
||||||
val dbCategories = db.getCategories().executeAsBlocking()
|
val dbCategories = db.getCategories().executeAsBlocking()
|
||||||
|
val categories = listOf(Category.createDefault()) + dbCategories
|
||||||
|
|
||||||
multiSelectListPreference {
|
multiSelectListPreference {
|
||||||
key = Keys.libraryUpdateCategories
|
key = Keys.libraryUpdateCategories
|
||||||
titleRes = R.string.pref_library_update_categories
|
titleRes = R.string.pref_library_update_categories
|
||||||
entries = dbCategories.map { it.name }.toTypedArray()
|
entries = categories.map { it.name }.toTypedArray()
|
||||||
entryValues = dbCategories.map { it.id.toString() }.toTypedArray()
|
entryValues = categories.map { it.id.toString() }.toTypedArray()
|
||||||
|
|
||||||
preferences.libraryUpdateCategories().asObservable()
|
preferences.libraryUpdateCategories().asObservable()
|
||||||
.subscribeUntilDestroy {
|
.subscribeUntilDestroy {
|
||||||
val selectedCategories = it
|
val selectedCategories = it
|
||||||
.mapNotNull { id -> dbCategories.find { it.id == id.toInt() } }
|
.mapNotNull { id -> categories.find { it.id == id.toInt() } }
|
||||||
.sortedBy { it.order }
|
.sortedBy { it.order }
|
||||||
|
|
||||||
summary = if (selectedCategories.isEmpty())
|
summary = if (selectedCategories.isEmpty())
|
||||||
|
@ -180,8 +180,6 @@ class SettingsGeneralController : SettingsController() {
|
||||||
key = Keys.defaultCategory
|
key = Keys.defaultCategory
|
||||||
titleRes = R.string.default_category
|
titleRes = R.string.default_category
|
||||||
|
|
||||||
val categories = listOf(Category.createDefault()) + dbCategories
|
|
||||||
|
|
||||||
val selectedCategory = categories.find { it.id == preferences.defaultCategory() }
|
val selectedCategory = categories.find { it.id == preferences.defaultCategory() }
|
||||||
entries = arrayOf(context.getString(R.string.default_category_summary)) +
|
entries = arrayOf(context.getString(R.string.default_category_summary)) +
|
||||||
categories.map { it.name }.toTypedArray()
|
categories.map { it.name }.toTypedArray()
|
||||||
|
|
Loading…
Reference in a new issue