From 45d55a1b2d160364b02cb9614d509bb282557aad Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 16 Apr 2022 22:13:45 +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 --- .../java/io/legado/app/ui/book/read/page/ContentTextView.kt | 2 +- app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt | 4 ++-- .../java/io/legado/app/ui/book/read/page/entities/TextLine.kt | 2 +- .../java/io/legado/app/ui/book/read/page/entities/TextPage.kt | 4 ++-- .../legado/app/ui/book/read/page/provider/ChapterProvider.kt | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) 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)