From e1a2f059c328ff0c0bfffb85fe986e03f8a830b3 Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 6 Mar 2020 11:16:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/read/page/ChapterProvider.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt index 36dc4b5f6..533876633 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt @@ -124,22 +124,23 @@ object ChapterProvider { addCharsToLineMiddle(textLine, words, textPaint, desiredWidth, 0f) } if (durY + textPaint.textHeight < visibleHeight) { + //当前页面新增行 textLine.upTopBottom(durY, textPaint) textPages.last().textLines.add(textLine) durY += textPaint.textHeight * lineSpacingExtra / 10f textPages.last().height = durY } else { + //当前页面结束,设置各种值 textPages.last().text = stringBuilder.toString() stringBuilder.clear() pageLines.add(textPages.last().textLines.size) pageLengths.add(textPages.last().text.length) textPages.last().height = durY //新建页面 - durY = 0f - textLine.upTopBottom(durY, textPaint) - durY = textPaint.textHeight * lineSpacingExtra / 10f textPages.add(TextPage()) + textLine.upTopBottom(0f, textPaint) textPages.last().textLines.add(textLine) + durY = textPaint.textHeight * lineSpacingExtra / 10f textPages.last().height = durY } }