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

Loading…
Cancel
Save