diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt index 3a54564ff..ea8aacc3f 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt @@ -415,7 +415,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at if (compareStart >= 0 && compareEnd <= 0) { builder.append(textChar.charData) if ( - textLine.isLastLine + textLine.isParagraphEnd && charIndex == textLine.charSize - 1 && compareEnd != 0 ) { diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt index 808d30761..c96eb6fed 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt @@ -286,7 +286,7 @@ class ReadView(context: Context, attrs: AttributeSet) : var lineEnd = lineIndex for (index in lineIndex - 1 downTo 0) { val textLine = page.getLine(index) - if (textLine.isLastLine) { + if (textLine.isParagraphEnd) { break } else { stringBuilder.insert(0, textLine.text) @@ -298,7 +298,7 @@ class ReadView(context: Context, attrs: AttributeSet) : val textLine = page.getLine(index) stringBuilder.append(textLine.text) lineEnd += 1 - if (textLine.isLastLine) { + if (textLine.isParagraphEnd) { break } } diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextLine.kt b/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextLine.kt index 82c042389..3ec66b3ca 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextLine.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextLine.kt @@ -12,7 +12,7 @@ data class TextLine( var lineBase: Float = 0f, var lineBottom: Float = 0f, val isTitle: Boolean = false, - var isLastLine: Boolean = false, + var isParagraphEnd: Boolean = false, var isReadAloud: Boolean = false, var isImage: Boolean = false ) { diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt b/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt index 443a4633a..9fdfe83a3 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt @@ -128,14 +128,14 @@ data class TextPage( for ((index, textLine) in textLines.withIndex()) { if (aloudSpanStart > lineStart && aloudSpanStart < lineStart + textLine.text.length) { for (i in index - 1 downTo 0) { - if (textLines[i].isLastLine) { + if (textLines[i].isParagraphEnd) { break } else { textLines[i].isReadAloud = true } } for (i in index until textLines.size) { - if (textLines[i].isLastLine) { + if (textLines[i].isParagraphEnd) { textLines[i].isReadAloud = true break } else { diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt index 0f1742b45..da115377f 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt @@ -347,7 +347,7 @@ object ChapterProvider { lineIndex == layout.lineCount - 1 -> { //最后一行 textLine.text = words - textLine.isLastLine = true + textLine.isParagraphEnd = true //标题x轴居中 val startX = if (isTitle && ReadBookConfig.titleMode == 1 || isTitleWithNoContent || isVolumeTitle) @@ -377,7 +377,7 @@ object ChapterProvider { } } stringBuilder.append(words) - if (textLine.isLastLine) { + if (textLine.isParagraphEnd) { stringBuilder.append("\n") } textPages.last().textLines.add(textLine)