Fixed searching not updating category count

This commit is contained in:
Jays2Kings 2021-07-03 03:55:37 -04:00
parent 3ad57497c9
commit 513034b431
2 changed files with 6 additions and 0 deletions

View File

@ -60,7 +60,9 @@ class LibraryCategoryAdapter(val controller: LibraryController) :
mangas = list.toList() mangas = list.toList()
performFilter() performFilter()
}
fun setItemsPerCategoryMap() {
itemsPerCategory = headerItems.map { header -> itemsPerCategory = headerItems.map { header ->
(header as LibraryHeaderItem).catId to getSectionItemPositions(header).size (header as LibraryHeaderItem).catId to getSectionItemPositions(header).size
}.toMap() }.toMap()
@ -131,6 +133,7 @@ class LibraryCategoryAdapter(val controller: LibraryController) :
updateDataSet(mangas.filter { it.filter(s) }) updateDataSet(mangas.filter { it.filter(s) })
} }
isLongPressDragEnabled = libraryListener.canDrag() && s.isNullOrBlank() isLongPressDragEnabled = libraryListener.canDrag() && s.isNullOrBlank()
setItemsPerCategoryMap()
} }
suspend fun performFilterAsync() { suspend fun performFilterAsync() {
@ -145,6 +148,7 @@ class LibraryCategoryAdapter(val controller: LibraryController) :
updateDataSet(filteredManga) updateDataSet(filteredManga)
} }
isLongPressDragEnabled = libraryListener.canDrag() && s.isNullOrBlank() isLongPressDragEnabled = libraryListener.canDrag() && s.isNullOrBlank()
setItemsPerCategoryMap()
} }
private fun getFirstLetter(name: String): String { private fun getFirstLetter(name: String): String {

View File

@ -611,6 +611,8 @@
<string name="midnight_dusk">Midnight Dusk</string> <string name="midnight_dusk">Midnight Dusk</string>
<string name="spring_blossom">Spring Blossom</string> <string name="spring_blossom">Spring Blossom</string>
<string name="strawberry_daiquiri">Strawberry Daiquiri</string> <string name="strawberry_daiquiri">Strawberry Daiquiri</string>
<string name="a_brighter_you">A Brighter You</string>
<string name="monet_dark">Monet Dark</string>
<string name="yotsuba">Yotsuba</string> <string name="yotsuba">Yotsuba</string>
<string name="black_and_red">Black \'n\' Red</string> <string name="black_and_red">Black \'n\' Red</string>
<string name="hot_pink">Hot Pink</string> <string name="hot_pink">Hot Pink</string>