Finished integrating new downloader

This commit is contained in:
Pupil
2020-02-03 11:54:29 +09:00
parent 874606bff9
commit d30c51bb3a
8 changed files with 211 additions and 116 deletions

View File

@@ -38,9 +38,6 @@ import io.fabric.sdk.android.Fabric
import kotlinx.android.synthetic.main.activity_reader.*
import kotlinx.android.synthetic.main.activity_reader.view.*
import kotlinx.android.synthetic.main.dialog_numberpicker.view.*
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.serialization.ImplicitReflectionSerializer
import xyz.quaver.hitomi.Reader
import xyz.quaver.pupil.Pupil
@@ -199,6 +196,7 @@ class ReaderActivity : AppCompatActivity() {
super.onDestroy()
timer.cancel()
(reader_recyclerview.adapter as ReaderAdapter).timer.cancel()
if (!Cache(this).isDownloading(galleryID))
DownloadWorker.getInstance(this@ReaderActivity).cancel(galleryID)
@@ -327,10 +325,6 @@ class ReaderActivity : AppCompatActivity() {
animateDownloadFAB(false)
} else {
CoroutineScope(Dispatchers.IO).launch {
Cache(context).moveToDownload(galleryID)
}
Cache(context).setDownloading(galleryID, true)
animateDownloadFAB(true)
}