Horis 2 лет назад
Родитель
Сommit
7c3c1acf7f

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

@@ -201,7 +201,7 @@ object ReadBook : CoroutineScope by MainScope() {
             val nextPagePos = it.getNextPageLength(durChapterPos)
             if (nextPagePos >= 0) {
                 hasNextPage = true
-                curTextChapter?.getPage(durPageIndex)?.removePageAloudSpan()
+                it.getPage(durPageIndex)?.removePageAloudSpan()
                 durChapterPos = nextPagePos
                 callBack?.upContent()
                 saveRead(true)

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

@@ -60,6 +60,9 @@ data class TextLine(
             if (field != value) {
                 invalidate()
             }
+            if (value) {
+                textPage.hasReadAloudSpan = true
+            }
             field = value
         }
     var textPage: TextPage = emptyTextPage

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

@@ -50,6 +50,7 @@ data class TextPage(
     var doublePage = false
     var paddingTop = ChapterProvider.paddingTop
     var isCompleted = false
+    var hasReadAloudSpan = false
 
     @JvmField
     var textChapter = emptyTextChapter
@@ -178,6 +179,10 @@ data class TextPage(
      * 移除朗读标志
      */
     fun removePageAloudSpan(): TextPage {
+        if (!hasReadAloudSpan) {
+            return this
+        }
+        hasReadAloudSpan = false
         for (i in textLines.indices) {
             textLines[i].isReadAloud = false
         }