From d3f5bba6347437d54fe533c9a29a5cbfd5bb4afb Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 27 Aug 2021 09:34:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/service/DownloadService.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/service/DownloadService.kt b/app/src/main/java/io/legado/app/service/DownloadService.kt index c5cc3c3a7..ac9042eb8 100644 --- a/app/src/main/java/io/legado/app/service/DownloadService.kt +++ b/app/src/main/java/io/legado/app/service/DownloadService.kt @@ -19,6 +19,7 @@ import io.legado.app.utils.msg import io.legado.app.utils.toastOnUi import kotlinx.coroutines.Job import kotlinx.coroutines.delay +import kotlinx.coroutines.isActive import kotlinx.coroutines.launch import splitties.systemservices.downloadManager import java.io.File @@ -77,8 +78,10 @@ class DownloadService : BaseService() { private fun checkDownloadState() { upStateJob?.cancel() upStateJob = launch { - queryState() - delay(1000) + while (isActive) { + queryState() + delay(1000) + } } }