Skip to content

Commit 65ac28d

Browse files
author
Ebrahim Karimi (Gashbeer)
committed
* change stroke and painting color runtime for animation
1 parent de8bd14 commit 65ac28d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

circulartimerview/src/main/java/com/uzairiqbal/circulartimerview/CircularTimerView.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ private void initPaints(Context context, AttributeSet attrs) {
8585
startingAngle = ta.getInt(R.styleable.CircularTimerView_startingPoint, 270);
8686

8787
progressBarPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
88+
progressBarPaint.setAntiAlias(true);
8889
progressBarPaint.setStyle(Paint.Style.FILL);
8990
progressBarPaint.setColor(progressColor);
9091
progressBarPaint.setStyle(Paint.Style.STROKE);
@@ -153,6 +154,21 @@ protected void onDraw(Canvas canvas) {
153154
mArcBounds.set(mouthInset, mouthInset, mRadius * 2 - mouthInset, mRadius * 2 - mouthInset);
154155
canvas.drawArc(mArcBounds, 0f, 360f, false, progressBarBackgroundPaint);
155156

157+
158+
progressBarPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
159+
progressBarPaint.setStyle(Paint.Style.FILL);
160+
progressBarPaint.setColor(progressColor);
161+
progressBarPaint.setStyle(Paint.Style.STROKE);
162+
progressBarPaint.setStrokeWidth(strokeWidth);
163+
progressBarPaint.setAntiAlias(true);
164+
if (roundedCorners) {
165+
progressBarPaint.setStrokeCap(Paint.Cap.ROUND);
166+
} else {
167+
progressBarPaint.setStrokeCap(Paint.Cap.BUTT);
168+
}
169+
String pc = String.format("#%06X", (0xFFFFFF & progressColor));
170+
progressBarPaint.setColor(Color.parseColor(pc));
171+
156172
if (isClockwise) {
157173
canvas.drawArc(mArcBounds, startingAngle, (drawUpto / getMaxValue() * 360), false, progressBarPaint);
158174
} else {

0 commit comments

Comments
 (0)