From 37fca1fa83c58efb2939025660448b7e583af9dd Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 6 Mar 2020 08:23:42 +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 --- .../app/ui/book/read/page/ChapterProvider.kt | 24 ++++--------------- 1 file changed, 5 insertions(+), 19 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 0c7ab0e7f..20da95a33 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 @@ -51,31 +51,17 @@ object ChapterProvider { val pageLines = arrayListOf() val pageLengths = arrayListOf() val stringBuilder = StringBuilder() - var surplusText = content + val contents = content.split("\n") var durY = 0f textPages.add(TextPage()) - while (surplusText.isNotEmpty()) { - if (textPages.first().textLines.isEmpty()) { - //title - val end = surplusText.indexOf("\n") - if (end > 0) { - val title = surplusText.substring(0, end) - surplusText = surplusText.substring(end + 1) + for ((index, text) in contents.withIndex()) { + if (index == 0) { + if (ReadBookConfig.titleMode != 2) { durY = setTypeText( - title, durY, textPages, pageLines, pageLengths, stringBuilder, true + text, durY, textPages, pageLines, pageLengths, stringBuilder, true ) } } else { - //正文 - val end = surplusText.indexOf("\n") - val text: String - if (end >= 0) { - text = surplusText.substring(0, end) - surplusText = surplusText.substring(end + 1) - } else { - text = surplusText - surplusText = "" - } durY = setTypeText(text, durY, textPages, pageLines, pageLengths, stringBuilder, false) }