From 7cd54dc8f0e541f41bec1a8662f0f2a691257b6f Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 23 Oct 2021 17:05:22 -0400 Subject: [PATCH] Launch the download warning toast in the UI thread Co-authored-by: jobobby04 --- .../java/eu/kanade/tachiyomi/data/download/Downloader.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt index e58f386dd6..7a75e633b2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt @@ -20,6 +20,7 @@ import eu.kanade.tachiyomi.util.lang.RetryWithDelay import eu.kanade.tachiyomi.util.lang.launchIO import eu.kanade.tachiyomi.util.lang.launchNow import eu.kanade.tachiyomi.util.lang.plusAssign +import eu.kanade.tachiyomi.util.lang.withUIContext import eu.kanade.tachiyomi.util.storage.DiskUtil import eu.kanade.tachiyomi.util.storage.saveTo import eu.kanade.tachiyomi.util.system.ImageUtil @@ -267,7 +268,9 @@ class Downloader( if (autoStart && wasEmpty) { val maxDownloadsFromSource = queue.groupBy { it.source }.maxOf { it.value.size } if (maxDownloadsFromSource > CHAPTERS_PER_SOURCE_QUEUE_WARNING_THRESHOLD) { - context.toast(R.string.download_queue_size_warning, Toast.LENGTH_LONG) + withUIContext { + context.toast(R.string.download_queue_size_warning, Toast.LENGTH_LONG) + } } DownloadService.start(context) }