|
|
@ -124,22 +124,23 @@ object ChapterProvider { |
|
|
|
addCharsToLineMiddle(textLine, words, textPaint, desiredWidth, 0f) |
|
|
|
addCharsToLineMiddle(textLine, words, textPaint, desiredWidth, 0f) |
|
|
|
} |
|
|
|
} |
|
|
|
if (durY + textPaint.textHeight < visibleHeight) { |
|
|
|
if (durY + textPaint.textHeight < visibleHeight) { |
|
|
|
|
|
|
|
//当前页面新增行 |
|
|
|
textLine.upTopBottom(durY, textPaint) |
|
|
|
textLine.upTopBottom(durY, textPaint) |
|
|
|
textPages.last().textLines.add(textLine) |
|
|
|
textPages.last().textLines.add(textLine) |
|
|
|
durY += textPaint.textHeight * lineSpacingExtra / 10f |
|
|
|
durY += textPaint.textHeight * lineSpacingExtra / 10f |
|
|
|
textPages.last().height = durY |
|
|
|
textPages.last().height = durY |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
//当前页面结束,设置各种值 |
|
|
|
textPages.last().text = stringBuilder.toString() |
|
|
|
textPages.last().text = stringBuilder.toString() |
|
|
|
stringBuilder.clear() |
|
|
|
stringBuilder.clear() |
|
|
|
pageLines.add(textPages.last().textLines.size) |
|
|
|
pageLines.add(textPages.last().textLines.size) |
|
|
|
pageLengths.add(textPages.last().text.length) |
|
|
|
pageLengths.add(textPages.last().text.length) |
|
|
|
textPages.last().height = durY |
|
|
|
textPages.last().height = durY |
|
|
|
//新建页面 |
|
|
|
//新建页面 |
|
|
|
durY = 0f |
|
|
|
|
|
|
|
textLine.upTopBottom(durY, textPaint) |
|
|
|
|
|
|
|
durY = textPaint.textHeight * lineSpacingExtra / 10f |
|
|
|
|
|
|
|
textPages.add(TextPage()) |
|
|
|
textPages.add(TextPage()) |
|
|
|
|
|
|
|
textLine.upTopBottom(0f, textPaint) |
|
|
|
textPages.last().textLines.add(textLine) |
|
|
|
textPages.last().textLines.add(textLine) |
|
|
|
|
|
|
|
durY = textPaint.textHeight * lineSpacingExtra / 10f |
|
|
|
textPages.last().height = durY |
|
|
|
textPages.last().height = durY |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|