dccv/src/main/java/com/vikramezhil/dccv/CalorieCounterView.java
private void init(Context context, AttributeSet attrs) {
        rectF = new RectF();

        TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.DroidCircleProgressView, 0, 0);

        try {
            properties.dccvMin = typedArray.getInt(R.styleable.DroidCircleProgressView_dccvMin, properties.dccvMin);
            properties.dccvMax = typedArray.getInt(R.styleable.DroidCircleProgressView_dccvMax, properties.dccvMax);
            properties.dccvProgress = typedArray.getInt(R.styleable.DroidCircleProgressView_dccvProgress, properties.dccvProgress);
            properties.dccvBackgroundColor = typedArray.getInt(R.styleable.DroidCircleProgressView_dccvBackgroundColor, properties.dccvBackgroundColor);
            properties.dccvProgressColor = typedArray.getInt(R.styleable.DroidCircleProgressView_dccvProgressColor, properties.dccvProgressColor);
            properties.dccvHeaderTxtColor = typedArray.getInt(R.styleable.DroidCircleProgressView_dccvHeaderTxtColor, properties.dccvHeaderTxtColor);
            properties.dccvHeaderSubTxtColor = typedArray.getInt(R.styleable.DroidCircleProgressView_dccvHeaderSubTxtColor, properties.dccvHeaderSubTxtColor);
            properties.dccvFooterTxtColor = typedArray.getInt(R.styleable.DroidCircleProgressView_dccvFooterTxtColor, properties.dccvFooterTxtColor);
            properties.dccvFooterSubTxtColor = typedArray.getInt(R.styleable.DroidCircleProgressView_dccvFooterSubTxtColor, properties.dccvFooterSubTxtColor);
            properties.dccvThickness = typedArray.getDimension(R.styleable.DroidCircleProgressView_dccvThickness, properties.dccvThickness);
            properties.dccvHeaderTxtSize= typedArray.getDimension(R.styleable.DroidCircleProgressView_dccvHeaderTxtSize, properties.dccvHeaderTxtSize);
            properties.dccvHeaderSubTxtSize = typedArray.getDimension(R.styleable.DroidCircleProgressView_dccvHeaderSubTxtSize, properties.dccvHeaderSubTxtSize);
            properties.dccvFooterTxtSize  = typedArray.getDimension(R.styleable.DroidCircleProgressView_dccvFooterTxtSize, properties.dccvFooterTxtSize);
            properties.dccvFooterSubTxtSize = typedArray.getDimension(R.styleable.DroidCircleProgressView_dccvFooterSubTxtSize, properties.dccvFooterSubTxtSize);

            String headerTxt = typedArray.getString(R.styleable.DroidCircleProgressView_dccvHeaderTxt);
            String headerSubTxt = typedArray.getString(R.styleable.DroidCircleProgressView_dccvHeaderSubTxt);
            String footerTxt = typedArray.getString(R.styleable.DroidCircleProgressView_dccvFooterTxt);
            String footerSubTxt = typedArray.getString(R.styleable.DroidCircleProgressView_dccvFooterSubTxt);

            properties.dccvHeaderTxt = (headerTxt == null || headerTxt.isEmpty()) ? null : headerTxt;
            properties.dccvHeaderSubTxt = (headerSubTxt == null || headerSubTxt.isEmpty()) ? null : headerSubTxt;
            properties.dccvFooterTxt = (footerTxt == null || footerTxt.isEmpty()) ? null : footerTxt;
            properties.dccvFooterSubTxt = (footerSubTxt == null || footerSubTxt.isEmpty()) ? null : footerSubTxt;

            properties.dccvClickable = typedArray.getBoolean(R.styleable.DroidCircleProgressView_dccvClickable, properties.dccvClickable);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
        finally {
            typedArray.recycle();
        }

        fillBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        fillBackgroundPaint.setColor(properties.dccvBackgroundColor);
        fillBackgroundPaint.setStyle(Paint.Style.FILL);

        backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        backgroundPaint.setColor(adjustAlpha(properties.dccvProgressColor, 0.3f));
        backgroundPaint.setStyle(Paint.Style.STROKE);
        backgroundPaint.setStrokeWidth(properties.dccvThickness);

        foregroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        foregroundPaint.setColor(properties.dccvProgressColor);
        foregroundPaint.setStyle(Paint.Style.STROKE);
        foregroundPaint.setStrokeWidth(properties.dccvThickness);

        int blendColor = blendColor(properties.dccvProgressColor, properties.dccvDangerProgressColor);
        dangerBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        dangerBackgroundPaint.setColor(adjustAlpha(blendColor, 0.3f));
        dangerBackgroundPaint.setStyle(Paint.Style.STROKE);
        dangerBackgroundPaint.setStrokeWidth(properties.dccvThickness);

        dangerForegroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        dangerForegroundPaint.setColor(blendColor);
        dangerForegroundPaint.setStyle(Paint.Style.STROKE);
        dangerForegroundPaint.setStrokeWidth(properties.dccvThickness);

        textHeaderPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
        textHeaderPaint.setColor(properties.dccvHeaderTxtColor);
        textHeaderPaint.setTextSize(properties.dccvHeaderTxtSize);

        textHeaderSubPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
        textHeaderSubPaint.setColor(properties.dccvHeaderSubTxtColor);
        textHeaderSubPaint.setTextSize(properties.dccvHeaderSubTxtSize);

        textFooterPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
        textFooterPaint.setColor(properties.dccvFooterTxtColor);
        textFooterPaint.setTextSize(properties.dccvFooterTxtSize);

        textFooterSubPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
        textFooterSubPaint.setColor(properties.dccvFooterSubTxtColor);
        textFooterSubPaint.setTextSize(properties.dccvFooterSubTxtSize);

        // Adding the text paints to an array list
        textPaint = new ArrayList<>(Arrays.asList(textHeaderPaint, textHeaderSubPaint, textFooterPaint, textFooterSubPaint));
    }
