// Path: loadanimlib/src/main/java/app/dinus/com/loadingdrawable/render/LoadingRenderer.java
// public abstract class LoadingRenderer {
//   private static final long ANIMATION_DURATION = 1333;
// //  private static final long ANIMATION_DURATION = 3000;
// 
//   private static final float DEFAULT_SIZE = 56.0f;
//   private static final float DEFAULT_CENTER_RADIUS = 12.5f;
//   private static final float DEFAULT_STROKE_WIDTH = 2.5f;
// 
//   protected float mWidth;
//   protected float mHeight;
//   protected float mStrokeWidth;
//   protected float mCenterRadius;
// 
//   private long mDuration;
//   private Drawable.Callback mCallback;
//   private ValueAnimator mRenderAnimator;
// 
//   public LoadingRenderer(Context context) {
//     setupDefaultParams(context);
//     setupAnimators();
//   }
// 
//   public abstract void draw(Canvas canvas, Rect bounds);
//   public abstract void computeRender(float renderProgress);
//   public abstract void setAlpha(int alpha);
//   public abstract void setColorFilter(ColorFilter cf);
//   public abstract void reset();
// 
//   public void start() {
//     reset();
//     setDuration(mDuration);
//     mRenderAnimator.start();
//   }
// 
//   public void stop() {
//     mRenderAnimator.cancel();
//   }
// 
//   public boolean isRunning() {
//     return mRenderAnimator.isRunning();
//   }
// 
//   public void setCallback(Drawable.Callback callback) {
//     this.mCallback = callback;
//   }
// 
//   protected void invalidateSelf() {
//     mCallback.invalidateDrawable(null);
//   }
// 
//   private void setupDefaultParams(Context context) {
//     final DisplayMetrics metrics = context.getResources().getDisplayMetrics();
//     final float screenDensity = metrics.density;
// 
//     mWidth = DEFAULT_SIZE * screenDensity;
//     mHeight = DEFAULT_SIZE * screenDensity;
//     mStrokeWidth = DEFAULT_STROKE_WIDTH * screenDensity;
//     mCenterRadius = DEFAULT_CENTER_RADIUS * screenDensity;
// 
//     mDuration = ANIMATION_DURATION;
//   }
// 
//   private void setupAnimators() {
//     mRenderAnimator = ValueAnimator.ofFloat(0.0f, 1.0f);
//     mRenderAnimator.setRepeatCount(Animation.INFINITE);
//     mRenderAnimator.setRepeatMode(Animation.RESTART);
//     mRenderAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
//       @Override
//       public void onAnimationUpdate(ValueAnimator animation) {
//         computeRender((float) animation.getAnimatedValue());
//         invalidateSelf();
//       }
//     });
//   }
// 
//   protected void addRenderListener(Animator.AnimatorListener animatorListener) {
//     mRenderAnimator.addListener(animatorListener);
//   }
// 
//   public void setCenterRadius(float centerRadius) {
//     mCenterRadius = centerRadius;
//   }
// 
//   public float getCenterRadius() {
//     return mCenterRadius;
//   }
// 
//   public void setStrokeWidth(float strokeWidth) {
//     mStrokeWidth = strokeWidth;
//   }
// 
//   public float getStrokeWidth() {
//     return mStrokeWidth;
//   }
// 
//   public float getWidth() {
//     return mWidth;
//   }
// 
//   public void setWidth(float width) {
//     this.mWidth = width;
//   }
// 
//   public float getHeight() {
//     return mHeight;
//   }
// 
//   public void setHeight(float height) {
//     this.mHeight = height;
//   }
// 
//   public long getDuration() {
//     return mDuration;
//   }
// 
//   public void setDuration(long duration) {
//     this.mDuration = duration;
//     mRenderAnimator.setDuration(mDuration);
//   }
// }


import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.support.annotation.NonNull;
import android.support.v4.view.animation.FastOutSlowInInterpolator;
import android.view.animation.Interpolator;
import app.dinus.com.loadingdrawable.render.LoadingRenderer;
  private final RectF mTempBounds = new RectF();

  private final Animator.AnimatorListener mAnimatorListener = new AnimatorListenerAdapter() {
    @Override
    public void onAnimationRepeat(Animator animator) {
      super.onAnimationRepeat(animator);
      storeOriginals();

      mStartTrim = mEndTrim;
      mRotationCount = (mRotationCount + 1) % (NUM_POINTS);
    }

    @Override
    public void onAnimationStart(Animator animation) {
      super.onAnimationStart(animation);
      mRotationCount = 0;
    }
  };

  private int[] mColors;

  private float mStrokeInset;

  private float mEndTrim;
  private float mRotation;
  private float mStartTrim;
  private float mRotationCount;
  private float mGroupRotation;
  private float mOriginEndTrim;
  private float mOriginRotation;
