This commit is contained in:
chenjuntao
2023-07-24 09:44:52 +08:00
parent 42d5d46e53
commit d4b0ecce98

View File

@ -55,23 +55,21 @@ object DownloadMessageHandler : InnerDownloadListener {
* @param status 下载状态
*/
override fun onStatusChanged(id: String, status: DownloadStatus) {
val entity = findEntity(id)
val entity = findEntity(id) ?: return
if (entity != null) {
entity.status = status
entity.status = status
if (status == DownloadStatus.COMPLETED) {
SimpleDownloadManager.resumeQueuedTask()
}
if (status == DownloadStatus.COMPLETED) {
SimpleDownloadManager.resumeQueuedTask()
}
ExecutorProvider.getInstance().backgroundExecutor.execute {
updateDownloadToDatabase(entity)
updateDownloadList()
}
ExecutorProvider.getInstance().backgroundExecutor.execute {
updateDownloadToDatabase(entity)
updateDownloadList()
}
for (listener in mGlobalStatusChangedListenerList) {
listener.invoke(entity!!, status)
listener.invoke(entity, status)
}
val listenerList = mListenerMap[id] ?: return