From 2d2ff0a29dc1138f5414633f97e303eec6882e6e Mon Sep 17 00:00:00 2001 From: Bram van de Kerkhof Date: Sun, 2 Oct 2016 11:59:10 +0200 Subject: [PATCH] Download queue will now be reset if negative. (#485) --- .../eu/kanade/tachiyomi/data/download/DownloadNotifier.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt index 01f3a7b7f..498a08883 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt @@ -96,6 +96,10 @@ class DownloadNotifier(private val context: Context) { if (multipleDownloadThreads) { setContentTitle(context.getString(R.string.app_name)) + // Reset the queue size if the download progress is negative + if ((initialQueueSize - queue.size) < 0) + initialQueueSize = queue.size + setContentText(context.getString(R.string.chapter_downloading_progress) .format(initialQueueSize - queue.size, initialQueueSize)) setProgress(initialQueueSize, initialQueueSize - queue.size, false) @@ -161,6 +165,9 @@ class DownloadNotifier(private val context: Context) { setProgress(0, 0, false) } context.notificationManager.notify(Constants.NOTIFICATION_DOWNLOAD_CHAPTER_ERROR_ID, notificationBuilder.build()) + + // Reset download information + onClear() isDownloading = false } }