Improve library performance a bit
This commit is contained in:
parent
ecc708b6cd
commit
29241b0393
@ -485,15 +485,17 @@ class LibraryPresenter(
|
|||||||
private fun applyGrouping(map: LibraryMap, categories: List<Category>): Pair<LibraryMap, List<Category>> {
|
private fun applyGrouping(map: LibraryMap, categories: List<Category>): Pair<LibraryMap, List<Category>> {
|
||||||
groupType = preferences.groupLibraryBy().get()
|
groupType = preferences.groupLibraryBy().get()
|
||||||
var editedCategories = categories
|
var editedCategories = categories
|
||||||
val libraryMangaAsList = map.flatMap { it.value }.distinctBy { it.manga.id }
|
|
||||||
val items = if (groupType == LibraryGroup.BY_DEFAULT) {
|
val items = if (groupType == LibraryGroup.BY_DEFAULT) {
|
||||||
map
|
map
|
||||||
} else if (!libraryIsGrouped) {
|
} else if (!libraryIsGrouped) {
|
||||||
editedCategories = listOf(Category.create("All").apply { this.id = 0 })
|
editedCategories = listOf(Category.create("All").apply { this.id = 0 })
|
||||||
libraryMangaAsList
|
mapOf(
|
||||||
.groupBy { 0 }
|
0 to map.values.flatten().distinctBy { it.manga.id }
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
val (items, customCategories) = getGroupedMangaItems(libraryMangaAsList)
|
val (items, customCategories) = getGroupedMangaItems(
|
||||||
|
map.values.flatten().distinctBy { it.manga.id }
|
||||||
|
)
|
||||||
editedCategories = customCategories
|
editedCategories = customCategories
|
||||||
items
|
items
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user