Follow chapter sort setting when downloading next n chapters (closes #4725)
(cherry picked from commit fba3f9d501da586425b1fdce7db78ceaa6a644f7) # Conflicts: # app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt # app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt
This commit is contained in:
parent
676f716fcb
commit
28b4281683
@ -1423,13 +1423,14 @@ class MangaController :
|
||||
// OVERFLOW MENU DIALOGS
|
||||
|
||||
private fun getUnreadChaptersSorted() = /* SY --> */ if (presenter.source.isEhBasedSource()) presenter.chapters
|
||||
.sortedWith(presenter.getChapterSort())
|
||||
.filter { !it.read && it.status == Download.State.NOT_DOWNLOADED }
|
||||
.distinctBy { it.name }
|
||||
.sortedBy { it.source_order }
|
||||
else /* SY <-- */ 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) {
|
||||
|
@ -846,7 +846,11 @@ class MangaPresenter(
|
||||
}
|
||||
// SY <--
|
||||
|
||||
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) }
|
||||
@ -861,8 +865,6 @@ class MangaPresenter(
|
||||
}
|
||||
else -> throw NotImplementedError("Unimplemented sorting method")
|
||||
}
|
||||
|
||||
return observable.toSortedList(sortFunction)
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user