pull/1738/head
kunfei 3 years ago
parent 3123cdc142
commit fa11028997
  1. 12
      app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt

@ -38,6 +38,9 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
var searchContentQuery = ""
private var changeSourceCoroutine: Coroutine<*>? = null
/**
* 初始化
*/
fun initData(intent: Intent) {
execute {
ReadBook.inBookshelf = intent.getBooleanExtra("inBookshelf", true)
@ -99,6 +102,9 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
}
}
/**
* 加载详情页
*/
private fun loadBookInfo(book: Book) {
if (book.isLocalBook()) {
loadChapterList(book)
@ -114,6 +120,9 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
}
}
/**
* 加载目录
*/
fun loadChapterList(book: Book) {
if (book.isLocalBook()) {
execute {
@ -152,6 +161,9 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
}
}
/**
* 同步进度
*/
fun syncBookProgress(
book: Book,
alertSync: ((progress: BookProgress) -> Unit)? = null

Loading…
Cancel
Save