Horis před 2 roky
rodič
revize
8637d0ee1f

+ 0 - 3
app/src/main/java/io/legado/app/model/ReadBook.kt

@@ -216,7 +216,6 @@ object ReadBook : CoroutineScope by MainScope() {
             durChapterPos = 0
             durChapterPos = 0
             durChapterIndex++
             durChapterIndex++
             prevTextChapter?.cancelLayout()
             prevTextChapter?.cancelLayout()
-            curTextChapter?.setProgressListener(null)
             prevTextChapter = curTextChapter
             prevTextChapter = curTextChapter
             curTextChapter = nextTextChapter
             curTextChapter = nextTextChapter
             nextTextChapter = null
             nextTextChapter = null
@@ -250,7 +249,6 @@ object ReadBook : CoroutineScope by MainScope() {
             durChapterPos = if (toLast) prevTextChapter?.lastReadLength ?: Int.MAX_VALUE else 0
             durChapterPos = if (toLast) prevTextChapter?.lastReadLength ?: Int.MAX_VALUE else 0
             durChapterIndex--
             durChapterIndex--
             nextTextChapter?.cancelLayout()
             nextTextChapter?.cancelLayout()
-            curTextChapter?.setProgressListener(null)
             nextTextChapter = curTextChapter
             nextTextChapter = curTextChapter
             curTextChapter = prevTextChapter
             curTextChapter = prevTextChapter
             prevTextChapter = null
             prevTextChapter = null
@@ -493,7 +491,6 @@ object ReadBook : CoroutineScope by MainScope() {
             when (val offset = chapter.index - durChapterIndex) {
             when (val offset = chapter.index - durChapterIndex) {
                 0 -> {
                 0 -> {
                     curTextChapter?.cancelLayout()
                     curTextChapter?.cancelLayout()
-                    curTextChapter?.setProgressListener(null)
                     curTextChapter = textChapter
                     curTextChapter = textChapter
                     if (resetPageOffset) {
                     if (resetPageOffset) {
                         callBack?.resetPageOffset()
                         callBack?.resetPageOffset()

+ 1 - 0
app/src/main/java/io/legado/app/ui/book/read/page/entities/TextChapter.kt

@@ -295,6 +295,7 @@ data class TextChapter(
     fun cancelLayout() {
     fun cancelLayout() {
         layout?.cancel()
         layout?.cancel()
         isCompleted = true
         isCompleted = true
+        listener = null
     }
     }
 
 
     companion object {
     companion object {

+ 1 - 0
app/src/main/java/io/legado/app/ui/book/read/page/provider/TextChapterLayout.kt

@@ -107,6 +107,7 @@ class TextChapterLayout(
 
 
     fun cancel() {
     fun cancel() {
         job.cancel()
         job.cancel()
+        listener = null
     }
     }
 
 
     private fun onPageCompleted() {
     private fun onPageCompleted() {