|
|
@ -43,6 +43,9 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
private fun setBook(book: Book) { |
|
|
|
private fun setBook(book: Book) { |
|
|
|
durChapterIndex = book.durChapterIndex |
|
|
|
durChapterIndex = book.durChapterIndex |
|
|
|
bookData.postValue(book) |
|
|
|
bookData.postValue(book) |
|
|
|
|
|
|
|
if (book.tocUrl.isEmpty()) { |
|
|
|
|
|
|
|
loadBookInfo(book) |
|
|
|
|
|
|
|
} else { |
|
|
|
val chapterList = App.db.bookChapterDao().getChapterList(book.bookUrl) |
|
|
|
val chapterList = App.db.bookChapterDao().getChapterList(book.bookUrl) |
|
|
|
if (chapterList.isNotEmpty()) { |
|
|
|
if (chapterList.isNotEmpty()) { |
|
|
|
chapterListData.postValue(chapterList) |
|
|
|
chapterListData.postValue(chapterList) |
|
|
@ -51,6 +54,7 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
loadChapter(book) |
|
|
|
loadChapter(book) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun loadBookInfo( |
|
|
|
fun loadBookInfo( |
|
|
|
book: Book, |
|
|
|
book: Book, |
|
|
|