修复从详情页目录打开章节内容不对的bug

pull/349/head
gedoor 4 years ago
parent 4a359c48a8
commit 6f22da2c41
  1. 11
      app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt

@ -64,10 +64,17 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
ReadBook.loadContent(resetPageOffset = true) ReadBook.loadContent(resetPageOffset = true)
} }
} else { } else {
isInitFinish = true if (ReadBook.durChapterIndex != book.durChapterIndex) {
ReadBook.durChapterIndex = book.durChapterIndex
ReadBook.durPageIndex = book.durChapterPos
ReadBook.prevTextChapter = null
ReadBook.curTextChapter = null
ReadBook.nextTextChapter = null
}
ReadBook.book!!.group = book.group ReadBook.book!!.group = book.group
ReadBook.titleDate.postValue(book.name) ReadBook.titleDate.postValue(book.name)
ReadBook.upWebBook(book) ReadBook.upWebBook(book)
isInitFinish = true
if (!book.isLocalBook() && ReadBook.webBook == null) { if (!book.isLocalBook() && ReadBook.webBook == null) {
autoChangeSource(book.name, book.author) autoChangeSource(book.name, book.author)
return return
@ -82,6 +89,8 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
} else { } else {
if (ReadBook.curTextChapter != null) { if (ReadBook.curTextChapter != null) {
ReadBook.callBack?.upContent(resetPageOffset = false) ReadBook.callBack?.upContent(resetPageOffset = false)
} else {
ReadBook.loadContent(resetPageOffset = true)
} }
} }
} }

Loading…
Cancel
Save