pull/298/head
gedoor 4 years ago
parent febe6c9207
commit d8aa4217c7
  1. 4
      app/src/main/java/io/legado/app/model/webBook/BookList.kt
  2. 5
      app/src/main/java/io/legado/app/ui/widget/prefs/ColorPreference.kt

@ -139,7 +139,7 @@ object BookList {
} }
if (!scope.isActive) throw CancellationException() if (!scope.isActive) throw CancellationException()
Debug.log(bookSource.bookSourceUrl, "┌获取书名") Debug.log(bookSource.bookSourceUrl, "┌获取书名")
searchBook.name = analyzeRule.getString(name) searchBook.name = analyzeRule.getString(name).trim { it <= ' ' }
Debug.log(bookSource.bookSourceUrl, "${searchBook.name}") Debug.log(bookSource.bookSourceUrl, "${searchBook.name}")
if (searchBook.name.isNotEmpty()) { if (searchBook.name.isNotEmpty()) {
if (!scope.isActive) throw CancellationException() if (!scope.isActive) throw CancellationException()
@ -199,7 +199,7 @@ object BookList {
analyzeRule.setContent(item) analyzeRule.setContent(item)
if (!scope.isActive) throw CancellationException() if (!scope.isActive) throw CancellationException()
Debug.log(bookSource.bookSourceUrl, "┌获取书名", log) Debug.log(bookSource.bookSourceUrl, "┌获取书名", log)
searchBook.name = analyzeRule.getString(ruleName) searchBook.name = analyzeRule.getString(ruleName).trim { it <= ' ' }
Debug.log(bookSource.bookSourceUrl, "${searchBook.name}", log) Debug.log(bookSource.bookSourceUrl, "${searchBook.name}", log)
if (searchBook.name.isNotEmpty()) { if (searchBook.name.isNotEmpty()) {
if (!scope.isActive) throw CancellationException() if (!scope.isActive) throw CancellationException()

@ -19,6 +19,8 @@ import io.legado.app.lib.theme.ColorUtils
class ColorPreference(context: Context, attrs: AttributeSet) : Preference(context, attrs), class ColorPreference(context: Context, attrs: AttributeSet) : Preference(context, attrs),
ColorPickerDialogListener { ColorPickerDialogListener {
var onSaveColor: ((color: Int) -> Boolean)? = null
private val sizeNormal = 0 private val sizeNormal = 0
private val sizeLarge = 1 private val sizeLarge = 1
@ -140,6 +142,9 @@ class ColorPreference(context: Context, attrs: AttributeSet) : Preference(contex
} }
override fun onColorSelected(dialogId: Int, @ColorInt color: Int) { override fun onColorSelected(dialogId: Int, @ColorInt color: Int) {
if (onSaveColor?.invoke(color) == true) {
return
}
saveValue(color) saveValue(color)
} }

Loading…
Cancel
Save