From 9485d06bc55d9130c5f43e2267a154212fb0911e Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 11 Feb 2020 10:34:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8D=A2=E6=BA=90=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/model/analyzeRule/AnalyzeByJSonPath.kt | 2 +- .../java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt | 5 ++++- .../java/io/legado/app/model/analyzeRule/AnalyzeByXPath.kt | 2 +- .../main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt | 4 ++-- app/src/main/java/io/legado/app/model/webBook/BookList.kt | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSonPath.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSonPath.kt index 84b5045e7..e7360da7e 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSonPath.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSonPath.kt @@ -72,7 +72,7 @@ class AnalyzeByJSonPath { } } } - return TextUtils.join(",", textList) + return textList.joinToString("\n") } } diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt index 63c5eb27a..cf11dbb72 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt @@ -51,7 +51,10 @@ class AnalyzeByJSoup { val textS = getStringList(ruleStr) return if (textS.isEmpty()) { null - } else join("\n", textS).trim { it <= ' ' } + } else { + textS.joinToString("\n") + } + } /** diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByXPath.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByXPath.kt index f2745ee69..707ab9a22 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByXPath.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByXPath.kt @@ -181,7 +181,7 @@ class AnalyzeByXPath { } } } - return TextUtils.join(",", textList) + return textList.joinToString("\n") } } } diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt index 3aa920237..e168cb241 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt @@ -108,8 +108,8 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions { */ @Throws(Exception::class) @JvmOverloads - fun getStringList(rule: String, isUrl: Boolean = false): List? { - if (TextUtils.isEmpty(rule)) return null + fun getStringList(rule: String?, isUrl: Boolean = false): List? { + if (rule.isNullOrEmpty()) return null val ruleList = splitSourceRule(rule) return getStringList(ruleList, isUrl) } diff --git a/app/src/main/java/io/legado/app/model/webBook/BookList.kt b/app/src/main/java/io/legado/app/model/webBook/BookList.kt index 56f511815..ffb338655 100644 --- a/app/src/main/java/io/legado/app/model/webBook/BookList.kt +++ b/app/src/main/java/io/legado/app/model/webBook/BookList.kt @@ -120,7 +120,7 @@ object BookList { searchBook.author = BookHelp.formatAuthor(analyzeRule.getString(author)) Debug.log(bookSource.bookSourceUrl, "└${searchBook.author}") Debug.log(bookSource.bookSourceUrl, "┌获取分类") - searchBook.kind = analyzeRule.getString(kind) + searchBook.kind = analyzeRule.getStringList(kind)?.joinToString(",") Debug.log(bookSource.bookSourceUrl, "└${searchBook.kind}") Debug.log(bookSource.bookSourceUrl, "┌获取字数") searchBook.wordCount = analyzeRule.getString(wordCount)