|
|
@ -43,12 +43,16 @@ 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) |
|
|
|
val chapterList = App.db.bookChapterDao().getChapterList(book.bookUrl) |
|
|
|
if (book.tocUrl.isEmpty()) { |
|
|
|
if (chapterList.isNotEmpty()) { |
|
|
|
loadBookInfo(book) |
|
|
|
chapterListData.postValue(chapterList) |
|
|
|
|
|
|
|
isLoadingData.postValue(false) |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
loadChapter(book) |
|
|
|
val chapterList = App.db.bookChapterDao().getChapterList(book.bookUrl) |
|
|
|
|
|
|
|
if (chapterList.isNotEmpty()) { |
|
|
|
|
|
|
|
chapterListData.postValue(chapterList) |
|
|
|
|
|
|
|
isLoadingData.postValue(false) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
loadChapter(book) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|