package IMuAHx_6.Mqv2r_3.KQgRr5e_0.KQgRr5e_0.PGPF6hQ_2;

import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
import android.view.animation.Transformation;
import com.google.android.material.shadow.ShadowDrawableWrapper;
import java.util.ArrayList;
import java.util.List;
/* compiled from: MaterialProgressDrawable.java */
/* loaded from: classes.dex */
public class KQgRr5e_0 extends Drawable implements Animatable {

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public float f215KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public View f217KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public Animation f218KQgRr5e_0;

    /* renamed from: Mqv2r_3  reason: collision with root package name */
    public float f3067Mqv2r_3;
    public float PGPF6hQ_2;

    /* renamed from: QxJ9d_1  reason: collision with other field name */
    public float f220QxJ9d_1;

    /* renamed from: QxJ9d_1  reason: collision with other field name */
    public boolean f221QxJ9d_1;
    public static final Interpolator KQgRr5e_0 = new LinearInterpolator();
    public static final Interpolator QxJ9d_1 = new X6FRs_4.Nm6q_10.KQgRr5e_0.KQgRr5e_0.QxJ9d_1();

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public static final int[] f214KQgRr5e_0 = {-16777216};

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final List<Animation> f219KQgRr5e_0 = new ArrayList();

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final PGPF6hQ_2 f216KQgRr5e_0 = new PGPF6hQ_2(this);

    /* compiled from: MaterialProgressDrawable.java */
    /* renamed from: IMuAHx_6.Mqv2r_3.KQgRr5e_0.KQgRr5e_0.PGPF6hQ_2.KQgRr5e_0$KQgRr5e_0  reason: collision with other inner class name */
    /* loaded from: classes.dex */
    public class C0014KQgRr5e_0 extends Animation {
        public final /* synthetic */ PGPF6hQ_2 KQgRr5e_0;

        public C0014KQgRr5e_0(PGPF6hQ_2 pGPF6hQ_2) {
            this.KQgRr5e_0 = pGPF6hQ_2;
        }

        @Override // android.view.animation.Animation
        public void applyTransformation(float f, Transformation transformation) {
            KQgRr5e_0 kQgRr5e_0 = KQgRr5e_0.this;
            if (kQgRr5e_0.f221QxJ9d_1) {
                kQgRr5e_0.KQgRr5e_0(f, this.KQgRr5e_0);
                return;
            }
            float KQgRr5e_0 = kQgRr5e_0.KQgRr5e_0(this.KQgRr5e_0);
            PGPF6hQ_2 pGPF6hQ_2 = this.KQgRr5e_0;
            float f2 = pGPF6hQ_2.f3070IMuAHx_6;
            float f3 = pGPF6hQ_2.f3069IFxWkV_5;
            float f4 = pGPF6hQ_2.f3068FSaI4_7;
            KQgRr5e_0.this.QxJ9d_1(f, pGPF6hQ_2);
            if (f <= 0.5f) {
                this.KQgRr5e_0.f224KQgRr5e_0 = f3 + ((0.8f - KQgRr5e_0) * KQgRr5e_0.QxJ9d_1.getInterpolation(f / 0.5f));
            }
            if (f > 0.5f) {
                this.KQgRr5e_0.QxJ9d_1 = f2 + ((0.8f - KQgRr5e_0) * KQgRr5e_0.QxJ9d_1.getInterpolation((f - 0.5f) / 0.5f));
            }
            KQgRr5e_0.this.QxJ9d_1(f4 + (0.25f * f));
            KQgRr5e_0 kQgRr5e_02 = KQgRr5e_0.this;
            kQgRr5e_02.PGPF6hQ_2((f * 216.0f) + ((kQgRr5e_02.f220QxJ9d_1 / 5.0f) * 1080.0f));
        }
    }

    /* compiled from: MaterialProgressDrawable.java */
    /* loaded from: classes.dex */
    public class PGPF6hQ_2 {

        /* renamed from: FSaI4_7  reason: collision with root package name */
        public float f3068FSaI4_7;

        /* renamed from: IFxWkV_5  reason: collision with root package name */
        public float f3069IFxWkV_5;

        /* renamed from: IFxWkV_5  reason: collision with other field name */
        public int f223IFxWkV_5;

        /* renamed from: IMuAHx_6  reason: collision with root package name */
        public float f3070IMuAHx_6;
        public double KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public int f225KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public Path f227KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public boolean f229KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public int[] f230KQgRr5e_0;

