From bf27baccd1c0ff45a5fdf67e78ff3e17ac926f1b Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 21 Apr 2020 20:26:36 +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 --- app/src/main/java/io/legado/app/help/BookHelp.kt | 1 + .../java/io/legado/app/service/BaseReadAloudService.kt | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/BookHelp.kt b/app/src/main/java/io/legado/app/help/BookHelp.kt index 514c5327c..a56f48168 100644 --- a/app/src/main/java/io/legado/app/help/BookHelp.kt +++ b/app/src/main/java/io/legado/app/help/BookHelp.kt @@ -243,5 +243,6 @@ object BookHelp { } return c .replace("\\s*\\n+\\s*".toRegex(), "\n${ReadBookConfig.bodyIndent}") + .replace("[\\n\\s]+$".toRegex(), "") //移除尾部空行 } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt b/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt index 1a4de9e6f..399c1a24c 100644 --- a/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt @@ -111,16 +111,12 @@ abstract class BaseReadAloudService : BaseService(), if (getPrefBoolean(PreferKey.readAloudByPage)) { for (index in pageIndex..textChapter.lastIndex()) { textChapter.page(index)?.text?.split("\n")?.let { - if (it.isNotEmpty()) { - contentList.addAll(it) - } + contentList.addAll(it) } } } else { textChapter.getUnRead(pageIndex).split("\n").forEach { - if (it.isNotEmpty()) { - contentList.add(it) - } + contentList.add(it) } } if (play) play()