|
|
@ -40,8 +40,10 @@ 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) { name, author -> |
|
|
|
ReadBook.resetData(book) |
|
|
|
autoChangeSource(name, author) |
|
|
|
if (ReadBook.webBook == null) { |
|
|
|
|
|
|
|
autoChangeSource(book.name, book.author) |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
isInitFinish = true |
|
|
|
isInitFinish = true |
|
|
|
ReadBook.chapterSize = App.db.bookChapterDao().getChapterCount(book.bookUrl) |
|
|
|
ReadBook.chapterSize = App.db.bookChapterDao().getChapterCount(book.bookUrl) |
|
|
@ -63,8 +65,10 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
isInitFinish = true |
|
|
|
isInitFinish = true |
|
|
|
ReadBook.titleDate.postValue(book.name) |
|
|
|
ReadBook.titleDate.postValue(book.name) |
|
|
|
ReadBook.upWebBook(book) { name, author -> |
|
|
|
ReadBook.upWebBook(book) |
|
|
|
autoChangeSource(name, author) |
|
|
|
if (ReadBook.webBook == null) { |
|
|
|
|
|
|
|
autoChangeSource(book.name, book.author) |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
ReadBook.chapterSize = App.db.bookChapterDao().getChapterCount(book.bookUrl) |
|
|
|
ReadBook.chapterSize = App.db.bookChapterDao().getChapterCount(book.bookUrl) |
|
|
|
if (ReadBook.chapterSize == 0) { |
|
|
|
if (ReadBook.chapterSize == 0) { |
|
|
|