        /* renamed from: Mqv2r_3  reason: collision with other field name */
        public int f231Mqv2r_3;

        /* renamed from: PGPF6hQ_2  reason: collision with other field name */
        public int f232PGPF6hQ_2;

        /* renamed from: QxJ9d_1  reason: collision with other field name */
        public int f234QxJ9d_1;

        /* renamed from: X6FRs_4  reason: collision with other field name */
        public int f236X6FRs_4;

        /* renamed from: Xgtqvk_8  reason: collision with root package name */
        public float f3073Xgtqvk_8;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public final RectF f228KQgRr5e_0 = new RectF();

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public final Paint f226KQgRr5e_0 = new Paint();

        /* renamed from: QxJ9d_1  reason: collision with other field name */
        public final Paint f235QxJ9d_1 = new Paint();

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public float f224KQgRr5e_0 = 0.0f;
        public float QxJ9d_1 = 0.0f;
        public float PGPF6hQ_2 = 0.0f;

        /* renamed from: Mqv2r_3  reason: collision with root package name */
        public float f3071Mqv2r_3 = 5.0f;

        /* renamed from: X6FRs_4  reason: collision with root package name */
        public float f3072X6FRs_4 = 2.5f;

        /* renamed from: PGPF6hQ_2  reason: collision with other field name */
        public final Paint f233PGPF6hQ_2 = new Paint(1);

        public PGPF6hQ_2(KQgRr5e_0 kQgRr5e_0) {
            this.f226KQgRr5e_0.setStrokeCap(Paint.Cap.SQUARE);
            this.f226KQgRr5e_0.setAntiAlias(true);
            this.f226KQgRr5e_0.setStyle(Paint.Style.STROKE);
            this.f235QxJ9d_1.setStyle(Paint.Style.FILL);
            this.f235QxJ9d_1.setAntiAlias(true);
        }

        public void KQgRr5e_0(Canvas canvas, Rect rect) {
            RectF rectF = this.f228KQgRr5e_0;
            rectF.set(rect);
            float f = this.f3072X6FRs_4;
            rectF.inset(f, f);
            float f2 = this.f224KQgRr5e_0;
            float f3 = this.PGPF6hQ_2;
            float f4 = (f2 + f3) * 360.0f;
            float f5 = ((this.QxJ9d_1 + f3) * 360.0f) - f4;
            if (f5 != 0.0f) {
                this.f226KQgRr5e_0.setColor(this.f223IFxWkV_5);
                canvas.drawArc(rectF, f4, f5, false, this.f226KQgRr5e_0);
            }
            KQgRr5e_0(canvas, f4, f5, rect);
            if (this.f231Mqv2r_3 < 255) {
                this.f233PGPF6hQ_2.setColor(this.f236X6FRs_4);
                this.f233PGPF6hQ_2.setAlpha(255 - this.f231Mqv2r_3);
                canvas.drawCircle(rect.exactCenterX(), rect.exactCenterY(), rect.width() / 2.0f, this.f233PGPF6hQ_2);
            }
        }

        public int PGPF6hQ_2() {
            return this.f230KQgRr5e_0[this.f225KQgRr5e_0];
        }

        public final int QxJ9d_1() {
            return (this.f225KQgRr5e_0 + 1) % this.f230KQgRr5e_0.length;
        }

        /* renamed from: PGPF6hQ_2  reason: collision with other method in class */
        public void m116PGPF6hQ_2() {
            this.f3069IFxWkV_5 = this.f224KQgRr5e_0;
            this.f3070IMuAHx_6 = this.QxJ9d_1;
            this.f3068FSaI4_7 = this.PGPF6hQ_2;
        }

        /* renamed from: QxJ9d_1  reason: collision with other method in class */
        public void m117QxJ9d_1() {
            this.f3069IFxWkV_5 = 0.0f;
            this.f3070IMuAHx_6 = 0.0f;
            this.f3068FSaI4_7 = 0.0f;
            this.f224KQgRr5e_0 = 0.0f;
            this.QxJ9d_1 = 0.0f;
            this.PGPF6hQ_2 = 0.0f;
        }

