pull/1514/head 3.22.011020
gedoor 3 years ago
parent 95e0d64061
commit f94ce733b2
  1. 7
      app/src/main/java/io/legado/app/model/ReadBook.kt
  2. 2
      app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt

@ -90,17 +90,16 @@ object ReadBook : CoroutineScope by MainScope() {
}
fun setProgress(progress: BookProgress) {
if (durChapterIndex != progress.durChapterIndex
|| durChapterPos != progress.durChapterPos
if (progress.durChapterIndex > chapterSize &&
(durChapterIndex != progress.durChapterIndex
|| durChapterPos != progress.durChapterPos)
) {
if (progress.durChapterIndex > chapterSize) {
durChapterIndex = progress.durChapterIndex
durChapterPos = progress.durChapterPos
clearTextChapter()
loadContent(resetPageOffset = true)
}
}
}
fun clearTextChapter() {
prevTextChapter = null

@ -220,6 +220,7 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
}
fun openChapter(index: Int, durChapterPos: Int = 0, success: (() -> Unit)? = null) {
if (index < ReadBook.chapterSize) {
ReadBook.clearTextChapter()
ReadBook.callBack?.upContent()
if (index != ReadBook.durChapterIndex) {
@ -231,6 +232,7 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
success?.invoke()
}
}
}
fun removeFromBookshelf(success: (() -> Unit)?) {
execute {

Loading…
Cancel
Save