From f77fe68745642f90087f46693a45e99c1b2422ca Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 22 Feb 2020 20:42:52 +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 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 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 a48778686..293790152 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 @@ -111,6 +111,7 @@ object ChapterProvider { durY = joinBody(text, durY, textPages, pageLines, pageLengths, stringBuilder) } } + textPages.last().height = durY textPages.last().text = stringBuilder.toString() if (pageLines.size < textPages.size) { pageLines.add(textPages.last().textLines.size) @@ -158,11 +159,13 @@ object ChapterProvider { if (durY < visibleHeight) { textPages.last().textLines.add(textLine) } else { - durY = layout.getLineBottom(lineIndex) - layout.getLineTop(lineIndex) + textPages.last().height = durY textPages.last().text = stringBuilder.toString() stringBuilder.clear() pageLines.add(textPages.last().textLines.size) pageLengths.add(textPages.last().text.length) + //新页面 + durY = layout.getLineBottom(lineIndex) - layout.getLineTop(lineIndex) textPages.add(TextPage()) textPages.last().textLines.add(textLine) } @@ -238,11 +241,13 @@ object ChapterProvider { if (durY < visibleHeight) { textPages.last().textLines.add(textLine) } else { - durY = layout.getLineBottom(lineIndex) - layout.getLineTop(lineIndex) + textPages.last().height = durY textPages.last().text = stringBuilder.toString() stringBuilder.clear() pageLines.add(textPages.last().textLines.size) pageLengths.add(textPages.last().text.length) + //新页面 + durY = layout.getLineBottom(lineIndex) - layout.getLineTop(lineIndex) textPages.add(TextPage()) textPages.last().textLines.add(textLine) }