package o; 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; import com.google.android.gms.maps.model.BitmapDescriptorFactory; /* loaded from: classes.dex */ public final class uto extends Drawable implements Animatable { public final IeS b; float d; boolean e; private Resources g; private float h; private Animator i; private static final Interpolator c = new LinearInterpolator(); private static final Interpolator f = new NtL(); private static final int[] a = {-16777216}; private static int e(float f2, int i, int i2) { return (((i >>> 24) + ((int) (((i2 >>> 24) - r0) * f2))) << 24) | ((((i >> 16) & 255) + ((int) ((((i2 >> 16) & 255) - r1) * f2))) << 16) | ((((i >> 8) & 255) + ((int) ((((i2 >> 8) & 255) - r2) * f2))) << 8) | ((i & 255) + ((int) (f2 * ((i2 & 255) - r5)))); } @Override // android.graphics.drawable.Drawable public final int getOpacity() { return -3; } public uto(Context context) { this.g = context.getResources(); IeS ieS = new IeS(); this.b = ieS; ieS.g = a; ieS.i = 0; ieS.h = ieS.g[0]; ieS.t = 2.5f; ieS.n.setStrokeWidth(2.5f); invalidateSelf(); ValueAnimator ofFloat = ValueAnimator.ofFloat(BitmapDescriptorFactory.HUE_RED, 1.0f); ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(this, ieS) { // from class: o.uto.5 final IeS d; final uto e; { this.e = this; this.d = ieS; } @Override // android.animation.ValueAnimator.AnimatorUpdateListener public final void onAnimationUpdate(ValueAnimator valueAnimator) { float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue(); uto.c(floatValue, this.d); this.e.d(floatValue, this.d, false); this.e.invalidateSelf(); } }); ofFloat.setRepeatCount(-1); ofFloat.setRepeatMode(1); ofFloat.setInterpolator(c); ofFloat.addListener(new Animator.AnimatorListener(this, ieS) { // from class: o.uto.3 final IeS d; final uto e; @Override // android.animation.Animator.AnimatorListener public final void onAnimationCancel(Animator animator) { } @Override // android.animation.Animator.AnimatorListener public final void onAnimationEnd(Animator animator) { } { this.e = this; this.d = ieS; } @Override // android.animation.Animator.AnimatorListener public final void onAnimationStart(Animator animator) { this.e.d = BitmapDescriptorFactory.HUE_RED; } @Override // android.animation.Animator.AnimatorListener public final void onAnimationRepeat(Animator animator) { this.e.d(1.0f, this.d, true); IeS ieS2 = this.d; ieS2.r = ieS2.p; ieS2.q = ieS2.m; ieS2.s = ieS2.l; IeS ieS3 = this.d; int length = (ieS3.i + 1) % ieS3.g.length; ieS3.i = length; ieS3.h = ieS3.g[length]; if (this.e.e) { this.e.e = false; animator.cancel(); animator.setDuration(1332L); animator.start(); IeS ieS4 = this.d; if (ieS4.k) { ieS4.k = false; return; } return; } this.e.d += 1.0f; } }); this.i = ofFloat; } private void d(float f2, float f3, float f4, float f5) { IeS ieS = this.b; float f6 = this.g.getDisplayMetrics().density; float f7 = f3 * f6; ieS.t = f7; ieS.n.setStrokeWidth(f7); ieS.f9289o = f2 * f6; ieS.i = 0; ieS.h = ieS.g[0]; ieS.j = (int) (f4 * f6); ieS.d = (int) (f5 * f6); } public final void c(int i) { if (i == 0) { d(11.0f, 3.0f, 12.0f, 6.0f); } else { d(7.5f, 2.5f, 10.0f, 5.0f); } invalidateSelf(); } @Override // android.graphics.drawable.Drawable public final void draw(Canvas canvas) { Rect bounds = getBounds(); canvas.save(); canvas.rotate(this.h, bounds.exactCenterX(), bounds.exactCenterY()); IeS ieS = this.b; RectF rectF = ieS.x; float f2 = ieS.f9289o; float f3 = (ieS.t / 2.0f) + f2; if (f2 <= BitmapDescriptorFactory.HUE_RED) { f3 = (Math.min(bounds.width(), bounds.height()) / 2.0f) - Math.max((ieS.j * ieS.b) / 2.0f, ieS.t / 2.0f); } rectF.set(bounds.centerX() - f3, bounds.centerY() - f3, bounds.centerX() + f3, bounds.centerY() + f3); float f4 = ieS.p; float f5 = ieS.l; float f6 = (f4 + f5) * 360.0f; float f7 = ((ieS.m + f5) * 360.0f) - f6; ieS.n.setColor(ieS.h); ieS.n.setAlpha(ieS.e); float f8 = ieS.t / 2.0f; rectF.inset(f8, f8); canvas.drawCircle(rectF.centerX(), rectF.centerY(), rectF.width() / 2.0f, ieS.f); float f9 = -f8; rectF.inset(f9, f9); canvas.drawArc(rectF, f6, f7, false, ieS.n); if (ieS.k) { Path path = ieS.a; if (path == null) { Path path2 = new Path(); ieS.a = path2; path2.setFillType(Path.FillType.EVEN_ODD); } else { path.reset(); } float min = Math.min(rectF.width(), rectF.height()) / 2.0f; float f10 = (ieS.j * ieS.b) / 2.0f; ieS.a.moveTo(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED); ieS.a.lineTo(ieS.j * ieS.b, BitmapDescriptorFactory.HUE_RED); Path path3 = ieS.a; float f11 = ieS.j; float f12 = ieS.b; path3.lineTo((f11 * f12) / 2.0f, ieS.d * f12); ieS.a.offset((min + rectF.centerX()) - f10, rectF.centerY() + (ieS.t / 2.0f)); ieS.a.close(); ieS.c.setColor(ieS.h); ieS.c.setAlpha(ieS.e); canvas.save(); canvas.rotate(f6 + f7, rectF.centerX(), rectF.centerY()); canvas.drawPath(ieS.a, ieS.c); canvas.restore(); } canvas.restore(); } @Override // android.graphics.drawable.Drawable public final void setColorFilter(ColorFilter colorFilter) { this.b.n.setColorFilter(colorFilter); invalidateSelf(); } @Override // android.graphics.drawable.Animatable public final boolean isRunning() { return this.i.isRunning(); } @Override // android.graphics.drawable.Animatable public final void start() { this.i.cancel(); IeS ieS = this.b; ieS.r = ieS.p; ieS.q = ieS.m; ieS.s = ieS.l; if (this.b.m != this.b.p) { this.e = true; this.i.setDuration(666L); this.i.start(); return; } IeS ieS2 = this.b; ieS2.i = 0; ieS2.h = ieS2.g[0]; IeS ieS3 = this.b; ieS3.r = BitmapDescriptorFactory.HUE_RED; ieS3.q = BitmapDescriptorFactory.HUE_RED; ieS3.s = BitmapDescriptorFactory.HUE_RED; ieS3.p = BitmapDescriptorFactory.HUE_RED; ieS3.m = BitmapDescriptorFactory.HUE_RED; ieS3.l = BitmapDescriptorFactory.HUE_RED; this.i.setDuration(1332L); this.i.start(); } @Override // android.graphics.drawable.Animatable public final void stop() { this.i.cancel(); this.h = BitmapDescriptorFactory.HUE_RED; IeS ieS = this.b; if (ieS.k) { ieS.k = false; } IeS ieS2 = this.b; ieS2.i = 0; ieS2.h = ieS2.g[0]; IeS ieS3 = this.b; ieS3.r = BitmapDescriptorFactory.HUE_RED; ieS3.q = BitmapDescriptorFactory.HUE_RED; ieS3.s = BitmapDescriptorFactory.HUE_RED; ieS3.p = BitmapDescriptorFactory.HUE_RED; ieS3.m = BitmapDescriptorFactory.HUE_RED; ieS3.l = BitmapDescriptorFactory.HUE_RED; invalidateSelf(); } static void c(float f2, IeS ieS) { if (f2 > 0.75f) { ieS.h = e((f2 - 0.75f) / 0.25f, ieS.g[ieS.i], ieS.g[(ieS.i + 1) % ieS.g.length]); return; } ieS.h = ieS.g[ieS.i]; } /* loaded from: classes.dex */ public static class IeS { Path a; public float b; final Paint c; int d; int e; final Paint f; public int[] g; public int h; public int i; int j; public boolean k; public float l; public float m; final Paint n; /* renamed from: o, reason: collision with root package name */ float f9289o; public float p; float q; float r; float s; float t; final RectF x = new RectF(); IeS() { Paint paint = new Paint(); this.n = paint; Paint paint2 = new Paint(); this.c = paint2; Paint paint3 = new Paint(); this.f = paint3; this.p = BitmapDescriptorFactory.HUE_RED; this.m = BitmapDescriptorFactory.HUE_RED; this.l = BitmapDescriptorFactory.HUE_RED; this.t = 5.0f; this.b = 1.0f; this.e = 255; paint.setStrokeCap(Paint.Cap.SQUARE); paint.setAntiAlias(true); paint.setStyle(Paint.Style.STROKE); paint2.setStyle(Paint.Style.FILL); paint2.setAntiAlias(true); paint3.setColor(0); } } final void d(float f2, IeS ieS, boolean z) { float interpolation; float f3; if (this.e) { c(f2, ieS); float floor = (float) (Math.floor(ieS.s / 0.8f) + 1.0d); ieS.p = ieS.r + (((ieS.q - 0.01f) - ieS.r) * f2); ieS.m = ieS.q; ieS.l = ieS.s + ((floor - ieS.s) * f2); return; } if (f2 != 1.0f || z) { float f4 = ieS.s; if (f2 < 0.5f) { interpolation = ieS.r; f3 = (f.getInterpolation(f2 / 0.5f) * 0.79f) + 0.01f + interpolation; } else { float f5 = ieS.r + 0.79f; interpolation = f5 - (((1.0f - f.getInterpolation((f2 - 0.5f) / 0.5f)) * 0.79f) + 0.01f); f3 = f5; } float f6 = this.d; ieS.p = interpolation; ieS.m = f3; ieS.l = f4 + (0.20999998f * f2); this.h = (f2 + f6) * 216.0f; } } @Override // android.graphics.drawable.Drawable public final int getAlpha() { return this.b.e; } @Override // android.graphics.drawable.Drawable public final void setAlpha(int i) { this.b.e = i; invalidateSelf(); } }