From e2c2d9e408c89bb21032d9b7986507e432107d15 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 26 Oct 2019 22:41:06 +0800 Subject: [PATCH] up --- .../legado/app/ui/book/info/BookInfoViewModel.kt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt b/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt index 91e412afb..9cd9ed887 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt @@ -43,12 +43,16 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) { private fun setBook(book: Book) { durChapterIndex = book.durChapterIndex bookData.postValue(book) - val chapterList = App.db.bookChapterDao().getChapterList(book.bookUrl) - if (chapterList.isNotEmpty()) { - chapterListData.postValue(chapterList) - isLoadingData.postValue(false) + if (book.tocUrl.isEmpty()) { + loadBookInfo(book) } else { - loadChapter(book) + val chapterList = App.db.bookChapterDao().getChapterList(book.bookUrl) + if (chapterList.isNotEmpty()) { + chapterListData.postValue(chapterList) + isLoadingData.postValue(false) + } else { + loadChapter(book) + } } }