@@ -46,6 +46,8 @@ class PolygonView
4646 private val midPointer24 = getPointView(0 , height / 2 )
4747 private var magnifier: Magnifier ? = null
4848 private var validShapeListener: ((Boolean ) -> Unit )? = null
49+ private val accentColor: Int by lazy { ContextCompat .getColor(context, R .color.teal_200) }
50+ private val errorColor: Int by lazy { ContextCompat .getColor(context, R .color.red_900) }
4951
5052 init {
5153 pointer1.setOnTouchListener(EdgePointTouchListener ())
@@ -66,7 +68,7 @@ class PolygonView
6668 addView(pointer4)
6769
6870 paint = Paint ().apply {
69- color = ContextCompat .getColor(context, R .color.secondaryColor)
71+ color = accentColor
7072 strokeWidth = resources.getDimension(R .dimen.polygon_line_width)
7173 isAntiAlias = true
7274 }
@@ -263,9 +265,9 @@ class PolygonView
263265
264266 validShapeListener?.invoke(isValidShape)
265267 paint.color = if (isValidShape) {
266- ContextCompat .getColor(context, R .color.secondaryColor)
268+ accentColor
267269 } else {
268- ContextCompat .getColor(context, R .color. errorColor)
270+ errorColor
269271 }
270272
271273 dismissMag()
@@ -324,9 +326,9 @@ class PolygonView
324326
325327 validShapeListener?.invoke(isValidShape)
326328 paint.color = if (isValidShape) {
327- ContextCompat .getColor(context, R .color.secondaryColor)
329+ accentColor
328330 } else {
329- ContextCompat .getColor(context, R .color. errorColor)
331+ errorColor
330332 }
331333
332334 dismissMag()
0 commit comments