From 6fc522b3cbae3849b8a4f3010a787e1c3e8f7bec Mon Sep 17 00:00:00 2001 From: Deepan Date: Wed, 14 Aug 2019 15:08:05 +0530 Subject: [PATCH] Added stroke width manipulation. --- .../src/main/java/com/deepan/pieprogress/PieProgress.kt | 7 +++++-- pieprogress/src/main/res/values/attrs.xml | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pieprogress/src/main/java/com/deepan/pieprogress/PieProgress.kt b/pieprogress/src/main/java/com/deepan/pieprogress/PieProgress.kt index 6e336ef..886e684 100644 --- a/pieprogress/src/main/java/com/deepan/pieprogress/PieProgress.kt +++ b/pieprogress/src/main/java/com/deepan/pieprogress/PieProgress.kt @@ -47,6 +47,9 @@ class PieProgress : View { val progressColor = attributes.getColor( R.styleable.PieProgress_progressColor, context.resources.getColor(R.color.white, context.theme) ) + val strokeWidthAttribute = attributes.getDimension( + R.styleable.PieProgress_strokeWidth, context.resources.getDimension(R.dimen.width_circle_stroke) + ) progressPaint.apply { color = progressColor } @@ -54,12 +57,12 @@ class PieProgress : View { color = progressColor style = Paint.Style.STROKE strokeCap = Paint.Cap.ROUND - strokeWidth = resources.getDimension(R.dimen.width_circle_stroke) + strokeWidth = strokeWidthAttribute } strokePaint.apply { color = progressColor style = Paint.Style.STROKE - strokeWidth = resources.getDimension(R.dimen.width_circle_stroke) + strokeWidth = strokeWidthAttribute } } finally { attributes.recycle() diff --git a/pieprogress/src/main/res/values/attrs.xml b/pieprogress/src/main/res/values/attrs.xml index a7c2047..a77ea2d 100644 --- a/pieprogress/src/main/res/values/attrs.xml +++ b/pieprogress/src/main/res/values/attrs.xml @@ -2,5 +2,6 @@ + \ No newline at end of file