From d8aa4217c72a4f8b5b3a9f88098d838b59e4bc3d Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 8 Aug 2020 09:45:57 +0800 Subject: [PATCH] =?UTF-8?q?=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/model/webBook/BookList.kt | 4 ++-- .../java/io/legado/app/ui/widget/prefs/ColorPreference.kt | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) 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 8c988f081..3ee11d28a 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 @@ -139,7 +139,7 @@ object BookList { } if (!scope.isActive) throw CancellationException() Debug.log(bookSource.bookSourceUrl, "┌获取书名") - searchBook.name = analyzeRule.getString(name) + searchBook.name = analyzeRule.getString(name).trim { it <= ' ' } Debug.log(bookSource.bookSourceUrl, "└${searchBook.name}") if (searchBook.name.isNotEmpty()) { if (!scope.isActive) throw CancellationException() @@ -199,7 +199,7 @@ object BookList { analyzeRule.setContent(item) if (!scope.isActive) throw CancellationException() Debug.log(bookSource.bookSourceUrl, "┌获取书名", log) - searchBook.name = analyzeRule.getString(ruleName) + searchBook.name = analyzeRule.getString(ruleName).trim { it <= ' ' } Debug.log(bookSource.bookSourceUrl, "└${searchBook.name}", log) if (searchBook.name.isNotEmpty()) { if (!scope.isActive) throw CancellationException() diff --git a/app/src/main/java/io/legado/app/ui/widget/prefs/ColorPreference.kt b/app/src/main/java/io/legado/app/ui/widget/prefs/ColorPreference.kt index 0ea45510f..ec4176867 100644 --- a/app/src/main/java/io/legado/app/ui/widget/prefs/ColorPreference.kt +++ b/app/src/main/java/io/legado/app/ui/widget/prefs/ColorPreference.kt @@ -19,6 +19,8 @@ import io.legado.app.lib.theme.ColorUtils class ColorPreference(context: Context, attrs: AttributeSet) : Preference(context, attrs), ColorPickerDialogListener { + var onSaveColor: ((color: Int) -> Boolean)? = null + private val sizeNormal = 0 private val sizeLarge = 1 @@ -140,6 +142,9 @@ class ColorPreference(context: Context, attrs: AttributeSet) : Preference(contex } override fun onColorSelected(dialogId: Int, @ColorInt color: Int) { + if (onSaveColor?.invoke(color) == true) { + return + } saveValue(color) }