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