|
|
@ -42,7 +42,6 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
App.db.bookDao().lastReadBook |
|
|
|
App.db.bookDao().lastReadBook |
|
|
|
} |
|
|
|
} |
|
|
|
saveRead(book) |
|
|
|
|
|
|
|
book?.let { |
|
|
|
book?.let { |
|
|
|
durChapterIndex = book.durChapterIndex |
|
|
|
durChapterIndex = book.durChapterIndex |
|
|
|
durPageIndex = book.durChapterPos |
|
|
|
durPageIndex = book.durChapterPos |
|
|
@ -66,6 +65,7 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
chapterListFinish.postValue(true) |
|
|
|
chapterListFinish.postValue(true) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
saveRead(book) |
|
|
|
}.onError { it.printStackTrace() } |
|
|
|
}.onError { it.printStackTrace() } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -225,6 +225,10 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
bookData.value?.let { |
|
|
|
bookData.value?.let { |
|
|
|
App.db.bookDao().delete(it.bookUrl) |
|
|
|
App.db.bookDao().delete(it.bookUrl) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
prevTextChapter = null |
|
|
|
|
|
|
|
curTextChapter = null |
|
|
|
|
|
|
|
nextTextChapter = null |
|
|
|
|
|
|
|
callBack?.upContent() |
|
|
|
App.db.bookDao().insert(book) |
|
|
|
App.db.bookDao().insert(book) |
|
|
|
bookData.postValue(book) |
|
|
|
bookData.postValue(book) |
|
|
|
App.db.bookSourceDao().getBookSource(book.origin)?.let { |
|
|
|
App.db.bookSourceDao().getBookSource(book.origin)?.let { |
|
|
@ -321,5 +325,6 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
|
|
|
|
|
|
|
|
interface CallBack { |
|
|
|
interface CallBack { |
|
|
|
fun contentLoadFinish(bookChapter: BookChapter, content: String) |
|
|
|
fun contentLoadFinish(bookChapter: BookChapter, content: String) |
|
|
|
|
|
|
|
fun upContent() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |