From 324e72ccfd29815e949b01aff8c04d4fb6a19d3a Mon Sep 17 00:00:00 2001 From: bushixuanqi <57338301+bushixuanqi@users.noreply.github.com> Date: Sun, 18 Jul 2021 14:21:57 +0800 Subject: [PATCH] Update BookContent.kt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化 --- .../main/java/io/legado/app/model/webBook/BookContent.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/webBook/BookContent.kt b/app/src/main/java/io/legado/app/model/webBook/BookContent.kt index 364fa06df..1d71effc6 100644 --- a/app/src/main/java/io/legado/app/model/webBook/BookContent.kt +++ b/app/src/main/java/io/legado/app/model/webBook/BookContent.kt @@ -52,7 +52,7 @@ object BookContent { var contentData = analyzeContent( book, baseUrl, redirectUrl, body, contentRule, bookChapter, bookSource, mNextChapterUrl ) - content.append(contentData.content).append("\n") + content.append(contentData.content) if (contentData.nextUrl.size == 1) { var nextUrl = contentData.nextUrl[0] while (nextUrl.isNotEmpty() && !nextUrlList.contains(nextUrl)) { @@ -74,7 +74,7 @@ object BookContent { ) nextUrl = if (contentData.nextUrl.isNotEmpty()) contentData.nextUrl[0] else "" - content.append(contentData.content).append("\n") + content.append("\n").append(contentData.content) } } Debug.log(bookSource.bookSourceUrl, "◇本章总页数:${nextUrlList.size}") @@ -98,11 +98,10 @@ object BookContent { } asyncArray.forEach { coroutine -> scope.ensureActive() - content.append(coroutine.await()).append("\n") + content.append("\n").append(coroutine.await()) } } } - content.deleteCharAt(content.length - 1) var contentStr = content.toString() val replaceRegex = contentRule.replaceRegex if (!replaceRegex.isNullOrEmpty()) {