Don't cancel download onPause

This commit is contained in:
tom5079
2020-10-04 23:04:12 +09:00
parent 49c3ebc36b
commit 12d58e5aa7
4 changed files with 6 additions and 5 deletions

View File

@@ -126,6 +126,7 @@ class GalleryBlockAdapter(private val galleries: List<Int>) : RecyclerSwipeAdapt
fun bind(galleryID: Int) {
this.galleryID = galleryID
updateProgress(view.context)
val cache = Cache.getInstance(view.context, galleryID)

View File

@@ -294,10 +294,10 @@ class DownloadService : Service() {
}
fun download(galleryID: Int, priority: Boolean = false, startId: Int? = null): Job = CoroutineScope(Dispatchers.IO).launch {
cleanCache(this@DownloadService)
if (DownloadManager.getInstance(this@DownloadService).isDownloading(galleryID))
return@launch
if (progress.containsKey(galleryID))
cancel(galleryID)
cleanCache(this@DownloadService)
val cache = Cache.getInstance(this@DownloadService, galleryID)