private void calculateArcMetrics(Rect bounds){
  float size=Math.min(bounds.height(),bounds.width());
  float yOffset=(bounds.height() - size) / 2f;
  float xOffset=(bounds.width() - size) / 2f;
  float strokeWidth;
  float padding;
  if (mArcStrokeWidth == -1f && mArcPadding == -1f) {
    strokeWidth=4f / 48f * size;
    padding=5f / 48f * size;
  }
 else   if (mArcStrokeWidth == -1f) {
    strokeWidth=4f / 48f * size;
    padding=mArcPadding + strokeWidth / 2;
  }
 else   if (mArcPadding == -1f) {
    strokeWidth=mArcStrokeWidth;
    padding=3f / 48f * size + strokeWidth / 2;
  }
 else {
    strokeWidth=mArcStrokeWidth;
    padding=mArcPadding + strokeWidth / 2;
  }
  mArcPaint.setStrokeWidth(strokeWidth);
  mArcRect.set(bounds.left + padding + xOffset,bounds.top + padding + yOffset,bounds.right - padding - xOffset,bounds.bottom - padding - yOffset);
}

private void calculateArcMetrics ( Rect bounds ) { float size = Math . min ( bounds . height ( ) , bounds . width ( ) ) ; float yOffset = ( bounds . height ( ) - size ) / 2f ; float xOffset = ( bounds . width ( ) - size ) / 2f ; float strokeWidth ; float padding ; if ( mArcStrokeWidth == - 1f && mArcPadding == - 1f ) { strokeWidth = 4f / 48f * size ; padding = 5f / 48f * size ; } else if ( mArcStrokeWidth == - 1f ) { strokeWidth = 4f / 48f * size ; padding = mArcPadding + strokeWidth / 2 ; } else if ( mArcPadding == - 1f ) { strokeWidth = mArcStrokeWidth ; padding = 3f / 48f * size + strokeWidth / 2 ; } else { strokeWidth = mArcStrokeWidth ; padding = mArcPadding + strokeWidth / 2 ; } mArcPaint . setStrokeWidth ( strokeWidth ) ; mArcRect . set ( bounds . left + padding + xOffset , bounds . top + padding + yOffset , bounds . right - padding - xOffset , bounds . bottom - padding - yOffset ) ; }
helper that calculates the bounds and the stroke width of the progress arc
