|
@@ -14,6 +14,7 @@ import io.legado.app.base.BaseService
|
|
|
import io.legado.app.constant.AppConst
|
|
import io.legado.app.constant.AppConst
|
|
|
import io.legado.app.constant.AppLog
|
|
import io.legado.app.constant.AppLog
|
|
|
import io.legado.app.constant.IntentAction
|
|
import io.legado.app.constant.IntentAction
|
|
|
|
|
+import io.legado.app.constant.NotificationId
|
|
|
import io.legado.app.utils.IntentType
|
|
import io.legado.app.utils.IntentType
|
|
|
import io.legado.app.utils.openFileUri
|
|
import io.legado.app.utils.openFileUri
|
|
|
import io.legado.app.utils.servicePendingIntent
|
|
import io.legado.app.utils.servicePendingIntent
|
|
@@ -102,7 +103,8 @@ class DownloadService : BaseService() {
|
|
|
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName)
|
|
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName)
|
|
|
// 添加一个下载任务
|
|
// 添加一个下载任务
|
|
|
val downloadId = downloadManager.enqueue(request)
|
|
val downloadId = downloadManager.enqueue(request)
|
|
|
- downloads[downloadId] = DownloadInfo(url, fileName, downloads.size + 1)
|
|
|
|
|
|
|
+ downloads[downloadId] =
|
|
|
|
|
+ DownloadInfo(url, fileName, NotificationId.Download + downloads.size)
|
|
|
queryState()
|
|
queryState()
|
|
|
if (upStateJob == null) {
|
|
if (upStateJob == null) {
|
|
|
checkDownloadState()
|
|
checkDownloadState()
|
|
@@ -224,7 +226,7 @@ class DownloadService : BaseService() {
|
|
|
.setGroupSummary(true)
|
|
.setGroupSummary(true)
|
|
|
.setOngoing(true)
|
|
.setOngoing(true)
|
|
|
.build()
|
|
.build()
|
|
|
- startForeground(AppConst.notificationIdDownload, notification)
|
|
|
|
|
|
|
+ startForeground(NotificationId.DownloadService, notification)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|