Horis 2 年之前
父節點
當前提交
62924bc00a
共有 1 個文件被更改,包括 2 次插入 和 4 次删除
  1. 2 4
      app/src/main/java/io/legado/app/model/ReadBook.kt

+ 2 - 4
app/src/main/java/io/legado/app/model/ReadBook.kt

@@ -529,8 +529,7 @@ object ReadBook : CoroutineScope by MainScope() {
                 .getContent(book, chapter, content, includeTitle = false)
                 .getContent(book, chapter, content, includeTitle = false)
             val textChapter =
             val textChapter =
                 ChapterProvider.getTextChapterAsync(chapter, displayTitle, contents, chapterSize)
                 ChapterProvider.getTextChapterAsync(chapter, displayTitle, contents, chapterSize)
-            val offset = chapter.index - durChapterIndex
-            when (offset) {
+            when (val offset = chapter.index - durChapterIndex) {
                 0 -> {
                 0 -> {
                     curTextChapter?.cancelLayout()
                     curTextChapter?.cancelLayout()
                     curTextChapter = textChapter
                     curTextChapter = textChapter
@@ -551,8 +550,7 @@ object ReadBook : CoroutineScope by MainScope() {
                                 available = true
                                 available = true
                             }
                             }
                             if (upContent && isScroll) {
                             if (upContent && isScroll) {
-                                val pageIndex = durPageIndex
-                                if (max(index - 3, 0) < pageIndex) {
+                                if (max(index - 3, 0) < durPageIndex) {
                                     callBack?.upContent(offset, resetPageOffset)
                                     callBack?.upContent(offset, resetPageOffset)
                                 }
                                 }
                             }
                             }