From 3cb286c5b243a33c8de9239a5bdcdce2179c381a Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 23 Apr 2020 22:04:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/ui/book/read/page/ChapterProvider.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 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 61d5a438f..164d9fdc4 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 @@ -53,13 +53,14 @@ object ChapterProvider { val stringBuilder = StringBuilder() var durY = 0f textPages.add(TextPage()) - for ((index, text) in contents.withIndex()) { + contents.forEachIndexed { index, text -> val isTitle = index == 0 - if (isTitle && ReadBookConfig.titleMode == 2) { - continue + if (!(isTitle && ReadBookConfig.titleMode == 2)) { + durY = setTypeText( + text, durY, textPages, pageLines, + pageLengths, stringBuilder, isTitle + ) } - durY = - setTypeText(text, durY, textPages, pageLines, pageLengths, stringBuilder, isTitle) } textPages.last().height = durY + 20.dp textPages.last().text = stringBuilder.toString() @@ -69,7 +70,7 @@ object ChapterProvider { if (pageLengths.size < textPages.size) { pageLengths.add(textPages.last().text.length) } - for ((index, item) in textPages.withIndex()) { + textPages.forEachIndexed { index, item -> item.index = index item.pageSize = textPages.size item.chapterIndex = bookChapter.index