// Path: stylishwidget/src/main/java/com/app/infideap/stylishwidget/util/Utils.java
// public class Utils {
//     public static float convertPixelsToDp(float px) {
//         DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
//         float dp = px / (metrics.densityDpi / 160f);
//         return Math.round(dp);
//     }
// 
//     public static float convertDpToPixel(float dp) {
//         DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
//         float px = dp * (metrics.densityDpi / 160f);
//         return Math.round(px);
//     }
// 
//     public static int adjustAlpha(int color, int alpha) {
//         int red = Color.red(color);
//         int green = Color.green(color);
//         int blue = Color.blue(color);
//         return Color.argb(alpha, red, green, blue);
//     }
// }


import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.os.Build;
import androidx.annotation.Px;
import androidx.annotation.RequiresApi;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import com.app.infideap.stylishwidget.R;
import com.app.infideap.stylishwidget.util.Utils;
import java.util.Locale;

        setTextSize(a.getDimension(R.styleable.textAttr_sw_textSize,
                getResources().getDimension(R.dimen.meterTextSize)));

        int textStyle;
        try {
            textStyle = a.getInt(R.styleable.textAttr_sw_textStyle, Typeface.BOLD);
        } catch (Exception e) {
            textStyle = Typeface.BOLD;
        }

        setTextStyle(textStyle);

        a.recycle();


        a = getContext().obtainStyledAttributes(attrs, R.styleable.constraintAttr);
        setShowText(a.getBoolean(R.styleable.constraintAttr_sw_showText, true));
        setValue(a.getFloat(R.styleable.constraintAttr_sw_value, 0f));
        setStartValue(a.getFloat(R.styleable.constraintAttr_sw_startValue, 0f));
        setMaxValue(a.getFloat(R.styleable.constraintAttr_sw_maxValue, 1f));
        setNumberOfLine(a.getInt(R.styleable.constraintAttr_sw_numberOfLine, 1));
        setUnit(a.getString(R.styleable.constraintAttr_sw_unit));

        a.recycle();

    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// Path: stylishwidget/src/main/java/com/app/infideap/stylishwidget/util/Utils.java
// public class Utils {
//     public static float convertPixelsToDp(float px) {
//         DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
//         float dp = px / (metrics.densityDpi / 160f);
//         return Math.round(dp);
//     }
// 
//     public static float convertDpToPixel(float dp) {
//         DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
//         float px = dp * (metrics.densityDpi / 160f);
//         return Math.round(px);
//     }
// 
//     public static int adjustAlpha(int color, int alpha) {
//         int red = Color.red(color);
//         int green = Color.green(color);
//         int blue = Color.blue(color);
//         return Color.argb(alpha, red, green, blue);
//     }
// }


// Path: stylishwidget/src/main/java/com/app/infideap/stylishwidget/view/AMeter.java
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.os.Build;
import androidx.annotation.Px;
import androidx.annotation.RequiresApi;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import com.app.infideap.stylishwidget.R;
import com.app.infideap.stylishwidget.util.Utils;
import java.util.Locale;


        setTextSize(a.getDimension(R.styleable.textAttr_sw_textSize,
                getResources().getDimension(R.dimen.meterTextSize)));

        int textStyle;
        try {
            textStyle = a.getInt(R.styleable.textAttr_sw_textStyle, Typeface.BOLD);
        } catch (Exception e) {
            textStyle = Typeface.BOLD;
        }

        setTextStyle(textStyle);

        a.recycle();


        a = getContext().obtainStyledAttributes(attrs, R.styleable.constraintAttr);
        setShowText(a.getBoolean(R.styleable.constraintAttr_sw_showText, true));
        setValue(a.getFloat(R.styleable.constraintAttr_sw_value, 0f));
        setStartValue(a.getFloat(R.styleable.constraintAttr_sw_startValue, 0f));
        setMaxValue(a.getFloat(R.styleable.constraintAttr_sw_maxValue, 1f));
        setNumberOfLine(a.getInt(R.styleable.constraintAttr_sw_numberOfLine, 1));
        setUnit(a.getString(R.styleable.constraintAttr_sw_unit));

        a.recycle();

    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        if (getLayoutParams().width != getLayoutParams().height