// Path: library/src/main/java/com/dreamliner/ptrlib/util/PtrLocalDisplay.java
// public class PtrLocalDisplay {
// 
//     public static int SCREEN_WIDTH_PIXELS;
//     public static int SCREEN_HEIGHT_PIXELS;
//     public static float SCREEN_DENSITY;
//     public static int SCREEN_WIDTH_DP;
//     public static int SCREEN_HEIGHT_DP;
// 
//     public static void init(Context context) {
//         if (context == null) {
//             return;
//         }
//         DisplayMetrics dm = new DisplayMetrics();
//         WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
//         wm.getDefaultDisplay().getMetrics(dm);
//         SCREEN_WIDTH_PIXELS = dm.widthPixels;
//         SCREEN_HEIGHT_PIXELS = dm.heightPixels;
//         SCREEN_DENSITY = dm.density;
//         SCREEN_WIDTH_DP = (int) (SCREEN_WIDTH_PIXELS / dm.density);
//         SCREEN_HEIGHT_DP = (int) (SCREEN_HEIGHT_PIXELS / dm.density);
//     }
// 
//     public static int dp2px(float dp) {
//         final float scale = SCREEN_DENSITY;
//         return (int) (dp * scale + 0.5f);
//     }
// 
//     public static int designedDP2px(float designedDp) {
//         if (SCREEN_WIDTH_DP != 320) {
//             designedDp = designedDp * SCREEN_WIDTH_DP / 320f;
//         }
//         return dp2px(designedDp);
//     }
// 
//     public static void setPadding(final View view, float left, float top, float right, float bottom) {
//         view.setPadding(designedDP2px(left), dp2px(top), designedDP2px(right), dp2px(bottom));
//     }
// }


import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.graphics.PixelFormat;
import android.graphics.RadialGradient;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.OvalShape;
import android.os.Build;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
import android.view.animation.Transformation;
import com.dreamliner.ptrlib.util.PtrLocalDisplay;
import java.util.ArrayList;
    private double mHeight;
    private Animation mFinishAnimation;
    private int mBackgroundColor;
    private ShapeDrawable mShadow;

    public MaterialProgressDrawable(Context context, View parent) {
        mParent = parent;
        mResources = context.getResources();
        mRing = new Ring(mCallback);
        mRing.setColors(COLORS);
        updateSizes(DEFAULT);
        setupAnimators();
    }

    private void setSizeParameters(double progressCircleWidth, double progressCircleHeight,
                                   double centerRadius, double strokeWidth, float arrowWidth, float arrowHeight) {
        final Ring ring = mRing;
        final DisplayMetrics metrics = mResources.getDisplayMetrics();
        final float screenDensity = metrics.density;
        mWidth = progressCircleWidth * screenDensity;
        mHeight = progressCircleHeight * screenDensity;
        ring.setStrokeWidth((float) strokeWidth * screenDensity);
        ring.setCenterRadius(centerRadius * screenDensity);
        ring.setColorIndex(0);
        ring.setArrowDimensions(arrowWidth * screenDensity, arrowHeight * screenDensity);
        ring.setInsets((int) mWidth, (int) mHeight);
        setUp(mWidth);
    }

    private void setUp(final double diameter) {
// Path: library/src/main/java/com/dreamliner/ptrlib/util/PtrLocalDisplay.java
// public class PtrLocalDisplay {
// 
//     public static int SCREEN_WIDTH_PIXELS;
//     public static int SCREEN_HEIGHT_PIXELS;
//     public static float SCREEN_DENSITY;
//     public static int SCREEN_WIDTH_DP;
//     public static int SCREEN_HEIGHT_DP;
// 
//     public static void init(Context context) {
//         if (context == null) {
//             return;
//         }
//         DisplayMetrics dm = new DisplayMetrics();
//         WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
//         wm.getDefaultDisplay().getMetrics(dm);
//         SCREEN_WIDTH_PIXELS = dm.widthPixels;
//         SCREEN_HEIGHT_PIXELS = dm.heightPixels;
//         SCREEN_DENSITY = dm.density;
//         SCREEN_WIDTH_DP = (int) (SCREEN_WIDTH_PIXELS / dm.density);
//         SCREEN_HEIGHT_DP = (int) (SCREEN_HEIGHT_PIXELS / dm.density);
//     }
// 
//     public static int dp2px(float dp) {
//         final float scale = SCREEN_DENSITY;
//         return (int) (dp * scale + 0.5f);
//     }
// 
//     public static int designedDP2px(float designedDp) {
//         if (SCREEN_WIDTH_DP != 320) {
//             designedDp = designedDp * SCREEN_WIDTH_DP / 320f;
//         }
//         return dp2px(designedDp);
//     }
// 
//     public static void setPadding(final View view, float left, float top, float right, float bottom) {
//         view.setPadding(designedDP2px(left), dp2px(top), designedDP2px(right), dp2px(bottom));
//     }
// }


// Path: library/src/main/java/com/dreamliner/ptrlib/header/MaterialProgressDrawable.java
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.graphics.PixelFormat;
import android.graphics.RadialGradient;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.OvalShape;
import android.os.Build;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
import android.view.animation.Transformation;
import com.dreamliner.ptrlib.util.PtrLocalDisplay;
import java.util.ArrayList;

    private double mHeight;
    private Animation mFinishAnimation;
    private int mBackgroundColor;
    private ShapeDrawable mShadow;

    public MaterialProgressDrawable(Context context, View parent) {
        mParent = parent;
        mResources = context.getResources();
        mRing = new Ring(mCallback);
        mRing.setColors(COLORS);
        updateSizes(DEFAULT);
        setupAnimators();
    }

    private void setSizeParameters(double progressCircleWidth, double progressCircleHeight,
                                   double centerRadius, double strokeWidth, float arrowWidth, float arrowHeight) {
        final Ring ring = mRing;
        final DisplayMetrics metrics = mResources.getDisplayMetrics();
        final float screenDensity = metrics.density;
        mWidth = progressCircleWidth * screenDensity;
        mHeight = progressCircleHeight * screenDensity;
        ring.setStrokeWidth((float) strokeWidth * screenDensity);
        ring.setCenterRadius(centerRadius * screenDensity);
        ring.setColorIndex(0);
        ring.setArrowDimensions(arrowWidth * screenDensity, arrowHeight * screenDensity);
        ring.setInsets((int) mWidth, (int) mHeight);
        setUp(mWidth);
    }

    private void setUp(final double diameter) {
        PtrLocalDisplay.init(mParent.getContext());