private void initAttributes(TypedArray attrArray){
  mCircleXRadius=attrArray.getFloat(R.styleable.CircularSeekBar_circle_x_radius,DEFAULT_CIRCLE_X_RADIUS) * DPTOPX_SCALE;
  mCircleYRadius=attrArray.getFloat(R.styleable.CircularSeekBar_circle_y_radius,DEFAULT_CIRCLE_Y_RADIUS) * DPTOPX_SCALE;
  mPointerRadius=attrArray.getFloat(R.styleable.CircularSeekBar_pointer_radius,DEFAULT_POINTER_RADIUS) * DPTOPX_SCALE;
  mPointerHaloWidth=attrArray.getFloat(R.styleable.CircularSeekBar_pointer_halo_width,DEFAULT_POINTER_HALO_WIDTH) * DPTOPX_SCALE;
  mPointerHaloBorderWidth=attrArray.getFloat(R.styleable.CircularSeekBar_pointer_halo_border_width,DEFAULT_POINTER_HALO_BORDER_WIDTH) * DPTOPX_SCALE;
  mCircleStrokeWidth=attrArray.getFloat(R.styleable.CircularSeekBar_circle_stroke_width,DEFAULT_CIRCLE_STROKE_WIDTH) * DPTOPX_SCALE;
  String tempColor=attrArray.getString(R.styleable.CircularSeekBar_pointer_color);
  if (tempColor != null) {
    try {
      mPointerColor=Color.parseColor(tempColor);
    }
 catch (    IllegalArgumentException e) {
      mPointerColor=DEFAULT_POINTER_COLOR;
    }
  }
  tempColor=attrArray.getString(R.styleable.CircularSeekBar_pointer_halo_color);
  if (tempColor != null) {
    try {
      mPointerHaloColor=Color.parseColor(tempColor);
    }
 catch (    IllegalArgumentException e) {
      mPointerHaloColor=DEFAULT_POINTER_HALO_COLOR;
    }
  }
  tempColor=attrArray.getString(R.styleable.CircularSeekBar_pointer_halo_color_ontouch);
  if (tempColor != null) {
    try {
      mPointerHaloColorOnTouch=Color.parseColor(tempColor);
    }
 catch (    IllegalArgumentException e) {
      mPointerHaloColorOnTouch=DEFAULT_POINTER_HALO_COLOR_ONTOUCH;
    }
  }
  tempColor=attrArray.getString(R.styleable.CircularSeekBar_circle_color);
  if (tempColor != null) {
    try {
      mCircleColor=Color.parseColor(tempColor);
    }
 catch (    IllegalArgumentException e) {
      mCircleColor=DEFAULT_CIRCLE_COLOR;
    }
  }
  tempColor=attrArray.getString(R.styleable.CircularSeekBar_circle_progress_color);
  if (tempColor != null) {
    try {
      mCircleProgressColor=Color.parseColor(tempColor);
    }
 catch (    IllegalArgumentException e) {
      mCircleProgressColor=DEFAULT_CIRCLE_PROGRESS_COLOR;
    }
  }
  tempColor=attrArray.getString(R.styleable.CircularSeekBar_circle_fill);
  if (tempColor != null) {
    try {
      mCircleFillColor=Color.parseColor(tempColor);
    }
 catch (    IllegalArgumentException e) {
      mCircleFillColor=DEFAULT_CIRCLE_FILL_COLOR;
    }
  }
  mPointerAlpha=Color.alpha(mPointerHaloColor);
  mPointerAlphaOnTouch=attrArray.getInt(R.styleable.CircularSeekBar_pointer_alpha_ontouch,DEFAULT_POINTER_ALPHA_ONTOUCH);
  if (mPointerAlphaOnTouch > 255 || mPointerAlphaOnTouch < 0) {
    mPointerAlphaOnTouch=DEFAULT_POINTER_ALPHA_ONTOUCH;
  }
  mMax=attrArray.getInt(R.styleable.CircularSeekBar_max,DEFAULT_MAX);
  mProgress=attrArray.getInt(R.styleable.CircularSeekBar_progress,DEFAULT_PROGRESS);
  mCustomRadii=attrArray.getBoolean(R.styleable.CircularSeekBar_use_custom_radii,DEFAULT_USE_CUSTOM_RADII);
  mMaintainEqualCircle=attrArray.getBoolean(R.styleable.CircularSeekBar_maintain_equal_circle,DEFAULT_MAINTAIN_EQUAL_CIRCLE);
  mMoveOutsideCircle=attrArray.getBoolean(R.styleable.CircularSeekBar_move_outside_circle,DEFAULT_MOVE_OUTSIDE_CIRCLE);
  lockEnabled=attrArray.getBoolean(R.styleable.CircularSeekBar_lock_enabled,DEFAULT_LOCK_ENABLED);
  mStartAngle=((360f + (attrArray.getFloat((R.styleable.CircularSeekBar_start_angle),DEFAULT_START_ANGLE) % 360f)) % 360f);
  mEndAngle=((360f + (attrArray.getFloat((R.styleable.CircularSeekBar_end_angle),DEFAULT_END_ANGLE) % 360f)) % 360f);
  if (mStartAngle == mEndAngle) {
    mEndAngle=mEndAngle - .1f;
  }
}