/**
     * Initializes the circle progress view
     *
     * @param context The application context
     *
     * @param attrs The view attributes
     */
Initializes the circle progress view
@param context The application context

@param attrs The view attributes
Initializes the circle progress view @param context The application context @param attrs The view attributes
private void init(Context context, AttributeSet attrs) {
        rectF = new RectF();
        TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.DroidCircleProgressView, 0, 0);
        try {
            properties.dccvMin = typedArray.getInt(R.styleable.DroidCircleProgressView_dccvMin, properties.dccvMin);
            properties.dccvMax = typedArray.getInt(R.styleable.DroidCircleProgressView_dccvMax, properties.dccvMax);
            properties.dccvProgress = typedArray.getInt(R.styleable.DroidCircleProgressView_dccvProgress, properties.dccvProgress);
            properties.dccvBackgroundColor = typedArray.getInt(R.styleable.DroidCircleProgressView_dccvBackgroundColor, properties.dccvBackgroundColor);
            properties.dccvProgressColor = typedArray.getInt(R.styleable.DroidCircleProgressView_dccvProgressColor, properties.dccvProgressColor);
            properties.dccvHeaderTxtColor = typedArray.getInt(R.styleable.DroidCircleProgressView_dccvHeaderTxtColor, properties.dccvHeaderTxtColor);
            properties.dccvHeaderSubTxtColor = typedArray.getInt(R.styleable.DroidCircleProgressView_dccvHeaderSubTxtColor, properties.dccvHeaderSubTxtColor);
            properties.dccvFooterTxtColor = typedArray.getInt(R.styleable.DroidCircleProgressView_dccvFooterTxtColor, properties.dccvFooterTxtColor);
            properties.dccvFooterSubTxtColor = typedArray.getInt(R.styleable.DroidCircleProgressView_dccvFooterSubTxtColor, properties.dccvFooterSubTxtColor);
            properties.dccvThickness = typedArray.getDimension(R.styleable.DroidCircleProgressView_dccvThickness, properties.dccvThickness);
            properties.dccvHeaderTxtSize= typedArray.getDimension(R.styleable.DroidCircleProgressView_dccvHeaderTxtSize, properties.dccvHeaderTxtSize);
            properties.dccvHeaderSubTxtSize = typedArray.getDimension(R.styleable.DroidCircleProgressView_dccvHeaderSubTxtSize, properties.dccvHeaderSubTxtSize);
            properties.dccvFooterTxtSize  = typedArray.getDimension(R.styleable.DroidCircleProgressView_dccvFooterTxtSize, properties.dccvFooterTxtSize);
            properties.dccvFooterSubTxtSize = typedArray.getDimension(R.styleable.DroidCircleProgressView_dccvFooterSubTxtSize, properties.dccvFooterSubTxtSize);
            String headerTxt = typedArray.getString(R.styleable.DroidCircleProgressView_dccvHeaderTxt);
            String headerSubTxt = typedArray.getString(R.styleable.DroidCircleProgressView_dccvHeaderSubTxt);
            String footerTxt = typedArray.getString(R.styleable.DroidCircleProgressView_dccvFooterTxt);
            String footerSubTxt = typedArray.getString(R.styleable.DroidCircleProgressView_dccvFooterSubTxt);
            properties.dccvHeaderTxt = (headerTxt == null || headerTxt.isEmpty()) ? null : headerTxt;
            properties.dccvHeaderSubTxt = (headerSubTxt == null || headerSubTxt.isEmpty()) ? null : headerSubTxt;
            properties.dccvFooterTxt = (footerTxt == null || footerTxt.isEmpty()) ? null : footerTxt;
            properties.dccvFooterSubTxt = (footerSubTxt == null || footerSubTxt.isEmpty()) ? null : footerSubTxt;
            properties.dccvClickable = typedArray.getBoolean(R.styleable.DroidCircleProgressView_dccvClickable, properties.dccvClickable);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
        finally {
            typedArray.recycle();
        }
        fillBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        fillBackgroundPaint.setColor(properties.dccvBackgroundColor);
        fillBackgroundPaint.setStyle(Paint.Style.FILL);
        backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        backgroundPaint.setColor(adjustAlpha(properties.dccvProgressColor, 0.3f));
        backgroundPaint.setStyle(Paint.Style.STROKE);
        backgroundPaint.setStrokeWidth(properties.dccvThickness);
        foregroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        foregroundPaint.setColor(properties.dccvProgressColor);
        foregroundPaint.setStyle(Paint.Style.STROKE);
        foregroundPaint.setStrokeWidth(properties.dccvThickness);
        int blendColor = blendColor(properties.dccvProgressColor, properties.dccvDangerProgressColor);
        dangerBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        dangerBackgroundPaint.setColor(adjustAlpha(blendColor, 0.3f));
        dangerBackgroundPaint.setStyle(Paint.Style.STROKE);
        dangerBackgroundPaint.setStrokeWidth(properties.dccvThickness);
        dangerForegroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        dangerForegroundPaint.setColor(blendColor);
        dangerForegroundPaint.setStyle(Paint.Style.STROKE);
        dangerForegroundPaint.setStrokeWidth(properties.dccvThickness);
        textHeaderPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
        textHeaderPaint.setColor(properties.dccvHeaderTxtColor);
        textHeaderPaint.setTextSize(properties.dccvHeaderTxtSize);
        textHeaderSubPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
        textHeaderSubPaint.setColor(properties.dccvHeaderSubTxtColor);
        textHeaderSubPaint.setTextSize(properties.dccvHeaderSubTxtSize);
        textFooterPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
        textFooterPaint.setColor(properties.dccvFooterTxtColor);
        textFooterPaint.setTextSize(properties.dccvFooterTxtSize);
        textFooterSubPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
        textFooterSubPaint.setColor(properties.dccvFooterSubTxtColor);
        textFooterSubPaint.setTextSize(properties.dccvFooterSubTxtSize);
        textPaint = new ArrayList<>(Arrays.asList(textHeaderPaint, textHeaderSubPaint, textFooterPaint, textFooterSubPaint));
    }
