diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 1ca3712d9..d777971f2 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -65,11 +65,8 @@ import io.legado.app.ui.widget.PopupAction import io.legado.app.ui.widget.dialog.PhotoDialog import io.legado.app.ui.widget.dialog.TextDialog import io.legado.app.utils.* +import kotlinx.coroutines.* import kotlinx.coroutines.Dispatchers.IO -import kotlinx.coroutines.Job -import kotlinx.coroutines.delay -import kotlinx.coroutines.isActive -import kotlinx.coroutines.launch class ReadBookActivity : BaseReadBookActivity(), View.OnTouchListener, @@ -1063,9 +1060,11 @@ class ReadBookActivity : BaseReadBookActivity(), backupJob?.cancel() backupJob = launch { delay(120000) - ReadBook.book?.let { - AppWebDav.uploadBookProgress(it) - Backup.autoBack(this@ReadBookActivity) + withContext(IO) { + ReadBook.book?.let { + AppWebDav.uploadBookProgress(it) + Backup.autoBack(this@ReadBookActivity) + } } } }