mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Fix #1073
This commit is contained in:
parent
fe1becb001
commit
e7e1a9bf50
2 changed files with 8 additions and 6 deletions
|
@ -34,7 +34,7 @@ class LibraryCategoryAdapter(view: LibraryCategoryView) :
|
||||||
* @param manga the manga to find.
|
* @param manga the manga to find.
|
||||||
*/
|
*/
|
||||||
fun indexOf(manga: Manga): Int {
|
fun indexOf(manga: Manga): Int {
|
||||||
return mangas.indexOfFirst { it.manga.id == manga.id }
|
return currentItems.indexOfFirst { it.manga.id == manga.id }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun performFilter() {
|
fun performFilter() {
|
||||||
|
|
|
@ -73,7 +73,7 @@ class LibraryController(
|
||||||
/**
|
/**
|
||||||
* Currently selected mangas.
|
* Currently selected mangas.
|
||||||
*/
|
*/
|
||||||
val selectedMangas = mutableListOf<Manga>()
|
val selectedMangas = mutableSetOf<Manga>()
|
||||||
|
|
||||||
private var selectedCoverManga: Manga? = null
|
private var selectedCoverManga: Manga? = null
|
||||||
|
|
||||||
|
@ -429,11 +429,13 @@ class LibraryController(
|
||||||
*/
|
*/
|
||||||
fun setSelection(manga: Manga, selected: Boolean) {
|
fun setSelection(manga: Manga, selected: Boolean) {
|
||||||
if (selected) {
|
if (selected) {
|
||||||
selectedMangas.add(manga)
|
if (selectedMangas.add(manga)) {
|
||||||
selectionRelay.call(LibrarySelectionEvent.Selected(manga))
|
selectionRelay.call(LibrarySelectionEvent.Selected(manga))
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
selectedMangas.remove(manga)
|
if (selectedMangas.remove(manga)) {
|
||||||
selectionRelay.call(LibrarySelectionEvent.Unselected(manga))
|
selectionRelay.call(LibrarySelectionEvent.Unselected(manga))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue