|
|
@ -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 { |
|
|
|