From 5cef6f8e39f71bed02ac0933034ff063691eee43 Mon Sep 17 00:00:00 2001 From: Horis <821938089@qq.com> Date: Sat, 24 Feb 2024 19:56:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/model/ReadBook.kt | 8 ++++---- .../book/read/page/provider/TextChapterLayout.kt | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/ReadBook.kt b/app/src/main/java/io/legado/app/model/ReadBook.kt index 70143033e..10f6de8f7 100644 --- a/app/src/main/java/io/legado/app/model/ReadBook.kt +++ b/app/src/main/java/io/legado/app/model/ReadBook.kt @@ -232,11 +232,11 @@ object ReadBook : CoroutineScope by MainScope() { nextTextChapter = null if (curTextChapter == null) { AppLog.putDebug("moveToNextChapter-章节未加载,开始加载") - if (upContentInPlace) callBack?.upContent(resetPageOffset = false) + if (upContentInPlace) callBack?.upContent() loadContent(durChapterIndex, upContent, resetPageOffset = false) } else if (upContent && upContentInPlace) { AppLog.putDebug("moveToNextChapter-章节已加载,刷新视图") - callBack?.upContent(resetPageOffset = false) + callBack?.upContent() } loadContent(durChapterIndex.plus(1), upContent, false) saveRead() @@ -263,10 +263,10 @@ object ReadBook : CoroutineScope by MainScope() { curTextChapter = prevTextChapter prevTextChapter = null if (curTextChapter == null) { - if (upContentInPlace) callBack?.upContent(resetPageOffset = false) + if (upContentInPlace) callBack?.upContent() loadContent(durChapterIndex, upContent, resetPageOffset = false) } else if (upContent && upContentInPlace) { - callBack?.upContent(resetPageOffset = false) + callBack?.upContent() } loadContent(durChapterIndex.minus(1), upContent, false) saveRead() diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/provider/TextChapterLayout.kt b/app/src/main/java/io/legado/app/ui/book/read/page/provider/TextChapterLayout.kt index d8a868b85..af21d4721 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/provider/TextChapterLayout.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/provider/TextChapterLayout.kt @@ -336,6 +336,10 @@ class TextChapterLayout( } if (durY + height > visibleHeight) { val textPage = pendingTextPage + // 双页的 durY 不正确,可能会小于实际高度 + if (textPage.height < durY) { + textPage.height = durY + } if (doublePage && absStartX < viewWidth / 2) { //当前页面左列结束 textPage.leftLineSize = textPage.lineSize @@ -352,10 +356,6 @@ class TextChapterLayout( onPageCompleted() pendingTextPage = TextPage() } - // 双页的 durY 不正确,可能会小于实际高度 - if (textPage.height < durY) { - textPage.height = durY - } durY = 0f } } @@ -434,6 +434,9 @@ class TextChapterLayout( val textLine = TextLine(isTitle = isTitle) if (durY + textHeight > visibleHeight) { val textPage = pendingTextPage + if (textPage.height < durY) { + textPage.height = durY + } if (doublePage && absStartX < viewWidth / 2) { //当前页面左列结束 textPage.leftLineSize = textPage.lineSize @@ -452,9 +455,6 @@ class TextChapterLayout( stringBuilder.clear() absStartX = paddingLeft } - if (textPage.height < durY) { - textPage.height = durY - } durY = 0f } val lineStart = layout.getLineStart(lineIndex)