From 46cc078e93adbf80d82e5f118d0129de1df17923 Mon Sep 17 00:00:00 2001 From: len Date: Fri, 27 May 2016 20:11:37 +0200 Subject: [PATCH] Downloading chapters now always add them from the beginning --- .../eu/kanade/tachiyomi/data/download/DownloadManager.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt index 425644682..5a907ccbb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt @@ -111,11 +111,14 @@ class DownloadManager(private val context: Context, private val sourceManager: S fun downloadChapters(manga: Manga, chapters: List) { val source = sourceManager.get(manga.source) as? OnlineSource ?: return + // Add chapters to queue from the start + val sortedChapters = chapters.sortedByDescending { it.source_order } + // Used to avoid downloading chapters with the same name val addedChapters = ArrayList() val pending = ArrayList() - for (chapter in chapters) { + for (chapter in sortedChapters) { if (addedChapters.contains(chapter.name)) continue