package X6FRs_4.LGe8pk_15.KQgRr5e_0;

import X6FRs_4.IMuAHx_6.KNBe_11.FSaI4_7;
import android.animation.Animator;
import android.animation.ValueAnimator;
import android.content.Context;
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.animation.Interpolator;
import android.view.animation.LinearInterpolator;
/* compiled from: CircularProgressDrawable.java */
/* loaded from: classes.dex */
public class QxJ9d_1 extends Drawable implements Animatable {

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

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final PGPF6hQ_2 f978KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public Animator f979KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public Resources f980KQgRr5e_0;

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

    /* renamed from: QxJ9d_1  reason: collision with other field name */
    public boolean f982QxJ9d_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[] f976KQgRr5e_0 = {-16777216};

    /* compiled from: CircularProgressDrawable.java */
    /* loaded from: classes.dex */
    public class KQgRr5e_0 implements ValueAnimator.AnimatorUpdateListener {
        public final /* synthetic */ PGPF6hQ_2 KQgRr5e_0;

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

        @Override // android.animation.ValueAnimator.AnimatorUpdateListener
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
            QxJ9d_1.this.QxJ9d_1(floatValue, this.KQgRr5e_0);
            QxJ9d_1.this.KQgRr5e_0(floatValue, this.KQgRr5e_0, false);
            QxJ9d_1.this.invalidateSelf();
        }
    }

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

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

        /* renamed from: IMuAHx_6  reason: collision with root package name */
        public float f3219IMuAHx_6;

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

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

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

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

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

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

        /* renamed from: X6FRs_4  reason: collision with root package name */
        public float f3221X6FRs_4;

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

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

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

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

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

        /* renamed from: PGPF6hQ_2  reason: collision with other field name */
        public final Paint f992PGPF6hQ_2 = new Paint();
        public float KQgRr5e_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 f3220Mqv2r_3 = 5.0f;

        /* renamed from: FSaI4_7  reason: collision with root package name */
        public float f3217FSaI4_7 = 1.0f;

        /* renamed from: Mqv2r_3  reason: collision with other field name */
        public int f990Mqv2r_3 = 255;

        public PGPF6hQ_2() {
            this.f985KQgRr5e_0.setStrokeCap(Paint.Cap.SQUARE);
            this.f985KQgRr5e_0.setAntiAlias(true);
            this.f985KQgRr5e_0.setStyle(Paint.Style.STROKE);
            this.f994QxJ9d_1.setStyle(Paint.Style.FILL);
            this.f994QxJ9d_1.setAntiAlias(true);
            this.f992PGPF6hQ_2.setColor(0);
        }

        public void IFxWkV_5(float f) {
            this.f3220Mqv2r_3 = f;
            this.f985KQgRr5e_0.setStrokeWidth(f);
        }

        public void KQgRr5e_0(float f, float f2) {
            this.f993QxJ9d_1 = (int) f;
            this.f991PGPF6hQ_2 = (int) f2;
        }

        /* renamed from: Mqv2r_3  reason: collision with other method in class */
        public int m484Mqv2r_3() {
            return this.f989KQgRr5e_0[this.f984KQgRr5e_0];
        }

        public void PGPF6hQ_2(int i) {
            this.f984KQgRr5e_0 = i;
            this.f995X6FRs_4 = this.f989KQgRr5e_0[i];
        }

        public void QxJ9d_1(int i) {
            this.f995X6FRs_4 = i;
        }

        public void X6FRs_4(float f) {
            this.KQgRr5e_0 = f;
        }

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

        /* renamed from: QxJ9d_1  reason: collision with other method in class */
        public int m487QxJ9d_1() {
            return this.f989KQgRr5e_0[m485PGPF6hQ_2()];
        }

        public float X6FRs_4() {
            return this.f3221X6FRs_4;
        }

        public void KQgRr5e_0(Canvas canvas, Rect rect) {
            RectF rectF = this.f987KQgRr5e_0;
            float f = this.f3222Xgtqvk_8;
            float f2 = (this.f3220Mqv2r_3 / 2.0f) + f;
            if (f <= 0.0f) {
                f2 = (Math.min(rect.width(), rect.height()) / 2.0f) - Math.max((this.f993QxJ9d_1 * this.f3217FSaI4_7) / 2.0f, this.f3220Mqv2r_3 / 2.0f);
            }
            rectF.set(rect.centerX() - f2, rect.centerY() - f2, rect.centerX() + f2, rect.centerY() + f2);
            float f3 = this.KQgRr5e_0;
            float f4 = this.PGPF6hQ_2;
            float f5 = (f3 + f4) * 360.0f;
            float f6 = ((this.QxJ9d_1 + f4) * 360.0f) - f5;
            this.f985KQgRr5e_0.setColor(this.f995X6FRs_4);
            this.f985KQgRr5e_0.setAlpha(this.f990Mqv2r_3);
            float f7 = this.f3220Mqv2r_3 / 2.0f;
            rectF.inset(f7, f7);
            canvas.drawCircle(rectF.centerX(), rectF.centerY(), rectF.width() / 2.0f, this.f992PGPF6hQ_2);
            float f8 = -f7;
            rectF.inset(f8, f8);
            canvas.drawArc(rectF, f5, f6, false, this.f985KQgRr5e_0);
            KQgRr5e_0(canvas, f5, f6, rectF);
        }

        public float Mqv2r_3() {
            return this.f3219IMuAHx_6;
        }

        /* renamed from: PGPF6hQ_2  reason: collision with other method in class */
        public int m485PGPF6hQ_2() {
            return (this.f984KQgRr5e_0 + 1) % this.f989KQgRr5e_0.length;
        }

        public float QxJ9d_1() {
            return this.KQgRr5e_0;
        }

        public float PGPF6hQ_2() {
            return this.f3218IFxWkV_5;
        }

        public void QxJ9d_1(float f) {
            this.f3222Xgtqvk_8 = f;
        }

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

        /* renamed from: QxJ9d_1  reason: collision with other method in class */
        public void m488QxJ9d_1() {
            this.f3221X6FRs_4 = 0.0f;
            this.f3218IFxWkV_5 = 0.0f;
            this.f3219IMuAHx_6 = 0.0f;
            X6FRs_4(0.0f);
            PGPF6hQ_2(0.0f);
            Mqv2r_3(0.0f);
        }

        /* renamed from: PGPF6hQ_2  reason: collision with other method in class */
        public void m486PGPF6hQ_2() {
            this.f3221X6FRs_4 = this.KQgRr5e_0;
            this.f3218IFxWkV_5 = this.QxJ9d_1;
            this.f3219IMuAHx_6 = this.PGPF6hQ_2;
        }

        public void KQgRr5e_0(Canvas canvas, float f, float f2, RectF rectF) {
            if (this.f988KQgRr5e_0) {
                Path path = this.f986KQgRr5e_0;
                if (path == null) {
                    Path path2 = new Path();
                    this.f986KQgRr5e_0 = path2;
                    path2.setFillType(Path.FillType.EVEN_ODD);
                } else {
                    path.reset();
                }
                this.f986KQgRr5e_0.moveTo(0.0f, 0.0f);
                this.f986KQgRr5e_0.lineTo(this.f993QxJ9d_1 * this.f3217FSaI4_7, 0.0f);
                Path path3 = this.f986KQgRr5e_0;
                float f3 = this.f3217FSaI4_7;
                path3.lineTo((this.f993QxJ9d_1 * f3) / 2.0f, this.f991PGPF6hQ_2 * f3);
                this.f986KQgRr5e_0.offset(((Math.min(rectF.width(), rectF.height()) / 2.0f) + rectF.centerX()) - ((this.f993QxJ9d_1 * this.f3217FSaI4_7) / 2.0f), rectF.centerY() + (this.f3220Mqv2r_3 / 2.0f));
                this.f986KQgRr5e_0.close();
                this.f994QxJ9d_1.setColor(this.f995X6FRs_4);
                this.f994QxJ9d_1.setAlpha(this.f990Mqv2r_3);
                canvas.save();
                canvas.rotate(f + f2, rectF.centerX(), rectF.centerY());
                canvas.drawPath(this.f986KQgRr5e_0, this.f994QxJ9d_1);
                canvas.restore();
            }
        }

        public void KQgRr5e_0(int[] iArr) {
            this.f989KQgRr5e_0 = iArr;
            PGPF6hQ_2(0);
        }

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

        public void KQgRr5e_0(ColorFilter colorFilter) {
            this.f985KQgRr5e_0.setColorFilter(colorFilter);
        }

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

        /* renamed from: KQgRr5e_0  reason: collision with other method in class */
        public int m482KQgRr5e_0() {
            return this.f990Mqv2r_3;
        }

        public float KQgRr5e_0() {
            return this.QxJ9d_1;
        }

        public void KQgRr5e_0(boolean z) {
            if (this.f988KQgRr5e_0 != z) {
                this.f988KQgRr5e_0 = z;
            }
        }

        public void KQgRr5e_0(float f) {
            if (f != this.f3217FSaI4_7) {
                this.f3217FSaI4_7 = f;
            }
        }
    }

    /* compiled from: CircularProgressDrawable.java */
    /* renamed from: X6FRs_4.LGe8pk_15.KQgRr5e_0.QxJ9d_1$QxJ9d_1  reason: collision with other inner class name */
    /* loaded from: classes.dex */
    public class C0059QxJ9d_1 implements Animator.AnimatorListener {
        public final /* synthetic */ PGPF6hQ_2 KQgRr5e_0;

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

        @Override // android.animation.Animator.AnimatorListener
        public void onAnimationCancel(Animator animator) {
        }

        @Override // android.animation.Animator.AnimatorListener
        public void onAnimationEnd(Animator animator) {
        }

        @Override // android.animation.Animator.AnimatorListener
        public void onAnimationRepeat(Animator animator) {
            QxJ9d_1.this.KQgRr5e_0(1.0f, this.KQgRr5e_0, true);
            this.KQgRr5e_0.m486PGPF6hQ_2();
            this.KQgRr5e_0.m483KQgRr5e_0();
            QxJ9d_1 qxJ9d_1 = QxJ9d_1.this;
            if (qxJ9d_1.f982QxJ9d_1) {
                qxJ9d_1.f982QxJ9d_1 = false;
                animator.cancel();
                animator.setDuration(1332L);
                animator.start();
                this.KQgRr5e_0.KQgRr5e_0(false);
                return;
            }
            qxJ9d_1.f981QxJ9d_1 += 1.0f;
        }

        @Override // android.animation.Animator.AnimatorListener
        public void onAnimationStart(Animator animator) {
            QxJ9d_1.this.f981QxJ9d_1 = 0.0f;
        }
    }

    public QxJ9d_1(Context context) {
        FSaI4_7.KQgRr5e_0(context);
        this.f980KQgRr5e_0 = context.getResources();
        PGPF6hQ_2 pGPF6hQ_2 = new PGPF6hQ_2();
        this.f978KQgRr5e_0 = pGPF6hQ_2;
        pGPF6hQ_2.KQgRr5e_0(f976KQgRr5e_0);
        Mqv2r_3(2.5f);
        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(float f, float f2, float f3, float f4) {
        PGPF6hQ_2 pGPF6hQ_2 = this.f978KQgRr5e_0;
        float f5 = this.f980KQgRr5e_0.getDisplayMetrics().density;
        pGPF6hQ_2.IFxWkV_5(f2 * f5);
        pGPF6hQ_2.QxJ9d_1(f * f5);
        pGPF6hQ_2.PGPF6hQ_2(0);
        pGPF6hQ_2.KQgRr5e_0(f3 * f5, f4 * f5);
    }

    public void Mqv2r_3(float f) {
        this.f978KQgRr5e_0.IFxWkV_5(f);
        invalidateSelf();
    }

    public final void PGPF6hQ_2(float f) {
        this.f977KQgRr5e_0 = f;
    }

    public void QxJ9d_1(float f) {
        this.f978KQgRr5e_0.Mqv2r_3(f);
        invalidateSelf();
    }

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

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

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

    @Override // android.graphics.drawable.Animatable
    public boolean isRunning() {
        return this.f979KQgRr5e_0.isRunning();
    }

    @Override // android.graphics.drawable.Drawable
    public void setAlpha(int i) {
        this.f978KQgRr5e_0.KQgRr5e_0(i);
        invalidateSelf();
    }

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

    @Override // android.graphics.drawable.Animatable
    public void start() {
        this.f979KQgRr5e_0.cancel();
        this.f978KQgRr5e_0.m486PGPF6hQ_2();
        if (this.f978KQgRr5e_0.KQgRr5e_0() != this.f978KQgRr5e_0.QxJ9d_1()) {
            this.f982QxJ9d_1 = true;
            this.f979KQgRr5e_0.setDuration(666L);
            this.f979KQgRr5e_0.start();
            return;
        }
        this.f978KQgRr5e_0.PGPF6hQ_2(0);
        this.f978KQgRr5e_0.m488QxJ9d_1();
        this.f979KQgRr5e_0.setDuration(1332L);
        this.f979KQgRr5e_0.start();
    }

    @Override // android.graphics.drawable.Animatable
    public void stop() {
        this.f979KQgRr5e_0.cancel();
        PGPF6hQ_2(0.0f);
        this.f978KQgRr5e_0.KQgRr5e_0(false);
        this.f978KQgRr5e_0.PGPF6hQ_2(0);
        this.f978KQgRr5e_0.m488QxJ9d_1();
        invalidateSelf();
    }

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

    public void KQgRr5e_0(int i) {
        if (i == 0) {
            KQgRr5e_0(11.0f, 3.0f, 12.0f, 6.0f);
        } else {
            KQgRr5e_0(7.5f, 2.5f, 10.0f, 5.0f);
        }
        invalidateSelf();
    }

    public void KQgRr5e_0(boolean z) {
        this.f978KQgRr5e_0.KQgRr5e_0(z);
        invalidateSelf();
    }

    public void KQgRr5e_0(float f) {
        this.f978KQgRr5e_0.KQgRr5e_0(f);
        invalidateSelf();
    }

    public void KQgRr5e_0(float f, float f2) {
        this.f978KQgRr5e_0.X6FRs_4(f);
        this.f978KQgRr5e_0.PGPF6hQ_2(f2);
        invalidateSelf();
    }

    public void KQgRr5e_0(int... iArr) {
        this.f978KQgRr5e_0.KQgRr5e_0(iArr);
        this.f978KQgRr5e_0.PGPF6hQ_2(0);
        invalidateSelf();
    }

    public final void KQgRr5e_0(float f, PGPF6hQ_2 pGPF6hQ_2) {
        QxJ9d_1(f, pGPF6hQ_2);
        pGPF6hQ_2.X6FRs_4(pGPF6hQ_2.X6FRs_4() + (((pGPF6hQ_2.PGPF6hQ_2() - 0.01f) - pGPF6hQ_2.X6FRs_4()) * f));
        pGPF6hQ_2.PGPF6hQ_2(pGPF6hQ_2.PGPF6hQ_2());
        pGPF6hQ_2.Mqv2r_3(pGPF6hQ_2.Mqv2r_3() + ((((float) (Math.floor(pGPF6hQ_2.Mqv2r_3() / 0.8f) + 1.0d)) - pGPF6hQ_2.Mqv2r_3()) * f));
    }

    public void KQgRr5e_0(float f, PGPF6hQ_2 pGPF6hQ_2, boolean z) {
        float interpolation;
        float f2;
        if (this.f982QxJ9d_1) {
            KQgRr5e_0(f, pGPF6hQ_2);
        } else if (f != 1.0f || z) {
            float Mqv2r_32 = pGPF6hQ_2.Mqv2r_3();
            if (f < 0.5f) {
                interpolation = pGPF6hQ_2.X6FRs_4();
                f2 = (QxJ9d_1.getInterpolation(f / 0.5f) * 0.79f) + 0.01f + interpolation;
            } else {
                float X6FRs_42 = pGPF6hQ_2.X6FRs_4() + 0.79f;
                interpolation = X6FRs_42 - (((1.0f - QxJ9d_1.getInterpolation((f - 0.5f) / 0.5f)) * 0.79f) + 0.01f);
                f2 = X6FRs_42;
            }
            pGPF6hQ_2.X6FRs_4(interpolation);
            pGPF6hQ_2.PGPF6hQ_2(f2);
            pGPF6hQ_2.Mqv2r_3(Mqv2r_32 + (0.20999998f * f));
            PGPF6hQ_2((f + this.f981QxJ9d_1) * 216.0f);
        }
    }

    public final void KQgRr5e_0() {
        PGPF6hQ_2 pGPF6hQ_2 = this.f978KQgRr5e_0;
        ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f);
        ofFloat.addUpdateListener(new KQgRr5e_0(pGPF6hQ_2));
        ofFloat.setRepeatCount(-1);
        ofFloat.setRepeatMode(1);
        ofFloat.setInterpolator(KQgRr5e_0);
        ofFloat.addListener(new C0059QxJ9d_1(pGPF6hQ_2));
        this.f979KQgRr5e_0 = ofFloat;
    }
}
