package ඓ.㿎.K.K.㳳;

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.View;
import android.view.animation.Animation;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
import com.google.android.material.progressindicator.BaseProgressIndicator;
import java.util.ArrayList;
import ῲ.㗗.K.K.C2240;

/* renamed from: ඓ.㿎.K.K.㳳.ʬ  reason: contains not printable characters */
/* compiled from: MaterialProgressDrawable */
public class C1449 extends Drawable implements Animatable {

    /* renamed from: Ԕ  reason: contains not printable characters */
    public static final Interpolator f5413 = new C2240();

    /* renamed from: 㗗  reason: contains not printable characters */
    public static final int[] f5414 = {-16777216};

    /* renamed from: 䁗  reason: contains not printable characters */
    public static final Interpolator f5415 = new LinearInterpolator();

    /* renamed from: ʬ  reason: contains not printable characters */
    public final C1450 f5416;

    /* renamed from: ඓ  reason: contains not printable characters */
    public Resources f5417;

    /* renamed from: ᕣ  reason: contains not printable characters */
    public boolean f5418;

    /* renamed from: ᨨ  reason: contains not printable characters */
    public double f5419;

    /* renamed from: ῲ  reason: contains not printable characters */
    public final ArrayList<Animation> f5420 = new ArrayList<>();

    /* renamed from: ⁱ  reason: contains not printable characters */
    public Animation f5421;

    /* renamed from: 㑃  reason: contains not printable characters */
    public final Drawable.Callback f5422 = new C1451();

    /* renamed from: 㳳  reason: contains not printable characters */
    public double f5423;

    /* renamed from: 㴹  reason: contains not printable characters */
    public View f5424;

    /* renamed from: 㸾  reason: contains not printable characters */
    public float f5425;

    /* renamed from: 㿎  reason: contains not printable characters */
    public float f5426;

    /* renamed from: ඓ.㿎.K.K.㳳.ʬ$K  reason: contains not printable characters */
    /* compiled from: MaterialProgressDrawable */
    public class C1451 implements Drawable.Callback {
        public C1451() {
        }

        public void invalidateDrawable(Drawable drawable) {
            C1449.this.invalidateSelf();
        }

        public void scheduleDrawable(Drawable drawable, Runnable runnable, long j) {
            C1449.this.scheduleSelf(runnable, j);
        }

        public void unscheduleDrawable(Drawable drawable, Runnable runnable) {
            C1449.this.unscheduleSelf(runnable);
        }
    }

    public C1449(Context context, View view) {
        this.f5424 = view;
        this.f5417 = context.getResources();
        this.f5416 = new C1450(this.f5422);
        C1450 r3 = this.f5416;
        r3.f5443 = f5414;
        r3.m3665(0);
        m3660(1);
        C1450 r4 = this.f5416;
        C1453 k = new C1453(this, r4);
        k.setRepeatCount(-1);
        k.setRepeatMode(1);
        k.setInterpolator(f5415);
        k.setAnimationListener(new animation.Animation$AnimationListenerC1452(this, r4));
        this.f5421 = k;
    }

    public void draw(Canvas canvas) {
        Rect bounds = getBounds();
        int save = canvas.save();
        canvas.rotate(this.f5425, bounds.exactCenterX(), bounds.exactCenterY());
        C1450 r2 = this.f5416;
        RectF rectF = r2.f5439;
        rectF.set(bounds);
        float f = r2.f5436;
        rectF.inset(f, f);
        float f2 = r2.f5432;
        float f3 = r2.f5438;
        float f4 = (f2 + f3) * 360.0f;
        float f5 = ((r2.f5445 + f3) * 360.0f) - f4;
        r2.f5437.setColor(r2.f5444);
        canvas.drawArc(rectF, f4, f5, false, r2.f5437);
        if (r2.f5441) {
            Path path = r2.f5430;
            if (path == null) {
                r2.f5430 = new Path();
                r2.f5430.setFillType(Path.FillType.EVEN_ODD);
            } else {
                path.reset();
            }
            float f6 = ((float) (((int) r2.f5436) / 2)) * r2.f5434;
            float cos = (float) ((Math.cos(0.0d) * r2.f5442) + ((double) bounds.exactCenterX()));
            double d = r2.f5442;
            r2.f5430.moveTo(0.0f, 0.0f);
            r2.f5430.lineTo(((float) r2.f5431) * r2.f5434, 0.0f);
            Path path2 = r2.f5430;
            float f7 = r2.f5434;
            path2.lineTo((((float) r2.f5431) * f7) / 2.0f, ((float) r2.f5449) * f7);
            r2.f5430.offset(cos - f6, (float) ((Math.sin(0.0d) * d) + ((double) bounds.exactCenterY())));
            r2.f5430.close();
            r2.f5427.setColor(r2.f5444);
            canvas.rotate((f4 + f5) - 5.0f, bounds.exactCenterX(), bounds.exactCenterY());
            canvas.drawPath(r2.f5430, r2.f5427);
        }
        if (r2.f5429 < 255) {
            r2.f5446.setColor(r2.f5433);
            r2.f5446.setAlpha(BaseProgressIndicator.MAX_ALPHA - r2.f5429);
            canvas.drawCircle(bounds.exactCenterX(), bounds.exactCenterY(), (float) (bounds.width() / 2), r2.f5446);
        }
        canvas.restoreToCount(save);
    }

