pull/32/head
kunfei 5 years ago
parent f8b09dbdde
commit 69dcb55112
  1. 5
      app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt

@ -42,6 +42,7 @@ 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
@ -235,9 +236,9 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
chapterListFinish.postValue(true) chapterListFinish.postValue(true)
} }
fun saveRead() { fun saveRead(book: Book? = bookData.value) {
execute { execute {
bookData.value?.let { book -> book?.let { book ->
book.lastCheckCount = 0 book.lastCheckCount = 0
book.durChapterTime = System.currentTimeMillis() book.durChapterTime = System.currentTimeMillis()
book.durChapterIndex = durChapterIndex book.durChapterIndex = durChapterIndex

Loading…
Cancel
Save