Fixed default category not saying D&D mode after disabling categories
This commit is contained in:
parent
175d7f4de6
commit
0f228a6967
1 changed files with 11 additions and 6 deletions
|
@ -204,11 +204,8 @@ class LibraryPresenter(
|
||||||
db.getTotalChapterManga().executeAsBlocking().associate { it.id!! to counter++ }
|
db.getTotalChapterManga().executeAsBlocking().associate { it.id!! to counter++ }
|
||||||
}
|
}
|
||||||
val catListing by lazy {
|
val catListing by lazy {
|
||||||
val default = Category.createDefault(context)
|
val default = createDefaultCategory()
|
||||||
default.order = -1
|
default.order = -1
|
||||||
val defOrder = preferences.defaultMangaOrder().getOrDefault()
|
|
||||||
if (defOrder.firstOrNull()?.isLetter() == true) default.mangaSort = defOrder.first()
|
|
||||||
else default.mangaOrder = defOrder.split("/").mapNotNull { it.toLongOrNull() }
|
|
||||||
listOf(default) + db.getCategories().executeAsBlocking()
|
listOf(default) + db.getCategories().executeAsBlocking()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,17 +297,25 @@ class LibraryPresenter(
|
||||||
private fun getLibraryObservable(): Observable<Library> {
|
private fun getLibraryObservable(): Observable<Library> {
|
||||||
return Observable.combineLatest(getCategoriesObservable(), getLibraryMangasObservable()) { dbCategories, libraryManga ->
|
return Observable.combineLatest(getCategoriesObservable(), getLibraryMangasObservable()) { dbCategories, libraryManga ->
|
||||||
val categories = if (libraryManga.containsKey(0))
|
val categories = if (libraryManga.containsKey(0))
|
||||||
arrayListOf(Category.createDefault(context)) + dbCategories
|
arrayListOf(createDefaultCategory()) + dbCategories
|
||||||
else dbCategories
|
else dbCategories
|
||||||
|
|
||||||
this.allCategories = categories
|
this.allCategories = categories
|
||||||
this.categories = if (!preferences.showCategories().getOrDefault())
|
this.categories = if (!preferences.showCategories().getOrDefault())
|
||||||
arrayListOf(Category.createDefault(context))
|
arrayListOf(createDefaultCategory())
|
||||||
else categories
|
else categories
|
||||||
Library(this.categories, libraryManga)
|
Library(this.categories, libraryManga)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun createDefaultCategory(): Category {
|
||||||
|
val default = Category.createDefault(context)
|
||||||
|
val defOrder = preferences.defaultMangaOrder().getOrDefault()
|
||||||
|
if (defOrder.firstOrNull()?.isLetter() == true) default.mangaSort = defOrder.first()
|
||||||
|
else default.mangaOrder = defOrder.split("/").mapNotNull { it.toLongOrNull() }
|
||||||
|
return default
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the categories from the database.
|
* Get the categories from the database.
|
||||||
*
|
*
|
||||||
|
|
Reference in a new issue