    public int getAlpha() {
        return this.f5416.f5429;
    }

    public int getIntrinsicHeight() {
        return (int) this.f5423;
    }

    public int getIntrinsicWidth() {
        return (int) this.f5419;
    }

    public int getOpacity() {
        return -3;
    }

    public boolean isRunning() {
        ArrayList<Animation> arrayList = this.f5420;
        int size = arrayList.size();
        for (int i = 0; i < size; i++) {
            Animation animation = arrayList.get(i);
            if (animation.hasStarted() && !animation.hasEnded()) {
                return true;
            }
        }
        return false;
    }

    public void setAlpha(int i) {
        this.f5416.f5429 = i;
    }

    public void setColorFilter(ColorFilter colorFilter) {
        C1450 r0 = this.f5416;
        r0.f5437.setColorFilter(colorFilter);
        r0.m3663();
    }

    public void start() {
        this.f5421.reset();
        C1450 r0 = this.f5416;
        float f = r0.f5432;
        r0.f5440 = f;
        float f2 = r0.f5445;
        r0.f5450 = f2;
        r0.f5428 = r0.f5438;
        if (f2 != f) {
            this.f5418 = true;
            this.f5421.setDuration(666);
            this.f5424.startAnimation(this.f5421);
            return;
        }
        r0.m3665(0);
        this.f5416.m3662();
        this.f5421.setDuration(1332);
        this.f5424.startAnimation(this.f5421);
    }

