From 065cf42aea510e6e3edad2083dfa829692bd60d1 Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 23 May 2021 14:25:40 -0400 Subject: [PATCH] Fix reader chapter sort ordering (fixes #5157) --- .../java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt | 2 +- .../java/eu/kanade/tachiyomi/util/chapter/ChapterSorter.kt | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt index 1bf3e53cb4..fa471c3145 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt @@ -125,7 +125,7 @@ class ReaderPresenter( } chaptersForReader - .sortedWith(getChapterSort(manga)) + .sortedWith(getChapterSort(manga, sortDescending = false)) .map(::ReaderChapter) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterSorter.kt b/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterSorter.kt index 6b6395fa76..bce8fc6cb3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterSorter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterSorter.kt @@ -3,9 +3,7 @@ package eu.kanade.tachiyomi.util.chapter import eu.kanade.tachiyomi.data.database.models.Chapter import eu.kanade.tachiyomi.data.database.models.Manga -fun getChapterSort(manga: Manga): (Chapter, Chapter) -> Int { - val sortDescending = manga.sortDescending() - +fun getChapterSort(manga: Manga, sortDescending: Boolean = manga.sortDescending()): (Chapter, Chapter) -> Int { return when (manga.sorting) { Manga.CHAPTER_SORTING_SOURCE -> when (sortDescending) { true -> { c1, c2 -> c1.source_order.compareTo(c2.source_order) }