From a313463745db56d8cceab1389c283dc36c41ea6d Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 27 Aug 2019 08:40:17 +0800 Subject: [PATCH] up --- .../io/legado/app/ui/readbook/ReadBookViewModel.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt b/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt index bcb17f50c..cd0687b64 100644 --- a/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt @@ -15,6 +15,8 @@ import io.legado.app.model.WebBook import io.legado.app.service.ReadAloudService import io.legado.app.ui.widget.page.TextChapter import kotlinx.coroutines.Dispatchers.IO +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch class ReadBookViewModel(application: Application) : BaseViewModel(application) { var inBookshelf = false @@ -229,6 +231,14 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { nextTextChapter = null bookData.value?.let { loadContent(it, durChapterIndex.plus(1)) + launch(IO) { + for (i in 2..10) { + delay(5000L) + bookData.value?.let { book -> + download(book, durChapterIndex + i) + } + } + } } }