private void initAttributes ( TypedArray attrArray ) { mCircleXRadius = attrArray . getFloat ( R . styleable . CircularSeekBar_circle_x_radius , DEFAULT_CIRCLE_X_RADIUS ) * DPTOPX_SCALE ; mCircleYRadius = attrArray . getFloat ( R . styleable . CircularSeekBar_circle_y_radius , DEFAULT_CIRCLE_Y_RADIUS ) * DPTOPX_SCALE ; mPointerRadius = attrArray . getFloat ( R . styleable . CircularSeekBar_pointer_radius , DEFAULT_POINTER_RADIUS ) * DPTOPX_SCALE ; mPointerHaloWidth = attrArray . getFloat ( R . styleable . CircularSeekBar_pointer_halo_width , DEFAULT_POINTER_HALO_WIDTH ) * DPTOPX_SCALE ; mPointerHaloBorderWidth = attrArray . getFloat ( R . styleable . CircularSeekBar_pointer_halo_border_width , DEFAULT_POINTER_HALO_BORDER_WIDTH ) * DPTOPX_SCALE ; mCircleStrokeWidth = attrArray . getFloat ( R . styleable . CircularSeekBar_circle_stroke_width , DEFAULT_CIRCLE_STROKE_WIDTH ) * DPTOPX_SCALE ; String tempColor = attrArray . getString ( R . styleable . CircularSeekBar_pointer_color ) ; if ( tempColor != null ) { try { mPointerColor = Color . parseColor ( tempColor ) ; } catch ( IllegalArgumentException e ) { mPointerColor = DEFAULT_POINTER_COLOR ; } } tempColor = attrArray . getString ( R . styleable . CircularSeekBar_pointer_halo_color ) ; if ( tempColor != null ) { try { mPointerHaloColor = Color . parseColor ( tempColor ) ; } catch ( IllegalArgumentException e ) { mPointerHaloColor = DEFAULT_POINTER_HALO_COLOR ; } } tempColor = attrArray . getString ( R . styleable . CircularSeekBar_pointer_halo_color_ontouch ) ; if ( tempColor != null ) { try { mPointerHaloColorOnTouch = Color . parseColor ( tempColor ) ; } catch ( IllegalArgumentException e ) { mPointerHaloColorOnTouch = DEFAULT_POINTER_HALO_COLOR_ONTOUCH ; } } tempColor = attrArray . getString ( R . styleable . CircularSeekBar_circle_color ) ; if ( tempColor != null ) { try { mCircleColor = Color . parseColor ( tempColor ) ; } catch ( IllegalArgumentException e ) { mCircleColor = DEFAULT_CIRCLE_COLOR ; } } tempColor = attrArray . getString ( R . styleable . CircularSeekBar_circle_progress_color ) ; if ( tempColor != null ) { try { mCircleProgressColor = Color . parseColor ( tempColor ) ; } catch ( IllegalArgumentException e ) { mCircleProgressColor = DEFAULT_CIRCLE_PROGRESS_COLOR ; } } tempColor = attrArray . getString ( R . styleable . CircularSeekBar_circle_fill ) ; if ( tempColor != null ) { try { mCircleFillColor = Color . parseColor ( tempColor ) ; } catch ( IllegalArgumentException e ) { mCircleFillColor = DEFAULT_CIRCLE_FILL_COLOR ; } } mPointerAlpha = Color . alpha ( mPointerHaloColor ) ; mPointerAlphaOnTouch = attrArray . getInt ( R . styleable . CircularSeekBar_pointer_alpha_ontouch , DEFAULT_POINTER_ALPHA_ONTOUCH ) ; if ( mPointerAlphaOnTouch > 255 || mPointerAlphaOnTouch < 0 ) { mPointerAlphaOnTouch = DEFAULT_POINTER_ALPHA_ONTOUCH ; } mMax = attrArray . getInt ( R . styleable . CircularSeekBar_max , DEFAULT_MAX ) ; mProgress = attrArray . getInt ( R . styleable . CircularSeekBar_progress , DEFAULT_PROGRESS ) ; mCustomRadii = attrArray . getBoolean ( R . styleable . CircularSeekBar_use_custom_radii , DEFAULT_USE_CUSTOM_RADII ) ; mMaintainEqualCircle = attrArray . getBoolean ( R . styleable . CircularSeekBar_maintain_equal_circle , DEFAULT_MAINTAIN_EQUAL_CIRCLE ) ; mMoveOutsideCircle = attrArray . getBoolean ( R . styleable . CircularSeekBar_move_outside_circle , DEFAULT_MOVE_OUTSIDE_CIRCLE ) ; lockEnabled = attrArray . getBoolean ( R . styleable . CircularSeekBar_lock_enabled , DEFAULT_LOCK_ENABLED ) ; mStartAngle = ( ( 360f + ( attrArray . getFloat ( ( R . styleable . CircularSeekBar_start_angle ) , DEFAULT_START_ANGLE ) % 360f ) ) % 360f ) ; mEndAngle = ( ( 360f + ( attrArray . getFloat ( ( R . styleable . CircularSeekBar_end_angle ) , DEFAULT_END_ANGLE ) % 360f ) ) % 360f ) ; if ( mStartAngle == mEndAngle ) { mEndAngle = mEndAngle - .1f ; } }
initialize the circularseekbar with the attributes from the xml style . uses the defaults defined at the top of this file when an attribute is not specified by the user .
