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) }