public void draw(Canvas c){
  super.draw(c);
  paint.setAntiAlias(true);
  paint.setColor(color_battery_background);
  c.drawRect(0,0,c.getWidth(),c.getHeight(),paint);
  int x=c.getWidth() / 2;
  int y=c.getHeight() / 2 - (int)(30f * pixelDensity);
  float _circleSize=(float)(c.getWidth() * circleSize);
  int bgCircleColor=interpolateColor(color_background_decharge,color_background_charging,(float)lerp(_colorTransitionToCharged));
  bgCircleColor=interpolateColor(bgCircleColor,color_background_critical,(float)lerp(_colorTransitionToCritical));
  paint.setColor(bgCircleColor);
  c.drawCircle(x,y,_circleSize,paint);
  int fgCircleColor=interpolateColor(color_foreground_decharge,color_foreground_charging,(float)lerp(_colorTransitionToCharged));
  fgCircleColor=interpolateColor(fgCircleColor,color_foreground_critical,(float)lerp(_colorTransitionToCritical));
  paint.setColor(fgCircleColor);
  c.drawCircle((float)(x + c.getWidth() * pos.getX()),(float)(y + c.getWidth() * pos.getY()),_circleSize * batteryPct,paint);
  String label1="Battery " + Integer.toString(Math.round(batteryPct * 100)) + "%";
  drawText(label1,"",x,(int)(y + circleSize * c.getWidth()),c);
}

public void draw ( Canvas c ) { super . draw ( c ) ; paint . setAntiAlias ( true ) ; paint . setColor ( color_battery_background ) ; c . drawRect ( 0 , 0 , c . getWidth ( ) , c . getHeight ( ) , paint ) ; int x = c . getWidth ( ) / 2 ; int y = c . getHeight ( ) / 2 - ( int ) ( 30f * pixelDensity ) ; float _circleSize = ( float ) ( c . getWidth ( ) * circleSize ) ; int bgCircleColor = interpolateColor ( color_background_decharge , color_background_charging , ( float ) lerp ( _colorTransitionToCharged ) ) ; bgCircleColor = interpolateColor ( bgCircleColor , color_background_critical , ( float ) lerp ( _colorTransitionToCritical ) ) ; paint . setColor ( bgCircleColor ) ; c . drawCircle ( x , y , _circleSize , paint ) ; int fgCircleColor = interpolateColor ( color_foreground_decharge , color_foreground_charging , ( float ) lerp ( _colorTransitionToCharged ) ) ; fgCircleColor = interpolateColor ( fgCircleColor , color_foreground_critical , ( float ) lerp ( _colorTransitionToCritical ) ) ; paint . setColor ( fgCircleColor ) ; c . drawCircle ( ( float ) ( x + c . getWidth ( ) * pos . getX ( ) ) , ( float ) ( y + c . getWidth ( ) * pos . getY ( ) ) , _circleSize * batteryPct , paint ) ; String label1 = "Battery " + Integer . toString ( Math . round ( batteryPct * 100 ) ) + "%" ; drawText ( label1 , "" , x , ( int ) ( y + circleSize * c . getWidth ( ) ) , c ) ; }
draw the circle to the canvas
