pull/32/head
kunfei 5 years ago
parent 8679723300
commit 99a5105cd2
  1. 4
      app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt

@ -14,8 +14,10 @@ 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.Dispatchers.Main
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
class ReadBookViewModel(application: Application) : BaseViewModel(application) { class ReadBookViewModel(application: Application) : BaseViewModel(application) {
var inBookshelf = false var inBookshelf = false
@ -228,7 +230,9 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
prevTextChapter = null prevTextChapter = null
curTextChapter = null curTextChapter = null
nextTextChapter = null nextTextChapter = null
withContext(Main) {
callBack?.upContent() callBack?.upContent()
}
App.db.bookDao().insert(book) App.db.bookDao().insert(book)
bookData.postValue(book) bookData.postValue(book)
App.db.bookSourceDao().getBookSource(book.origin)?.let { App.db.bookSourceDao().getBookSource(book.origin)?.let {

Loading…
Cancel
Save