    public void stop() {
        this.f5424.clearAnimation();
        this.f5425 = 0.0f;
        invalidateSelf();
        this.f5416.m3666(false);
        this.f5416.m3665(0);
        this.f5416.m3662();
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public void m3655(float f) {
        C1450 r0 = this.f5416;
        r0.f5438 = f;
        r0.m3663();
    }

    /* renamed from: K  reason: contains not printable characters */
    public final void m3656(double d, double d2, double d3, double d4, float f, float f2) {
        double d5;
        C1450 r0 = this.f5416;
        float f3 = this.f5417.getDisplayMetrics().density;
        double d6 = (double) f3;
        this.f5419 = d * d6;
        this.f5423 = d2 * d6;
        float f4 = ((float) d4) * f3;
        r0.f5448 = f4;
        r0.f5437.setStrokeWidth(f4);
        r0.m3663();
        r0.f5442 = d3 * d6;
        r0.m3665(0);
        r0.f5431 = (int) (f * f3);
        r0.f5449 = (int) (f2 * f3);
        float min = (float) Math.min((int) this.f5419, (int) this.f5423);
        double d7 = r0.f5442;
        if (d7 <= 0.0d || min < 0.0f) {
            d5 = Math.ceil((double) (r0.f5448 / 2.0f));
        } else {
            d5 = ((double) (min / 2.0f)) - d7;
        }
        r0.f5436 = (float) d5;
    }

    /* renamed from: ඓ.㿎.K.K.㳳.ʬ$ῲ  reason: contains not printable characters */
    /* compiled from: MaterialProgressDrawable */
    public static class C1450 {

        /* renamed from: ʬ  reason: contains not printable characters */
        public final Paint f5427 = new Paint();

        /* renamed from: Ԕ  reason: contains not printable characters */
        public float f5428;

        /* renamed from: Ԛ  reason: contains not printable characters */
        public int f5429;

        /* renamed from: ؿ  reason: contains not printable characters */
        public Path f5430;

        /* renamed from: ݜ  reason: contains not printable characters */
        public int f5431;

        /* renamed from: ඓ  reason: contains not printable characters */
        public float f5432 = 0.0f;

        /* renamed from: ᓆ  reason: contains not printable characters */
        public int f5433;

        /* renamed from: ᓣ  reason: contains not printable characters */
        public float f5434;

        /* renamed from: ᕣ  reason: contains not printable characters */
        public int f5435;

        /* renamed from: ᨨ  reason: contains not printable characters */
        public float f5436 = 2.5f;

        /* renamed from: ῲ  reason: contains not printable characters */
        public final Paint f5437 = new Paint();

        /* renamed from: ⁱ  reason: contains not printable characters */
        public float f5438 = 0.0f;

        /* renamed from: K  reason: contains not printable characters */
        public final RectF f5439 = new RectF();

        /* renamed from: 㑃  reason: contains not printable characters */
        public float f5440;

        /* renamed from: 㗗  reason: contains not printable characters */
        public boolean f5441;

        /* renamed from: 㗽  reason: contains not printable characters */
        public double f5442;

        /* renamed from: 㳳  reason: contains not printable characters */
        public int[] f5443;

        /* renamed from: 㴪  reason: contains not printable characters */
        public int f5444;

        /* renamed from: 㴹  reason: contains not printable characters */
        public float f5445 = 0.0f;

        /* renamed from: 㶋  reason: contains not printable characters */
        public final Paint f5446 = new Paint(1);

        /* renamed from: 㸾  reason: contains not printable characters */
        public final Drawable.Callback f5447;

        /* renamed from: 㿎  reason: contains not printable characters */
        public float f5448 = 5.0f;

        /* renamed from: 䀟  reason: contains not printable characters */
        public int f5449;

        /* renamed from: 䁗  reason: contains not printable characters */
        public float f5450;

        public C1450(Drawable.Callback callback) {
            this.f5447 = callback;
            this.f5437.setStrokeCap(Paint.Cap.SQUARE);
            this.f5437.setAntiAlias(true);
            this.f5437.setStyle(Paint.Style.STROKE);
            this.f5427.setStyle(Paint.Style.FILL);
            this.f5427.setAntiAlias(true);
        }

        /* renamed from: ʬ  reason: contains not printable characters */
        public void m3662() {
            this.f5440 = 0.0f;
            this.f5450 = 0.0f;
            this.f5428 = 0.0f;
            this.f5432 = 0.0f;
            m3663();
            this.f5445 = 0.0f;
            m3663();
            this.f5438 = 0.0f;
            m3663();
        }

        /* renamed from: ῲ  reason: contains not printable characters */
        public final void m3663() {
            this.f5447.invalidateDrawable(null);
        }

        /* renamed from: K  reason: contains not printable characters */
        public void m3667(int[] iArr) {
            this.f5443 = iArr;
            m3665(0);
        }

        /* renamed from: K  reason: contains not printable characters */
        public void m3665(int i) {
            this.f5435 = i;
            this.f5444 = this.f5443[this.f5435];
        }

        /* renamed from: K  reason: contains not printable characters */
        public final int m3664() {
            return (this.f5435 + 1) % this.f5443.length;
        }

        /* renamed from: K  reason: contains not printable characters */
        public void m3666(boolean z) {
            if (this.f5441 != z) {
                this.f5441 = z;
                m3663();
            }
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m3660(int i) {
        if (i == 0) {
            m3656(56.0d, 56.0d, 12.5d, 3.0d, 12.0f, 6.0f);
        } else {
            m3656(40.0d, 40.0d, 8.75d, 2.5d, 10.0f, 5.0f);
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m3661(boolean z) {
        C1450 r0 = this.f5416;
        if (r0.f5441 != z) {
            r0.f5441 = z;
            r0.m3663();
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m3657(float f) {
        C1450 r0 = this.f5416;
        if (f != r0.f5434) {
            r0.f5434 = f;
            r0.m3663();
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m3658(float f, float f2) {
        C1450 r0 = this.f5416;
        r0.f5432 = f;
        r0.m3663();
        C1450 r2 = this.f5416;
        r2.f5445 = f2;
        r2.m3663();
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m3659(float f, C1450 r10) {
        if (f > 0.75f) {
            float f2 = (f - 0.75f) / 0.25f;
            int[] iArr = r10.f5443;
            int i = iArr[r10.f5435];
            int i2 = iArr[r10.m3664()];
            int intValue = Integer.valueOf(i).intValue();
            int i3 = (intValue >> 24) & BaseProgressIndicator.MAX_ALPHA;
            int i4 = (intValue >> 16) & BaseProgressIndicator.MAX_ALPHA;
            int i5 = (intValue >> 8) & BaseProgressIndicator.MAX_ALPHA;
            int i6 = intValue & BaseProgressIndicator.MAX_ALPHA;
            int intValue2 = Integer.valueOf(i2).intValue();
            r10.f5444 = ((i3 + ((int) (((float) (((intValue2 >> 24) & BaseProgressIndicator.MAX_ALPHA) - i3)) * f2))) << 24) | ((i4 + ((int) (((float) (((intValue2 >> 16) & BaseProgressIndicator.MAX_ALPHA) - i4)) * f2))) << 16) | ((i5 + ((int) (((float) (((intValue2 >> 8) & BaseProgressIndicator.MAX_ALPHA) - i5)) * f2))) << 8) | (i6 + ((int) (f2 * ((float) ((intValue2 & BaseProgressIndicator.MAX_ALPHA) - i6)))));
        }
    }
}
