package c.c.a; import android.animation.Animator; import android.animation.ValueAnimator; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.Matrix; import android.graphics.Rect; import android.graphics.drawable.Animatable; import android.graphics.drawable.Drawable; import android.os.Build; import android.widget.ImageView; import androidx.annotation.FloatRange; import androidx.annotation.IntRange; import androidx.annotation.MainThread; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import c.c.a.a0.h0.c; import c.c.a.a0.r; import c.c.a.y.m.e; import com.google.android.material.shadow.ShadowDrawableWrapper; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Objects; /* compiled from: LottieDrawable */ public class j extends Drawable implements Drawable.Callback, Animatable { public boolean A; public boolean B; public final Matrix i = new Matrix(); public d j; public final c.c.a.b0.d k; public float l; public boolean m; public boolean n; public final ArrayList o; public final ValueAnimator.AnimatorUpdateListener p; @Nullable public ImageView.ScaleType q; @Nullable public c.c.a.x.b r; @Nullable /* renamed from: s reason: collision with root package name */ public String f271s; @Nullable public b t; @Nullable public c.c.a.x.a u; public boolean v; @Nullable public c.c.a.y.m.c w; /* renamed from: x reason: collision with root package name */ public int f272x; /* renamed from: y reason: collision with root package name */ public boolean f273y; /* renamed from: z reason: collision with root package name */ public boolean f274z; /* compiled from: LottieDrawable */ public class a implements o { public final /* synthetic */ String a; public a(String str) { this.a = str; } @Override // c.c.a.j.o public void a(d dVar) { j.this.q(this.a); } } /* compiled from: LottieDrawable */ public class b implements o { public final /* synthetic */ int a; public final /* synthetic */ int b; public b(int i, int i2) { this.a = i; this.b = i2; } @Override // c.c.a.j.o public void a(d dVar) { j.this.p(this.a, this.b); } } /* compiled from: LottieDrawable */ public class c implements o { public final /* synthetic */ int a; public c(int i) { this.a = i; } @Override // c.c.a.j.o public void a(d dVar) { j.this.l(this.a); } } /* compiled from: LottieDrawable */ public class d implements o { public final /* synthetic */ float a; public d(float f) { this.a = f; } @Override // c.c.a.j.o public void a(d dVar) { j.this.u(this.a); } } /* compiled from: LottieDrawable */ public class e implements o { public final /* synthetic */ c.c.a.y.f a; public final /* synthetic */ Object b; /* renamed from: c reason: collision with root package name */ public final /* synthetic */ c.c.a.c0.c f276c; public e(c.c.a.y.f fVar, Object obj, c.c.a.c0.c cVar) { this.a = fVar; this.b = obj; this.f276c = cVar; } @Override // c.c.a.j.o public void a(d dVar) { j.this.a(this.a, this.b, this.f276c); } } /* compiled from: LottieDrawable */ public class f implements ValueAnimator.AnimatorUpdateListener { public f() { } @Override // android.animation.ValueAnimator.AnimatorUpdateListener public void onAnimationUpdate(ValueAnimator valueAnimator) { j jVar = j.this; c.c.a.y.m.c cVar = jVar.w; if (cVar != null) { cVar.o(jVar.k.h()); } } } /* compiled from: LottieDrawable */ public class g implements o { public g() { } @Override // c.c.a.j.o public void a(d dVar) { j.this.j(); } } /* compiled from: LottieDrawable */ public class h implements o { public h() { } @Override // c.c.a.j.o public void a(d dVar) { j.this.k(); } } /* compiled from: LottieDrawable */ public class i implements o { public final /* synthetic */ int a; public i(int i) { this.a = i; } @Override // c.c.a.j.o public void a(d dVar) { j.this.r(this.a); } } /* compiled from: LottieDrawable */ /* renamed from: c.c.a.j$j reason: collision with other inner class name */ public class C0054j implements o { public final /* synthetic */ float a; public C0054j(float f) { this.a = f; } @Override // c.c.a.j.o public void a(d dVar) { j.this.t(this.a); } } /* compiled from: LottieDrawable */ public class k implements o { public final /* synthetic */ int a; public k(int i) { this.a = i; } @Override // c.c.a.j.o public void a(d dVar) { j.this.m(this.a); } } /* compiled from: LottieDrawable */ public class l implements o { public final /* synthetic */ float a; public l(float f) { this.a = f; } @Override // c.c.a.j.o public void a(d dVar) { j.this.o(this.a); } } /* compiled from: LottieDrawable */ public class m implements o { public final /* synthetic */ String a; public m(String str) { this.a = str; } @Override // c.c.a.j.o public void a(d dVar) { j.this.s(this.a); } } /* compiled from: LottieDrawable */ public class n implements o { public final /* synthetic */ String a; public n(String str) { this.a = str; } @Override // c.c.a.j.o public void a(d dVar) { j.this.n(this.a); } } /* compiled from: LottieDrawable */ public interface o { void a(d dVar); } public j() { c.c.a.b0.d dVar = new c.c.a.b0.d(); this.k = dVar; this.l = 1.0f; this.m = true; this.n = false; new HashSet(); this.o = new ArrayList<>(); f fVar = new f(); this.p = fVar; this.f272x = 255; this.A = true; this.B = false; dVar.i.add(fVar); } public void a(c.c.a.y.f fVar, T t, c.c.a.c0.c cVar) { List list; c.c.a.y.m.c cVar2 = this.w; if (cVar2 == null) { this.o.add(new e(fVar, t, cVar)); return; } boolean z2 = true; if (fVar == c.c.a.y.f.a) { cVar2.g(t, cVar); } else { c.c.a.y.g gVar = fVar.f315c; if (gVar != null) { gVar.g(t, cVar); } else { if (cVar2 == null) { c.c.a.b0.c.b("Cannot resolve KeyPath. Composition is not set yet."); list = Collections.emptyList(); } else { ArrayList arrayList = new ArrayList(); this.w.c(fVar, 0, arrayList, new c.c.a.y.f(new String[0])); list = arrayList; } for (int i2 = 0; i2 < list.size(); i2++) { ((c.c.a.y.f) list.get(i2)).f315c.g(t, cVar); } z2 = true ^ list.isEmpty(); } } if (z2) { invalidateSelf(); if (t == o.A) { u(g()); } } } public final void b() { d dVar = this.j; c.a aVar = r.a; Rect rect = dVar.j; c.c.a.y.m.e eVar = new c.c.a.y.m.e(Collections.emptyList(), dVar, "__container", -1, e.a.PRE_COMP, -1, null, Collections.emptyList(), new c.c.a.y.k.l(null, null, null, null, null, null, null, null, null), 0, 0, 0, 0.0f, 0.0f, rect.width(), rect.height(), null, null, Collections.emptyList(), 1, null, false); d dVar2 = this.j; this.w = new c.c.a.y.m.c(this, eVar, dVar2.i, dVar2); } public void c() { c.c.a.b0.d dVar = this.k; if (dVar.f267s) { dVar.cancel(); } this.j = null; this.w = null; this.r = null; c.c.a.b0.d dVar2 = this.k; dVar2.r = null; dVar2.p = -2.14748365E9f; dVar2.q = 2.14748365E9f; invalidateSelf(); } public final void d(@NonNull Canvas canvas) { float f2; float f3; int i2 = -1; if (ImageView.ScaleType.FIT_XY == this.q) { if (this.w != null) { Rect bounds = getBounds(); float width = ((float) bounds.width()) / ((float) this.j.j.width()); float height = ((float) bounds.height()) / ((float) this.j.j.height()); if (this.A) { float min = Math.min(width, height); if (min < 1.0f) { f3 = 1.0f / min; width /= f3; height /= f3; } else { f3 = 1.0f; } if (f3 > 1.0f) { i2 = canvas.save(); float width2 = ((float) bounds.width()) / 2.0f; float height2 = ((float) bounds.height()) / 2.0f; float f4 = width2 * min; float f5 = min * height2; canvas.translate(width2 - f4, height2 - f5); canvas.scale(f3, f3, f4, f5); } } this.i.reset(); this.i.preScale(width, height); this.w.f(canvas, this.i, this.f272x); if (i2 > 0) { canvas.restoreToCount(i2); } } } else if (this.w != null) { float f6 = this.l; float min2 = Math.min(((float) canvas.getWidth()) / ((float) this.j.j.width()), ((float) canvas.getHeight()) / ((float) this.j.j.height())); if (f6 > min2) { f2 = this.l / min2; } else { min2 = f6; f2 = 1.0f; } if (f2 > 1.0f) { i2 = canvas.save(); float width3 = ((float) this.j.j.width()) / 2.0f; float height3 = ((float) this.j.j.height()) / 2.0f; float f7 = width3 * min2; float f8 = height3 * min2; float f9 = this.l; canvas.translate((width3 * f9) - f7, (f9 * height3) - f8); canvas.scale(f2, f2, f7, f8); } this.i.reset(); this.i.preScale(min2, min2); this.w.f(canvas, this.i, this.f272x); if (i2 > 0) { canvas.restoreToCount(i2); } } } @Override // android.graphics.drawable.Drawable public void draw(@NonNull Canvas canvas) { this.B = false; if (this.n) { try { d(canvas); } catch (Throwable unused) { Objects.requireNonNull((c.c.a.b0.b) c.c.a.b0.c.a); } } else { d(canvas); } c.a("Drawable#draw"); } public float e() { return this.k.i(); } public float f() { return this.k.j(); } @FloatRange(from = ShadowDrawableWrapper.COS_45, to = 1.0d) public float g() { return this.k.h(); } @Override // android.graphics.drawable.Drawable public int getAlpha() { return this.f272x; } @Override // android.graphics.drawable.Drawable public int getIntrinsicHeight() { d dVar = this.j; if (dVar == null) { return -1; } return (int) (((float) dVar.j.height()) * this.l); } @Override // android.graphics.drawable.Drawable public int getIntrinsicWidth() { d dVar = this.j; if (dVar == null) { return -1; } return (int) (((float) dVar.j.width()) * this.l); } @Override // android.graphics.drawable.Drawable public int getOpacity() { return -3; } public int h() { return this.k.getRepeatCount(); } public boolean i() { c.c.a.b0.d dVar = this.k; if (dVar == null) { return false; } return dVar.f267s; } @Override // android.graphics.drawable.Drawable.Callback public void invalidateDrawable(@NonNull Drawable drawable) { Drawable.Callback callback = getCallback(); if (callback != null) { callback.invalidateDrawable(this); } } @Override // android.graphics.drawable.Drawable public void invalidateSelf() { if (!this.B) { this.B = true; Drawable.Callback callback = getCallback(); if (callback != null) { callback.invalidateDrawable(this); } } } @Override // android.graphics.drawable.Animatable public boolean isRunning() { return i(); } @MainThread public void j() { if (this.w == null) { this.o.add(new g()); return; } if (this.m || h() == 0) { c.c.a.b0.d dVar = this.k; dVar.f267s = true; boolean k2 = dVar.k(); for (Animator.AnimatorListener animatorListener : dVar.j) { if (Build.VERSION.SDK_INT >= 26) { animatorListener.onAnimationStart(dVar, k2); } else { animatorListener.onAnimationStart(dVar); } } dVar.n((float) ((int) (dVar.k() ? dVar.i() : dVar.j()))); dVar.m = 0; dVar.o = 0; dVar.l(); } if (!this.m) { l((int) (this.k.k < 0.0f ? f() : e())); this.k.g(); } } @MainThread public void k() { if (this.w == null) { this.o.add(new h()); return; } if (this.m || h() == 0) { c.c.a.b0.d dVar = this.k; dVar.f267s = true; dVar.l(); dVar.m = 0; if (dVar.k() && dVar.n == dVar.j()) { dVar.n = dVar.i(); } else if (!dVar.k() && dVar.n == dVar.i()) { dVar.n = dVar.j(); } } if (!this.m) { l((int) (this.k.k < 0.0f ? f() : e())); this.k.g(); } } public void l(int i2) { if (this.j == null) { this.o.add(new c(i2)); } else { this.k.n((float) i2); } } public void m(int i2) { if (this.j == null) { this.o.add(new k(i2)); return; } c.c.a.b0.d dVar = this.k; dVar.o(dVar.p, ((float) i2) + 0.99f); } public void n(String str) { d dVar = this.j; if (dVar == null) { this.o.add(new n(str)); return; } c.c.a.y.i d2 = dVar.d(str); if (d2 != null) { m((int) (d2.b + d2.f316c)); return; } throw new IllegalArgumentException(c.d.b.a.a.v("Cannot find marker with name ", str, ".")); } public void o(@FloatRange(from = 0.0d, to = 1.0d) float f2) { d dVar = this.j; if (dVar == null) { this.o.add(new l(f2)); } else { m((int) c.c.a.b0.f.e(dVar.k, dVar.l, f2)); } } public void p(int i2, int i3) { if (this.j == null) { this.o.add(new b(i2, i3)); } else { this.k.o((float) i2, ((float) i3) + 0.99f); } } public void q(String str) { d dVar = this.j; if (dVar == null) { this.o.add(new a(str)); return; } c.c.a.y.i d2 = dVar.d(str); if (d2 != null) { int i2 = (int) d2.b; p(i2, ((int) d2.f316c) + i2); return; } throw new IllegalArgumentException(c.d.b.a.a.v("Cannot find marker with name ", str, ".")); } public void r(int i2) { if (this.j == null) { this.o.add(new i(i2)); return; } c.c.a.b0.d dVar = this.k; dVar.o((float) i2, (float) ((int) dVar.q)); } public void s(String str) { d dVar = this.j; if (dVar == null) { this.o.add(new m(str)); return; } c.c.a.y.i d2 = dVar.d(str); if (d2 != null) { r((int) d2.b); return; } throw new IllegalArgumentException(c.d.b.a.a.v("Cannot find marker with name ", str, ".")); } @Override // android.graphics.drawable.Drawable.Callback public void scheduleDrawable(@NonNull Drawable drawable, @NonNull Runnable runnable, long j) { Drawable.Callback callback = getCallback(); if (callback != null) { callback.scheduleDrawable(this, runnable, j); } } @Override // android.graphics.drawable.Drawable public void setAlpha(@IntRange(from = 0, to = 255) int i2) { this.f272x = i2; invalidateSelf(); } @Override // android.graphics.drawable.Drawable public void setColorFilter(@Nullable ColorFilter colorFilter) { c.c.a.b0.c.b("Use addColorFilter instead."); } @Override // android.graphics.drawable.Animatable @MainThread public void start() { j(); } @Override // android.graphics.drawable.Animatable @MainThread public void stop() { this.o.clear(); this.k.g(); } public void t(float f2) { d dVar = this.j; if (dVar == null) { this.o.add(new C0054j(f2)); } else { r((int) c.c.a.b0.f.e(dVar.k, dVar.l, f2)); } } public void u(@FloatRange(from = 0.0d, to = 1.0d) float f2) { d dVar = this.j; if (dVar == null) { this.o.add(new d(f2)); return; } this.k.n(c.c.a.b0.f.e(dVar.k, dVar.l, f2)); c.a("Drawable#setProgress"); } @Override // android.graphics.drawable.Drawable.Callback public void unscheduleDrawable(@NonNull Drawable drawable, @NonNull Runnable runnable) { Drawable.Callback callback = getCallback(); if (callback != null) { callback.unscheduleDrawable(this, runnable); } } public final void v() { d dVar = this.j; if (dVar != null) { float f2 = this.l; setBounds(0, 0, (int) (((float) dVar.j.width()) * f2), (int) (((float) this.j.j.height()) * f2)); } } }