rectf = new RectF();
rect = new Rect();
- paint.setColor(0x33333300);
- paint.setAlpha(0x99);
+ paint.setARGB(0x99, 0x33, 0x33, 0x33);
paint.setAntiAlias(true);
paint.setStyle(Style.FILL_AND_STROKE);
}
+ @Override
+ public synchronized void setProgress(int progress) {
+ super.setProgress(progress);
+ if (paint != null) {
+ int percent = progress * 100 / getMax();
+ if (percent > 25 || progress == 0)
+ paint.setARGB(0x99, 0x33, 0x33, 0x33);
+ else
+ paint.setARGB(0x99, 0xff, 0xe0 * percent / 25, 0x00);
+ }
+ }
+
@Override
protected synchronized void onDraw(Canvas canvas) {
getDrawingRect(rect);