pull/375/head
gedoor 4 years ago
parent 9cb35f74fc
commit 56fc9d2b95
  1. 7
      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.RealPathUtil
import io.legado.app.utils.msg import io.legado.app.utils.msg
import org.jetbrains.anko.downloadManager import org.jetbrains.anko.downloadManager
import org.jetbrains.anko.notificationManager
import org.jetbrains.anko.toast import org.jetbrains.anko.toast
import java.io.File import java.io.File
@ -69,10 +68,8 @@ class DownloadService : BaseService() {
} }
IntentAction.stop -> { IntentAction.stop -> {
val downloadId = intent.getLongExtra("downloadId", 0) val downloadId = intent.getLongExtra("downloadId", 0)
if (downloadId > 0) { downloads.remove(downloadId)
downloadManager.remove(downloadId) if (downloads.isEmpty()) {
notificationManager.cancel(downloadId.toInt())
} else {
stopSelf() stopSelf()
} }
} }

Loading…
Cancel
Save