@@ -393,6 +393,7 @@ class AztecToolbar : FrameLayout, IAztecToolbar, OnMenuItemClickListener {
393
393
394
394
editor.setSpanColor(color)
395
395
colorPickerView?.setColor(color)
396
+ updateToolbarColorButton(color)
396
397
}
397
398
})
398
399
@@ -407,16 +408,7 @@ class AztecToolbar : FrameLayout, IAztecToolbar, OnMenuItemClickListener {
407
408
this .colorPickerView = colorPickerView
408
409
colorPickerView.setColorPickerListener(object : ColorPickerListener {
409
410
override fun onPickColor (color : Int ) {
410
- if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .M ) {
411
- findViewById<View >(ToolbarAction .TEXTCOLOR .buttonId).apply {
412
- when (this ) {
413
- is ImageButton -> {
414
- this .imageTintList = ColorStateList .valueOf(color)
415
- }
416
- else -> this .setBackgroundColor(color)
417
- }
418
- }
419
- }
411
+ updateToolbarColorButton(color)
420
412
421
413
editor?.let {
422
414
@@ -458,6 +450,18 @@ class AztecToolbar : FrameLayout, IAztecToolbar, OnMenuItemClickListener {
458
450
})
459
451
}
460
452
453
+ private fun updateToolbarColorButton (color : Int? ) {
454
+ val color2 = color ? : Color .BLACK
455
+ findViewById<View >(ToolbarAction .TEXTCOLOR .buttonId).apply {
456
+ when (this ) {
457
+ is ImageButton -> {
458
+ this .imageTintList = ColorStateList .valueOf(color2)
459
+ }
460
+ else -> this .setBackgroundColor(color2)
461
+ }
462
+ }
463
+ }
464
+
461
465
private fun initView (attrs : AttributeSet ? ) {
462
466
val styles = context.obtainStyledAttributes(attrs, R .styleable.AztecToolbar , 0 , R .style.AztecToolbarStyle )
463
467
isAdvanced = styles.getBoolean(R .styleable.AztecToolbar_advanced , false )
0 commit comments