diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt index a1148ca16a..7a15c45f3a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt @@ -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