        public final void KQgRr5e_0(Canvas canvas, float f, float f2, Rect rect) {
            if (this.f229KQgRr5e_0) {
                Path path = this.f227KQgRr5e_0;
                if (path == null) {
                    Path path2 = new Path();
                    this.f227KQgRr5e_0 = path2;
                    path2.setFillType(Path.FillType.EVEN_ODD);
                } else {
                    path.reset();
                }
                float f3 = (((int) this.f3072X6FRs_4) / 2) * this.f3073Xgtqvk_8;
                double cos = this.KQgRr5e_0 * Math.cos(ShadowDrawableWrapper.COS_45);
                double exactCenterX = rect.exactCenterX();
                Double.isNaN(exactCenterX);
                double sin = this.KQgRr5e_0 * Math.sin(ShadowDrawableWrapper.COS_45);
                double exactCenterY = rect.exactCenterY();
                Double.isNaN(exactCenterY);
                float f4 = (float) (sin + exactCenterY);
                this.f227KQgRr5e_0.moveTo(0.0f, 0.0f);
                this.f227KQgRr5e_0.lineTo(this.f234QxJ9d_1 * this.f3073Xgtqvk_8, 0.0f);
                Path path3 = this.f227KQgRr5e_0;
                float f5 = this.f3073Xgtqvk_8;
                path3.lineTo((this.f234QxJ9d_1 * f5) / 2.0f, this.f232PGPF6hQ_2 * f5);
                this.f227KQgRr5e_0.offset(((float) (cos + exactCenterX)) - f3, f4);
                this.f227KQgRr5e_0.close();
                this.f235QxJ9d_1.setColor(this.f223IFxWkV_5);
                canvas.rotate((f + f2) - 5.0f, rect.exactCenterX(), rect.exactCenterY());
                canvas.drawPath(this.f227KQgRr5e_0, this.f235QxJ9d_1);
            }
        }

        public void KQgRr5e_0(int i) {
            this.f225KQgRr5e_0 = i;
            this.f223IFxWkV_5 = this.f230KQgRr5e_0[i];
        }

        public int KQgRr5e_0() {
            return this.f230KQgRr5e_0[QxJ9d_1()];
        }

        /* renamed from: KQgRr5e_0  reason: collision with other method in class */
        public void m115KQgRr5e_0() {
            KQgRr5e_0(QxJ9d_1());
        }

        public void KQgRr5e_0(int i, int i2) {
            double ceil;
            float min = Math.min(i, i2);
            double d = this.KQgRr5e_0;
            if (d > ShadowDrawableWrapper.COS_45 && min >= 0.0f) {
                double d2 = min / 2.0f;
                Double.isNaN(d2);
                ceil = d2 - d;
            } else {
                ceil = Math.ceil(this.f3071Mqv2r_3 / 2.0f);
            }
            this.f3072X6FRs_4 = (float) ceil;
        }
    }

    /* compiled from: MaterialProgressDrawable.java */
    /* loaded from: classes.dex */
    public class QxJ9d_1 implements Animation.AnimationListener {
        public final /* synthetic */ PGPF6hQ_2 KQgRr5e_0;

        public QxJ9d_1(PGPF6hQ_2 pGPF6hQ_2) {
            this.KQgRr5e_0 = pGPF6hQ_2;
        }

        @Override // android.view.animation.Animation.AnimationListener
        public void onAnimationEnd(Animation animation) {
        }

        @Override // android.view.animation.Animation.AnimationListener
        public void onAnimationRepeat(Animation animation) {
            this.KQgRr5e_0.m116PGPF6hQ_2();
            this.KQgRr5e_0.m115KQgRr5e_0();
            PGPF6hQ_2 pGPF6hQ_2 = this.KQgRr5e_0;
            pGPF6hQ_2.f224KQgRr5e_0 = pGPF6hQ_2.QxJ9d_1;
            KQgRr5e_0 kQgRr5e_0 = KQgRr5e_0.this;
            if (kQgRr5e_0.f221QxJ9d_1) {
                kQgRr5e_0.f221QxJ9d_1 = false;
                animation.setDuration(1332L);
                KQgRr5e_0.this.KQgRr5e_0(false);
                return;
            }
            kQgRr5e_0.f220QxJ9d_1 = (kQgRr5e_0.f220QxJ9d_1 + 1.0f) % 5.0f;
        }

        @Override // android.view.animation.Animation.AnimationListener
        public void onAnimationStart(Animation animation) {
            KQgRr5e_0.this.f220QxJ9d_1 = 0.0f;
        }
    }

    public KQgRr5e_0(View view) {
        this.f217KQgRr5e_0 = view;
        KQgRr5e_0(f214KQgRr5e_0);
        QxJ9d_1(1);
        KQgRr5e_0();
    }

