From da5fa596e33f07e242f6ba14d2ee10ade8524ff8 Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 20 Feb 2020 22:34:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/read/page/entities/TextPage.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 356199690..ef7c9c9f0 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 @@ -24,8 +24,13 @@ data class TextPage( fun upPageAloudSpan(pageStart: Int) { if (text is SpannableStringBuilder) { removePageAloudSpan() + var lineStart = 0 for (textLine in textLines) { - + if (pageStart > lineStart && pageStart < lineStart + textLine.text.length) { + textLine.isReadAloud = true + break + } + lineStart += textLine.text.length } } }