去除强调色设置判断

pull/951/head 3.21.041610
gedoor 4 years ago
parent ea31681fd1
commit 66d41c9849
  1. 36
      app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt

@ -85,42 +85,6 @@ class ThemeConfigFragment : BasePreferenceFragment(),
}
}
}
findPreference<ColorPreference>(PreferKey.cAccent)?.let {
it.onSaveColor = { color ->
val background =
getPrefInt(PreferKey.cBackground, getCompatColor(R.color.md_grey_100))
val textColor = getCompatColor(R.color.primaryText)
when {
ColorUtils.getColorDifference(color, background) <= 60 -> {
toastOnUi(R.string.accent_background_diff)
true
}
ColorUtils.getColorDifference(color, textColor) <= 60 -> {
toastOnUi(R.string.accent_text_diff)
true
}
else -> false
}
}
}
findPreference<ColorPreference>(PreferKey.cNAccent)?.let {
it.onSaveColor = { color ->
val background =
getPrefInt(PreferKey.cNBackground, getCompatColor(R.color.md_grey_900))
val textColor = getCompatColor(R.color.primaryText)
when {
ColorUtils.getColorDifference(color, background) <= 60 -> {
toastOnUi(R.string.accent_background_diff)
true
}
ColorUtils.getColorDifference(color, textColor) <= 60 -> {
toastOnUi(R.string.accent_text_diff)
true
}
else -> false
}
}
}
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {

Loading…
Cancel
Save