    public final int KQgRr5e_0(float f, int i, int i2) {
        int i3 = (i >> 24) & 255;
        int i4 = (i >> 16) & 255;
        int i5 = (i >> 8) & 255;
        int i6 = i & 255;
        return ((i3 + ((int) ((((i2 >> 24) & 255) - i3) * f))) << 24) | ((i4 + ((int) ((((i2 >> 16) & 255) - i4) * f))) << 16) | ((i5 + ((int) ((((i2 >> 8) & 255) - i5) * f))) << 8) | (i6 + ((int) (f * ((i2 & 255) - i6))));
    }

    public final void KQgRr5e_0(int i, int i2, float f, float f2, float f3, float f4) {
        float f5 = Resources.getSystem().getDisplayMetrics().density;
        this.PGPF6hQ_2 = i * f5;
        this.f3067Mqv2r_3 = i2 * f5;
        this.f216KQgRr5e_0.KQgRr5e_0(0);
        float f6 = f2 * f5;
        this.f216KQgRr5e_0.f226KQgRr5e_0.setStrokeWidth(f6);
        PGPF6hQ_2 pGPF6hQ_2 = this.f216KQgRr5e_0;
        pGPF6hQ_2.f3071Mqv2r_3 = f6;
        pGPF6hQ_2.KQgRr5e_0 = f * f5;
        pGPF6hQ_2.f234QxJ9d_1 = (int) (f3 * f5);
        pGPF6hQ_2.f232PGPF6hQ_2 = (int) (f4 * f5);
        pGPF6hQ_2.KQgRr5e_0((int) this.PGPF6hQ_2, (int) this.f3067Mqv2r_3);
        invalidateSelf();
    }

    public void PGPF6hQ_2(float f) {
        this.f215KQgRr5e_0 = f;
        invalidateSelf();
    }

    public void QxJ9d_1(int i) {
        if (i == 0) {
            KQgRr5e_0(56, 56, 12.5f, 3.0f, 12.0f, 6.0f);
        } else {
            KQgRr5e_0(40, 40, 8.75f, 2.5f, 10.0f, 5.0f);
        }
    }

    @Override // android.graphics.drawable.Drawable
    public void draw(Canvas canvas) {
        Rect bounds = getBounds();
        int save = canvas.save();
        canvas.rotate(this.f215KQgRr5e_0, bounds.exactCenterX(), bounds.exactCenterY());
        this.f216KQgRr5e_0.KQgRr5e_0(canvas, bounds);
        canvas.restoreToCount(save);
    }

    @Override // android.graphics.drawable.Drawable
    public int getAlpha() {
        return this.f216KQgRr5e_0.f231Mqv2r_3;
    }

    @Override // android.graphics.drawable.Drawable
    public int getIntrinsicHeight() {
        return (int) this.f3067Mqv2r_3;
    }

    @Override // android.graphics.drawable.Drawable
    public int getIntrinsicWidth() {
        return (int) this.PGPF6hQ_2;
    }

    @Override // android.graphics.drawable.Drawable
    public int getOpacity() {
        return -3;
    }

    @Override // android.graphics.drawable.Animatable
    public boolean isRunning() {
        List<Animation> list = this.f219KQgRr5e_0;
        int size = list.size();
        for (int i = 0; i < size; i++) {
            Animation animation = list.get(i);
            if (animation.hasStarted() && !animation.hasEnded()) {
                return true;
            }
        }
        return false;
    }

    @Override // android.graphics.drawable.Drawable
    public void setAlpha(int i) {
        this.f216KQgRr5e_0.f231Mqv2r_3 = i;
    }

    @Override // android.graphics.drawable.Drawable
    public void setColorFilter(ColorFilter colorFilter) {
        this.f216KQgRr5e_0.f226KQgRr5e_0.setColorFilter(colorFilter);
        invalidateSelf();
    }

    @Override // android.graphics.drawable.Animatable
    public void start() {
        this.f218KQgRr5e_0.reset();
        this.f216KQgRr5e_0.m116PGPF6hQ_2();
        PGPF6hQ_2 pGPF6hQ_2 = this.f216KQgRr5e_0;
        if (pGPF6hQ_2.QxJ9d_1 != pGPF6hQ_2.f224KQgRr5e_0) {
            this.f221QxJ9d_1 = true;
            this.f218KQgRr5e_0.setDuration(666L);
            this.f217KQgRr5e_0.startAnimation(this.f218KQgRr5e_0);
            return;
        }
        pGPF6hQ_2.KQgRr5e_0(0);
        this.f216KQgRr5e_0.m117QxJ9d_1();
        this.f218KQgRr5e_0.setDuration(1332L);
        this.f217KQgRr5e_0.startAnimation(this.f218KQgRr5e_0);
    }

