@@ -10,38 +10,36 @@ class MarkSpan : CharacterStyle, IAztecInlineSpan {
1010 override var TAG = " mark"
1111
1212 override var attributes: AztecAttributes = AztecAttributes ()
13- var textColor : Int? = null
13+ private val textColorValue : Int?
1414
1515 constructor (attributes: AztecAttributes = AztecAttributes ()) : super () {
1616 this .attributes = attributes
1717
1818 val color = CssStyleFormatter .getStyleAttribute(attributes,
1919 CssStyleFormatter .CSS_COLOR_ATTRIBUTE )
20- if (color.isNotEmpty()) {
21- textColor = Color .parseColor(color)
20+ textColorValue = if (color.isNotEmpty()) {
21+ Color .parseColor(color)
22+ } else {
23+ null
2224 }
2325 }
2426
2527 constructor (attributes: AztecAttributes = AztecAttributes (), colorString: String? ) : super () {
2628 this .attributes = attributes
2729
28- if (colorString != null ) {
29- textColor = Color .parseColor(colorString)
30+ textColorValue = if (colorString != null ) {
31+ Color .parseColor(colorString)
32+ } else {
33+ null
3034 }
3135 }
3236
3337 override fun updateDrawState (tp : TextPaint ) {
34- configureTextPaint(tp)
35- }
36-
37- private fun configureTextPaint (tp : TextPaint ) {
38- if (textColor != null ) {
39- tp.color = textColor as Int
40- }
38+ textColorValue?.let { tp.color = it }
4139 }
4240
4341 fun getTextColor (): String {
44- val currentColor = textColor ? : 0
42+ val currentColor = textColorValue ? : 0
4543 return String .format(" #%06X" , 0xFFFFFF and currentColor)
4644 }
4745}
0 commit comments