feat: 优化代码

pull/133/head
kunfei 5 years ago
parent 9d3e6b4e93
commit d3e4352b5c
  1. 14
      app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt

@ -61,13 +61,7 @@ object ChapterProvider {
val title = surplusText.substring(0, end)
surplusText = surplusText.substring(end + 1)
durY = setTypeText(
title,
durY,
textPages,
pageLines,
pageLengths,
stringBuilder,
true
title, durY, textPages, pageLines, pageLengths, stringBuilder, true
)
}
} else {
@ -145,9 +139,9 @@ object ChapterProvider {
textPages.add(TextPage())
textPages.last().textLines.add(textLine)
}
textLine.lineTop = paddingTop + durY - textPaint.textHeight
textLine.lineBase = paddingTop + durY - textPaint.fontMetrics.descent
textLine.lineBottom = paddingTop + durY
textLine.lineBottom = paddingTop + durY - lineSpacingExtra
textLine.lineBase = textLine.lineBottom - textPaint.fontMetrics.descent
textLine.lineTop = textLine.lineBottom - textPaint.textHeight
val words =
text.substring(layout.getLineStart(lineIndex), layout.getLineEnd(lineIndex))
stringBuilder.append(words)

Loading…
Cancel
Save