    @Override // android.graphics.drawable.Animatable
    public void stop() {
        this.f217KQgRr5e_0.clearAnimation();
        this.f216KQgRr5e_0.KQgRr5e_0(0);
        this.f216KQgRr5e_0.m117QxJ9d_1();
        KQgRr5e_0(false);
        PGPF6hQ_2(0.0f);
    }

    public void QxJ9d_1(float f) {
        this.f216KQgRr5e_0.PGPF6hQ_2 = f;
        invalidateSelf();
    }

    public void QxJ9d_1(float f, PGPF6hQ_2 pGPF6hQ_2) {
        if (f > 0.75f) {
            pGPF6hQ_2.f223IFxWkV_5 = KQgRr5e_0((f - 0.75f) / 0.25f, pGPF6hQ_2.PGPF6hQ_2(), pGPF6hQ_2.KQgRr5e_0());
        }
    }

    public void KQgRr5e_0(boolean z) {
        PGPF6hQ_2 pGPF6hQ_2 = this.f216KQgRr5e_0;
        if (pGPF6hQ_2.f229KQgRr5e_0 != z) {
            pGPF6hQ_2.f229KQgRr5e_0 = z;
            invalidateSelf();
        }
    }

    public void KQgRr5e_0(float f) {
        PGPF6hQ_2 pGPF6hQ_2 = this.f216KQgRr5e_0;
        if (pGPF6hQ_2.f3073Xgtqvk_8 != f) {
            pGPF6hQ_2.f3073Xgtqvk_8 = f;
            invalidateSelf();
        }
    }

    public void KQgRr5e_0(float f, float f2) {
        PGPF6hQ_2 pGPF6hQ_2 = this.f216KQgRr5e_0;
        pGPF6hQ_2.f224KQgRr5e_0 = f;
        pGPF6hQ_2.QxJ9d_1 = f2;
        invalidateSelf();
    }

    public void KQgRr5e_0(int i) {
        this.f216KQgRr5e_0.f236X6FRs_4 = i;
    }

    public void KQgRr5e_0(int... iArr) {
        PGPF6hQ_2 pGPF6hQ_2 = this.f216KQgRr5e_0;
        pGPF6hQ_2.f230KQgRr5e_0 = iArr;
        pGPF6hQ_2.KQgRr5e_0(0);
    }

    public float KQgRr5e_0(PGPF6hQ_2 pGPF6hQ_2) {
        double d = pGPF6hQ_2.f3071Mqv2r_3;
        Double.isNaN(d);
        return (float) Math.toRadians(d / (pGPF6hQ_2.KQgRr5e_0 * 6.283185307179586d));
    }

    public void KQgRr5e_0(float f, PGPF6hQ_2 pGPF6hQ_2) {
        QxJ9d_1(f, pGPF6hQ_2);
        float KQgRr5e_02 = KQgRr5e_0(pGPF6hQ_2);
        float f2 = pGPF6hQ_2.f3069IFxWkV_5;
        float f3 = pGPF6hQ_2.f3070IMuAHx_6;
        KQgRr5e_0(f2 + (((f3 - KQgRr5e_02) - f2) * f), f3);
        float f4 = pGPF6hQ_2.f3068FSaI4_7;
        QxJ9d_1(f4 + ((((float) (Math.floor(pGPF6hQ_2.f3068FSaI4_7 / 0.8f) + 1.0d)) - f4) * f));
    }

    public final void KQgRr5e_0() {
        PGPF6hQ_2 pGPF6hQ_2 = this.f216KQgRr5e_0;
        C0014KQgRr5e_0 c0014KQgRr5e_0 = new C0014KQgRr5e_0(pGPF6hQ_2);
        c0014KQgRr5e_0.setRepeatCount(-1);
        c0014KQgRr5e_0.setRepeatMode(1);
        c0014KQgRr5e_0.setInterpolator(KQgRr5e_0);
        c0014KQgRr5e_0.setAnimationListener(new QxJ9d_1(pGPF6hQ_2));
        this.f218KQgRr5e_0 = c0014KQgRr5e_0;
    }
}
