]> Pileus Git - ~andy/freeotp/blobdiff - src/org/fedorahosted/freeotp/CircleProgressBar.java
Ignore warning
[~andy/freeotp] / src / org / fedorahosted / freeotp / CircleProgressBar.java
index e9772e68b5ecb642c8f91f1d19d9d2e541301027..b1c26cce3046846ffafac779e064b06f30eaafcb 100644 (file)
@@ -54,12 +54,23 @@ public class CircleProgressBar extends ProgressBar {
         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);