diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt index 347b5adf4..96f4ceb13 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt @@ -1003,9 +1003,10 @@ class MangaController : // OVERFLOW MENU DIALOGS private fun getUnreadChaptersSorted() = presenter.chapters + .sortedWith(presenter.getChapterSort()) .filter { !it.read && it.status == Download.State.NOT_DOWNLOADED } .distinctBy { it.name } - .sortedByDescending { it.source_order } + .reversed() private fun downloadChapters(choice: Int) { val chaptersToDownload = when (choice) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt index 88634881e..11672cd3d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt @@ -429,7 +429,11 @@ class MangaPresenter( observable = observable.filter { !it.bookmark } } - val sortFunction: (Chapter, Chapter) -> Int = when (manga.sorting) { + return observable.toSortedList(getChapterSort()) + } + + fun getChapterSort(): (Chapter, Chapter) -> Int { + return when (manga.sorting) { Manga.SORTING_SOURCE -> when (sortDescending()) { true -> { c1, c2 -> c1.source_order.compareTo(c2.source_order) } false -> { c1, c2 -> c2.source_order.compareTo(c1.source_order) } @@ -444,8 +448,6 @@ class MangaPresenter( } else -> throw NotImplementedError("Unimplemented sorting method") } - - return observable.toSortedList(sortFunction) } /**