This commit is contained in:
kunfei
2022-04-16 20:09:55 +08:00
parent 451b447208
commit 2035fcf856
2 changed files with 5 additions and 3 deletions
@@ -128,14 +128,14 @@ data class TextPage(
for ((index, textLine) in textLines.withIndex()) { for ((index, textLine) in textLines.withIndex()) {
if (aloudSpanStart > lineStart && aloudSpanStart < lineStart + textLine.text.length) { if (aloudSpanStart > lineStart && aloudSpanStart < lineStart + textLine.text.length) {
for (i in index - 1 downTo 0) { for (i in index - 1 downTo 0) {
if (textLines[i].text.endsWith("\n")) { if (textLines[i].isLastLine) {
break break
} else { } else {
textLines[i].isReadAloud = true textLines[i].isReadAloud = true
} }
} }
for (i in index until textLines.size) { for (i in index until textLines.size) {
if (textLines[i].text.endsWith("\n")) { if (textLines[i].isLastLine) {
textLines[i].isReadAloud = true textLines[i].isReadAloud = true
break break
} else { } else {
@@ -377,7 +377,9 @@ object ChapterProvider {
} }
} }
stringBuilder.append(words) stringBuilder.append(words)
if (textLine.isLastLine) stringBuilder.append("\n") if (textLine.isLastLine) {
stringBuilder.append("\n")
}
textPages.last().textLines.add(textLine) textPages.last().textLines.add(textLine)
textLine.upTopBottom(durY, textPaint) textLine.upTopBottom(durY, textPaint)
durY += textPaint.textHeight * lineSpacingExtra durY += textPaint.textHeight * lineSpacingExtra