private void init ( Context context , AttributeSet attrs ) { rectF = new RectF ( ) ; TypedArray typedArray = context . getTheme ( ) . obtainStyledAttributes ( attrs , R . styleable . DroidCircleProgressView , 0 , 0 ) ; try { properties . dccvMin = typedArray . getInt ( R . styleable . DroidCircleProgressView_dccvMin , properties . dccvMin ) ; properties . dccvMax = typedArray . getInt ( R . styleable . DroidCircleProgressView_dccvMax , properties . dccvMax ) ; properties . dccvProgress = typedArray . getInt ( R . styleable . DroidCircleProgressView_dccvProgress , properties . dccvProgress ) ; properties . dccvBackgroundColor = typedArray . getInt ( R . styleable . DroidCircleProgressView_dccvBackgroundColor , properties . dccvBackgroundColor ) ; properties . dccvProgressColor = typedArray . getInt ( R . styleable . DroidCircleProgressView_dccvProgressColor , properties . dccvProgressColor ) ; properties . dccvHeaderTxtColor = typedArray . getInt ( R . styleable . DroidCircleProgressView_dccvHeaderTxtColor , properties . dccvHeaderTxtColor ) ; properties . dccvHeaderSubTxtColor = typedArray . getInt ( R . styleable . DroidCircleProgressView_dccvHeaderSubTxtColor , properties . dccvHeaderSubTxtColor ) ; properties . dccvFooterTxtColor = typedArray . getInt ( R . styleable . DroidCircleProgressView_dccvFooterTxtColor , properties . dccvFooterTxtColor ) ; properties . dccvFooterSubTxtColor = typedArray . getInt ( R . styleable . DroidCircleProgressView_dccvFooterSubTxtColor , properties . dccvFooterSubTxtColor ) ; properties . dccvThickness = typedArray . getDimension ( R . styleable . DroidCircleProgressView_dccvThickness , properties . dccvThickness ) ; properties . dccvHeaderTxtSize = typedArray . getDimension ( R . styleable . DroidCircleProgressView_dccvHeaderTxtSize , properties . dccvHeaderTxtSize ) ; properties . dccvHeaderSubTxtSize = typedArray . getDimension ( R . styleable . DroidCircleProgressView_dccvHeaderSubTxtSize , properties . dccvHeaderSubTxtSize ) ; properties . dccvFooterTxtSize = typedArray . getDimension ( R . styleable . DroidCircleProgressView_dccvFooterTxtSize , properties . dccvFooterTxtSize ) ; properties . dccvFooterSubTxtSize = typedArray . getDimension ( R . styleable . DroidCircleProgressView_dccvFooterSubTxtSize , properties . dccvFooterSubTxtSize ) ; String headerTxt = typedArray . getString ( R . styleable . DroidCircleProgressView_dccvHeaderTxt ) ; String headerSubTxt = typedArray . getString ( R . styleable . DroidCircleProgressView_dccvHeaderSubTxt ) ; String footerTxt = typedArray . getString ( R . styleable . DroidCircleProgressView_dccvFooterTxt ) ; String footerSubTxt = typedArray . getString ( R . styleable . DroidCircleProgressView_dccvFooterSubTxt ) ; properties . dccvHeaderTxt = ( headerTxt == null || headerTxt . isEmpty ( ) ) ? null : headerTxt ; properties . dccvHeaderSubTxt = ( headerSubTxt == null || headerSubTxt . isEmpty ( ) ) ? null : headerSubTxt ; properties . dccvFooterTxt = ( footerTxt == null || footerTxt . isEmpty ( ) ) ? null : footerTxt ; properties . dccvFooterSubTxt = ( footerSubTxt == null || footerSubTxt . isEmpty ( ) ) ? null : footerSubTxt ; properties . dccvClickable = typedArray . getBoolean ( R . styleable . DroidCircleProgressView_dccvClickable , properties . dccvClickable ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } finally { typedArray . recycle ( ) ; } fillBackgroundPaint = new Paint ( Paint . ANTI_ALIAS_FLAG ) ; fillBackgroundPaint . setColor ( properties . dccvBackgroundColor ) ; fillBackgroundPaint . setStyle ( Paint . Style . FILL ) ; backgroundPaint = new Paint ( Paint . ANTI_ALIAS_FLAG ) ; backgroundPaint . setColor ( adjustAlpha ( properties . dccvProgressColor , 0.3f ) ) ; backgroundPaint . setStyle ( Paint . Style . STROKE ) ; backgroundPaint . setStrokeWidth ( properties . dccvThickness ) ; foregroundPaint = new Paint ( Paint . ANTI_ALIAS_FLAG ) ; foregroundPaint . setColor ( properties . dccvProgressColor ) ; foregroundPaint . setStyle ( Paint . Style . STROKE ) ; foregroundPaint . setStrokeWidth ( properties . dccvThickness ) ; int blendColor = blendColor ( properties . dccvProgressColor , properties . dccvDangerProgressColor ) ; dangerBackgroundPaint = new Paint ( Paint . ANTI_ALIAS_FLAG ) ; dangerBackgroundPaint . setColor ( adjustAlpha ( blendColor , 0.3f ) ) ; dangerBackgroundPaint . setStyle ( Paint . Style . STROKE ) ; dangerBackgroundPaint . setStrokeWidth ( properties . dccvThickness ) ; dangerForegroundPaint = new Paint ( Paint . ANTI_ALIAS_FLAG ) ; dangerForegroundPaint . setColor ( blendColor ) ; dangerForegroundPaint . setStyle ( Paint . Style . STROKE ) ; dangerForegroundPaint . setStrokeWidth ( properties . dccvThickness ) ; textHeaderPaint = new TextPaint ( Paint . ANTI_ALIAS_FLAG ) ; textHeaderPaint . setColor ( properties . dccvHeaderTxtColor ) ; textHeaderPaint . setTextSize ( properties . dccvHeaderTxtSize ) ; textHeaderSubPaint = new TextPaint ( Paint . ANTI_ALIAS_FLAG ) ; textHeaderSubPaint . setColor ( properties . dccvHeaderSubTxtColor ) ; textHeaderSubPaint . setTextSize ( properties . dccvHeaderSubTxtSize ) ; textFooterPaint = new TextPaint ( Paint . ANTI_ALIAS_FLAG ) ; textFooterPaint . setColor ( properties . dccvFooterTxtColor ) ; textFooterPaint . setTextSize ( properties . dccvFooterTxtSize ) ; textFooterSubPaint = new TextPaint ( Paint . ANTI_ALIAS_FLAG ) ; textFooterSubPaint . setColor ( properties . dccvFooterSubTxtColor ) ; textFooterSubPaint . setTextSize ( properties . dccvFooterSubTxtSize ) ; textPaint = new ArrayList < > ( Arrays . asList ( textHeaderPaint , textHeaderSubPaint , textFooterPaint , textFooterSubPaint ) ) ; }
Initializes the circle progress view
 @param context The application context
Initializes the circle progress view @param context The application context
// Adding the text paints to an array list