Fixed unread sorting for the read manga

This commit is contained in:
Jay 2020-05-14 13:13:24 -04:00
parent c2e2076b0a
commit 6cafc5f5a0

View File

@ -332,7 +332,7 @@ class LibraryPresenter(
i1.chapterCount = -1
i2.chapterCount = -1
}
when {
val compare = when {
sortingMode == LibrarySort.DRAG_AND_DROP || useDnD ->
sortCategory(i1, i2, lastReadManga)
sortingMode == LibrarySort.ALPHA -> sortAlphabetical(i1, i2)
@ -364,6 +364,10 @@ class LibraryPresenter(
}
else -> 0
}
if (!(sortingMode == LibrarySort.DRAG_AND_DROP || useDnD) && compare == 0) {
if (ascending) sortAlphabetical(i1, i2)
else sortAlphabetical(i2, i1)
} else compare
}
val comparator = if (ascending || useDnD)
@ -418,7 +422,7 @@ class LibraryPresenter(
}
i1.chapterCount = -1
i2.chapterCount = -1
when {
val compare = when {
category.mangaSort != null -> {
var sort = when (category.sortingMode()) {
LibrarySort.ALPHA -> sortAlphabetical(i1, i2)
@ -461,6 +465,9 @@ class LibraryPresenter(
}
else -> 0
}
if (compare == 0) {
sortAlphabetical(i1, i2)
} else compare
} else {
val category = allCategories.find { it.id == i1.manga.category }?.order ?: -1
val category2 = allCategories.find { it.id == i2.manga.category }?.order ?: -1