|
|
@ -49,10 +49,6 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
private fun initBook(book: Book) { |
|
|
|
private fun initBook(book: Book) { |
|
|
|
if (ReadBook.book?.bookUrl != book.bookUrl) { |
|
|
|
if (ReadBook.book?.bookUrl != book.bookUrl) { |
|
|
|
ReadBook.resetData(book) |
|
|
|
ReadBook.resetData(book) |
|
|
|
if (!book.isLocalBook() && ReadBook.bookSource == null) { |
|
|
|
|
|
|
|
autoChangeSource(book.name, book.author) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
isInitFinish = true |
|
|
|
isInitFinish = true |
|
|
|
if (ReadBook.chapterSize == 0) { |
|
|
|
if (ReadBook.chapterSize == 0) { |
|
|
|
if (book.tocUrl.isEmpty()) { |
|
|
|
if (book.tocUrl.isEmpty()) { |
|
|
@ -77,10 +73,6 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
ReadBook.titleDate.postValue(book.name) |
|
|
|
ReadBook.titleDate.postValue(book.name) |
|
|
|
ReadBook.upWebBook(book) |
|
|
|
ReadBook.upWebBook(book) |
|
|
|
isInitFinish = true |
|
|
|
isInitFinish = true |
|
|
|
if (!book.isLocalBook() && ReadBook.bookSource == null) { |
|
|
|
|
|
|
|
autoChangeSource(book.name, book.author) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ReadBook.chapterSize = appDb.bookChapterDao.getChapterCount(book.bookUrl) |
|
|
|
ReadBook.chapterSize = appDb.bookChapterDao.getChapterCount(book.bookUrl) |
|
|
|
if (ReadBook.chapterSize == 0) { |
|
|
|
if (ReadBook.chapterSize == 0) { |
|
|
|
if (book.tocUrl.isEmpty()) { |
|
|
|
if (book.tocUrl.isEmpty()) { |
|
|
@ -99,6 +91,10 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
syncBookProgress(book) |
|
|
|
syncBookProgress(book) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!book.isLocalBook() && ReadBook.bookSource == null) { |
|
|
|
|
|
|
|
autoChangeSource(book.name, book.author) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun loadBookInfo(book: Book) { |
|
|
|
private fun loadBookInfo(book: Book) { |
|
|
|