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 c069ab6c4..53868a977 100644 --- a/app/src/main/java/io/legado/app/service/DownloadService.kt +++ b/app/src/main/java/io/legado/app/service/DownloadService.kt @@ -20,7 +20,6 @@ import io.legado.app.help.IntentHelp import io.legado.app.utils.RealPathUtil import io.legado.app.utils.msg import org.jetbrains.anko.downloadManager -import org.jetbrains.anko.notificationManager import org.jetbrains.anko.toast import java.io.File @@ -69,10 +68,8 @@ class DownloadService : BaseService() { } IntentAction.stop -> { val downloadId = intent.getLongExtra("downloadId", 0) - if (downloadId > 0) { - downloadManager.remove(downloadId) - notificationManager.cancel(downloadId.toInt()) - } else { + downloads.remove(downloadId) + if (downloads.isEmpty()) { stopSelf() } }