// Path: loadanimlib/src/main/java/app/dinus/com/loadingdrawable/render/LoadingRenderer.java
// public abstract class LoadingRenderer {
//   private static final long ANIMATION_DURATION = 1333;
// //  private static final long ANIMATION_DURATION = 3000;
// 
//   private static final float DEFAULT_SIZE = 56.0f;
//   private static final float DEFAULT_CENTER_RADIUS = 12.5f;
//   private static final float DEFAULT_STROKE_WIDTH = 2.5f;
// 
//   protected float mWidth;
//   protected float mHeight;
//   protected float mStrokeWidth;
//   protected float mCenterRadius;
// 
//   private long mDuration;
//   private Drawable.Callback mCallback;
//   private ValueAnimator mRenderAnimator;
// 
//   public LoadingRenderer(Context context) {
//     setupDefaultParams(context);
//     setupAnimators();
//   }
// 
//   public abstract void draw(Canvas canvas, Rect bounds);
//   public abstract void computeRender(float renderProgress);
//   public abstract void setAlpha(int alpha);
//   public abstract void setColorFilter(ColorFilter cf);
//   public abstract void reset();
// 
//   public void start() {
//     reset();
//     setDuration(mDuration);
//     mRenderAnimator.start();
//   }
// 
//   public void stop() {
//     mRenderAnimator.cancel();
//   }
// 
//   public boolean isRunning() {
//     return mRenderAnimator.isRunning();
//   }
// 
//   public void setCallback(Drawable.Callback callback) {
//     this.mCallback = callback;
//   }
// 
//   protected void invalidateSelf() {
//     mCallback.invalidateDrawable(null);
//   }
// 
//   private void setupDefaultParams(Context context) {
//     final DisplayMetrics metrics = context.getResources().getDisplayMetrics();
//     final float screenDensity = metrics.density;
// 
//     mWidth = DEFAULT_SIZE * screenDensity;
//     mHeight = DEFAULT_SIZE * screenDensity;
//     mStrokeWidth = DEFAULT_STROKE_WIDTH * screenDensity;
//     mCenterRadius = DEFAULT_CENTER_RADIUS * screenDensity;
// 
//     mDuration = ANIMATION_DURATION;
//   }
// 
//   private void setupAnimators() {
//     mRenderAnimator = ValueAnimator.ofFloat(0.0f, 1.0f);
//     mRenderAnimator.setRepeatCount(Animation.INFINITE);
//     mRenderAnimator.setRepeatMode(Animation.RESTART);
//     mRenderAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
//       @Override
//       public void onAnimationUpdate(ValueAnimator animation) {
//         computeRender((float) animation.getAnimatedValue());
//         invalidateSelf();
//       }
//     });
//   }
// 
//   protected void addRenderListener(Animator.AnimatorListener animatorListener) {
//     mRenderAnimator.addListener(animatorListener);
//   }
// 
//   public void setCenterRadius(float centerRadius) {
//     mCenterRadius = centerRadius;
//   }
// 
//   public float getCenterRadius() {
//     return mCenterRadius;
//   }
// 
//   public void setStrokeWidth(float strokeWidth) {
//     mStrokeWidth = strokeWidth;
//   }
// 
//   public float getStrokeWidth() {
//     return mStrokeWidth;
//   }
// 
//   public float getWidth() {
//     return mWidth;
//   }
// 
//   public void setWidth(float width) {
//     this.mWidth = width;
//   }
// 
//   public float getHeight() {
//     return mHeight;
//   }
// 
//   public void setHeight(float height) {
//     this.mHeight = height;
//   }
// 
//   public long getDuration() {
//     return mDuration;
//   }
// 
//   public void setDuration(long duration) {
//     this.mDuration = duration;
//     mRenderAnimator.setDuration(mDuration);
//   }
// }


// Path: loadanimlib/src/main/java/app/dinus/com/loadingdrawable/render/circle/rotate/WhorlLoadingRenderer.java
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.support.annotation.NonNull;
import android.support.v4.view.animation.FastOutSlowInInterpolator;
import android.view.animation.Interpolator;
import app.dinus.com.loadingdrawable.render.LoadingRenderer;

  private final RectF mTempBounds = new RectF();

  private final Animator.AnimatorListener mAnimatorListener = new AnimatorListenerAdapter() {
    @Override
    public void onAnimationRepeat(Animator animator) {
      super.onAnimationRepeat(animator);
      storeOriginals();

      mStartTrim = mEndTrim;
      mRotationCount = (mRotationCount + 1) % (NUM_POINTS);
    }

    @Override
    public void onAnimationStart(Animator animation) {
      super.onAnimationStart(animation);
      mRotationCount = 0;
    }
  };

  private int[] mColors;

  private float mStrokeInset;

  private float mEndTrim;
  private float mRotation;
  private float mStartTrim;
  private float mRotationCount;
  private float mGroupRotation;
  private float mOriginEndTrim;
  private float mOriginRotation;
  private float mOriginStartTrim;