pull/2368/head
kunfei 2 years ago
parent ca94434756
commit 63d61a6ffe
  1. 20
      app/src/main/java/io/legado/app/ui/widget/SelectActionBar.kt

@ -20,20 +20,22 @@ class SelectActionBar @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null
) : FrameLayout(context, attrs) {
private val bgIsLight = ColorUtils.isColorLight(context.bottomBackground)
private val primaryTextColor = context.getPrimaryTextColor(bgIsLight)
private val disabledColor = context.getSecondaryDisabledTextColor(bgIsLight)
private var callBack: CallBack? = null
private var selMenu: PopupMenu? = null
private val binding =
ViewSelectActionBarBinding.inflate(LayoutInflater.from(context), this, true)
private val binding = ViewSelectActionBarBinding
.inflate(LayoutInflater.from(context), this, true)
init {
setBackgroundColor(context.bottomBackground)
elevation = context.elevation
val textIsDark = ColorUtils.isColorLight(context.bottomBackground)
val primaryTextColor = context.getPrimaryTextColor(textIsDark)
val secondaryTextColor = context.getSecondaryTextColor(textIsDark)
binding.cbSelectedAll.setTextColor(primaryTextColor)
TintHelper.setTint(binding.cbSelectedAll, context.accentColor, !textIsDark)
binding.ivMenuMore.setColorFilter(secondaryTextColor)
TintHelper.setTint(binding.cbSelectedAll, context.accentColor, !bgIsLight)
binding.ivMenuMore.setColorFilter(disabledColor)
binding.cbSelectedAll.setOnCheckedChangeListener { buttonView, isChecked ->
if (buttonView.isPressed) {
callBack?.selectAll(isChecked)
@ -99,9 +101,9 @@ class SelectActionBar @JvmOverloads constructor(
btnSelectActionMain.isEnabled = isClickable
btnSelectActionMain.isClickable = isClickable
if (isClickable) {
ivMenuMore.setColorFilter(context.primaryTextColor)
ivMenuMore.setColorFilter(primaryTextColor)
} else {
ivMenuMore.setColorFilter(context.secondaryTextColor)
ivMenuMore.setColorFilter(disabledColor)
}
ivMenuMore.isEnabled = isClickable
ivMenuMore.isClickable = isClickable

Loading…
Cancel
Save