code: private void init(Context context, AttributeSet attrs, int defStyleAttr) {
          TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircularSlider, defStyleAttr, 0);
  
          // read all available attributes
          float startAngle = a.getFloat(R.styleable.CircularSlider_start_angle, (float) Math.PI / 2);
          float angle = a.getFloat(R.styleable.CircularSlider_angle, (float) Math.PI / 2);
          int thumbSize = a.getDimensionPixelSize(R.styleable.CircularSlider_thumb_size, 50);
          int thumbColor = a.getColor(R.styleable.CircularSlider_thumb_color, Color.GRAY);
          int borderThickness = a.getDimensionPixelSize(R.styleable.CircularSlider_border_thickness, 20);
          int borderColor = a.getColor(R.styleable.CircularSlider_border_color, Color.RED);
          String borderGradientColors = a.getString(R.styleable.CircularSlider_border_gradient_colors);
          Drawable thumbImage = a.getDrawable(R.styleable.CircularSlider_thumb_image);
  
          // save those to fields (really, do we need setters here..?)
          setStartAngle(startAngle);
          setAngle(angle);
          setBorderThickness(borderThickness);
          setBorderColor(borderColor);
          if (borderGradientColors != null) {
              setBorderGradientColors(borderGradientColors.split(";"));
          }
          setThumbSize(thumbSize);
          setThumbImage(thumbImage);
          setThumbColor(thumbColor);
  
          // assign padding - check for version because of RTL layout compatibility
          int padding;
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
              int all = getPaddingLeft() + getPaddingRight() + getPaddingBottom() + getPaddingTop() + getPaddingEnd() + getPaddingStart();
              padding = all / 6;
          } else {
              padding = (getPaddingLeft() + getPaddingRight() + getPaddingBottom() + getPaddingTop()) / 4;
          }
          setPadding(padding);
  
          a.recycle();
      }
docs: common initializer method