From 00a42a05ef172142d841b2d0fd49fbed312b9758 Mon Sep 17 00:00:00 2001 From: Horis <821938089@qq.com> Date: Thu, 22 Feb 2024 17:15:55 +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 | 3 --- .../io/legado/app/ui/book/read/page/entities/TextChapter.kt | 1 + .../legado/app/ui/book/read/page/provider/TextChapterLayout.kt | 1 + 3 files changed, 2 insertions(+), 3 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 e5af2b870..f0b144b27 100644 --- a/app/src/main/java/io/legado/app/model/ReadBook.kt +++ b/app/src/main/java/io/legado/app/model/ReadBook.kt @@ -216,7 +216,6 @@ object ReadBook : CoroutineScope by MainScope() { durChapterPos = 0 durChapterIndex++ prevTextChapter?.cancelLayout() - curTextChapter?.setProgressListener(null) prevTextChapter = curTextChapter curTextChapter = nextTextChapter nextTextChapter = null @@ -250,7 +249,6 @@ object ReadBook : CoroutineScope by MainScope() { durChapterPos = if (toLast) prevTextChapter?.lastReadLength ?: Int.MAX_VALUE else 0 durChapterIndex-- nextTextChapter?.cancelLayout() - curTextChapter?.setProgressListener(null) nextTextChapter = curTextChapter curTextChapter = prevTextChapter prevTextChapter = null @@ -493,7 +491,6 @@ object ReadBook : CoroutineScope by MainScope() { when (val offset = chapter.index - durChapterIndex) { 0 -> { curTextChapter?.cancelLayout() - curTextChapter?.setProgressListener(null) curTextChapter = textChapter if (resetPageOffset) { callBack?.resetPageOffset() diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextChapter.kt b/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextChapter.kt index 2a5ab7765..6779eca4c 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextChapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextChapter.kt @@ -295,6 +295,7 @@ data class TextChapter( fun cancelLayout() { layout?.cancel() isCompleted = true + listener = null } companion object { 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 3a2f4f486..0cb676946 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 @@ -107,6 +107,7 @@ class TextChapterLayout( fun cancel() { job.cancel() + listener = null } private fun onPageCompleted() {