pull/1814/head
kunfei 3 years ago
parent 379dc79c62
commit 45d55a1b2d
  1. 2
      app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt
  2. 4
      app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt
  3. 2
      app/src/main/java/io/legado/app/ui/book/read/page/entities/TextLine.kt
  4. 4
      app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt
  5. 4
      app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.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
) {

@ -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
}
}

@ -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
) {

@ -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 {

@ -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)

Loading…
Cancel
Save