pull/32/head
kunfei 5 years ago
parent 463523e37b
commit a313463745
  1. 10
      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.service.ReadAloudService
import io.legado.app.ui.widget.page.TextChapter import io.legado.app.ui.widget.page.TextChapter
import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
class ReadBookViewModel(application: Application) : BaseViewModel(application) { class ReadBookViewModel(application: Application) : BaseViewModel(application) {
var inBookshelf = false var inBookshelf = false
@ -229,6 +231,14 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
nextTextChapter = null nextTextChapter = null
bookData.value?.let { bookData.value?.let {
loadContent(it, durChapterIndex.plus(1)) loadContent(it, durChapterIndex.plus(1))
launch(IO) {
for (i in 2..10) {
delay(5000L)
bookData.value?.let { book ->
download(book, durChapterIndex + i)
}
}
}
} }
} }

Loading…
Cancel
Save