package f; import android.animation.ObjectAnimator; import android.animation.TimeInterpolator; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.Outline; import android.graphics.PorterDuff; import android.graphics.Rect; import android.graphics.drawable.Animatable; import android.graphics.drawable.AnimationDrawable; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.StateSet; import androidx.appcompat.widget.x1; import androidx.collection.h; import f.b; import f.d; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import p.i; import r.q; /* loaded from: classes.dex */ public class a extends f.d implements q { /* renamed from: o, reason: collision with root package name */ private c f9428o; /* renamed from: p, reason: collision with root package name */ private g f9429p; /* renamed from: q, reason: collision with root package name */ private int f9430q; /* renamed from: r, reason: collision with root package name */ private int f9431r; /* renamed from: s, reason: collision with root package name */ private boolean f9432s; private static class b extends g { /* renamed from: a, reason: collision with root package name */ private final Animatable f9433a; b(Animatable animatable) { super(); this.f9433a = animatable; } @Override // f.a.g public void c() { this.f9433a.start(); } @Override // f.a.g public void d() { this.f9433a.stop(); } } static class c extends d.a { androidx.collection.d K; h L; c(c cVar, a aVar, Resources resources) { super(cVar, aVar, resources); if (cVar != null) { this.K = cVar.K; this.L = cVar.L; } else { this.K = new androidx.collection.d(); this.L = new h(); } } private static long D(int i10, int i11) { return i11 | (i10 << 32); } int B(int[] iArr, Drawable drawable, int i10) { int z10 = super.z(iArr, drawable); this.L.j(z10, Integer.valueOf(i10)); return z10; } int C(int i10, int i11, Drawable drawable, boolean z10) { int a10 = super.a(drawable); long D = D(i10, i11); long j10 = z10 ? 8589934592L : 0L; long j11 = a10; this.K.a(D, Long.valueOf(j11 | j10)); if (z10) { this.K.a(D(i11, i10), Long.valueOf(4294967296L | j11 | j10)); } return a10; } int E(int i10) { if (i10 < 0) { return 0; } return ((Integer) this.L.g(i10, 0)).intValue(); } int F(int[] iArr) { int A = super.A(iArr); return A >= 0 ? A : super.A(StateSet.WILD_CARD); } int G(int i10, int i11) { return (int) ((Long) this.K.g(D(i10, i11), -1L)).longValue(); } boolean H(int i10, int i11) { return (((Long) this.K.g(D(i10, i11), -1L)).longValue() & 4294967296L) != 0; } boolean I(int i10, int i11) { return (((Long) this.K.g(D(i10, i11), -1L)).longValue() & 8589934592L) != 0; } @Override // android.graphics.drawable.Drawable.ConstantState public Drawable newDrawable() { return new a(this, null); } @Override // f.d.a, f.b.d void r() { this.K = this.K.clone(); this.L = this.L.clone(); } @Override // android.graphics.drawable.Drawable.ConstantState public Drawable newDrawable(Resources resources) { return new a(this, resources); } } private static class d extends g { /* renamed from: a, reason: collision with root package name */ private final androidx.vectordrawable.graphics.drawable.b f9434a; d(androidx.vectordrawable.graphics.drawable.b bVar) { super(); this.f9434a = bVar; } @Override // f.a.g public void c() { this.f9434a.start(); } @Override // f.a.g public void d() { this.f9434a.stop(); } } private static class e extends g { /* renamed from: a, reason: collision with root package name */ private final ObjectAnimator f9435a; /* renamed from: b, reason: collision with root package name */ private final boolean f9436b; e(AnimationDrawable animationDrawable, boolean z10, boolean z11) { super(); int numberOfFrames = animationDrawable.getNumberOfFrames(); int i10 = z10 ? numberOfFrames - 1 : 0; int i11 = z10 ? 0 : numberOfFrames - 1; f fVar = new f(animationDrawable, z10); ObjectAnimator ofInt = ObjectAnimator.ofInt(animationDrawable, "currentIndex", i10, i11); ofInt.setAutoCancel(true); ofInt.setDuration(fVar.a()); ofInt.setInterpolator(fVar); this.f9436b = z11; this.f9435a = ofInt; } @Override // f.a.g public boolean a() { return this.f9436b; } @Override // f.a.g public void b() { this.f9435a.reverse(); } @Override // f.a.g public void c() { this.f9435a.start(); } @Override // f.a.g public void d() { this.f9435a.cancel(); } } private static class f implements TimeInterpolator { /* renamed from: a, reason: collision with root package name */ private int[] f9437a; /* renamed from: b, reason: collision with root package name */ private int f9438b; /* renamed from: c, reason: collision with root package name */ private int f9439c; f(AnimationDrawable animationDrawable, boolean z10) { b(animationDrawable, z10); } int a() { return this.f9439c; } int b(AnimationDrawable animationDrawable, boolean z10) { int numberOfFrames = animationDrawable.getNumberOfFrames(); this.f9438b = numberOfFrames; int[] iArr = this.f9437a; if (iArr == null || iArr.length < numberOfFrames) { this.f9437a = new int[numberOfFrames]; } int[] iArr2 = this.f9437a; int i10 = 0; for (int i11 = 0; i11 < numberOfFrames; i11++) { int duration = animationDrawable.getDuration(z10 ? (numberOfFrames - i11) - 1 : i11); iArr2[i11] = duration; i10 += duration; } this.f9439c = i10; return i10; } @Override // android.animation.TimeInterpolator public float getInterpolation(float f10) { int i10 = (int) ((f10 * this.f9439c) + 0.5f); int i11 = this.f9438b; int[] iArr = this.f9437a; int i12 = 0; while (i12 < i11) { int i13 = iArr[i12]; if (i10 < i13) { break; } i10 -= i13; i12++; } return (i12 / i11) + (i12 < i11 ? i10 / this.f9439c : 0.0f); } } private static abstract class g { private g() { } public boolean a() { return false; } public void b() { } public abstract void c(); public abstract void d(); } public a() { this(null, null); } public static a l(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) { String name = xmlPullParser.getName(); if (name.equals("animated-selector")) { a aVar = new a(); aVar.m(context, resources, xmlPullParser, attributeSet, theme); return aVar; } throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ": invalid animated-selector tag " + name); } private void n(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) { int depth = xmlPullParser.getDepth() + 1; while (true) { int next = xmlPullParser.next(); if (next == 1) { return; } int depth2 = xmlPullParser.getDepth(); if (depth2 < depth && next == 3) { return; } if (next == 2 && depth2 <= depth) { if (xmlPullParser.getName().equals("item")) { p(context, resources, xmlPullParser, attributeSet, theme); } else if (xmlPullParser.getName().equals("transition")) { q(context, resources, xmlPullParser, attributeSet, theme); } } } } private void o() { onStateChange(getState()); } private int p(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) { int next; TypedArray k10 = i.k(resources, theme, attributeSet, g.b.f9662h); int resourceId = k10.getResourceId(g.b.f9663i, 0); int resourceId2 = k10.getResourceId(g.b.f9664j, -1); Drawable j10 = resourceId2 > 0 ? x1.h().j(context, resourceId2) : null; k10.recycle(); int[] j11 = j(attributeSet); if (j10 == null) { do { next = xmlPullParser.next(); } while (next == 4); if (next != 2) { throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ": tag requires a 'drawable' attribute or child tag defining a drawable"); } j10 = xmlPullParser.getName().equals("vector") ? androidx.vectordrawable.graphics.drawable.g.c(resources, xmlPullParser, attributeSet, theme) : Drawable.createFromXmlInner(resources, xmlPullParser, attributeSet, theme); } if (j10 != null) { return this.f9428o.B(j11, j10, resourceId); } throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ": tag requires a 'drawable' attribute or child tag defining a drawable"); } private int q(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) { int next; TypedArray k10 = i.k(resources, theme, attributeSet, g.b.f9665k); int resourceId = k10.getResourceId(g.b.f9668n, -1); int resourceId2 = k10.getResourceId(g.b.f9667m, -1); int resourceId3 = k10.getResourceId(g.b.f9666l, -1); Drawable j10 = resourceId3 > 0 ? x1.h().j(context, resourceId3) : null; boolean z10 = k10.getBoolean(g.b.f9669o, false); k10.recycle(); if (j10 == null) { do { next = xmlPullParser.next(); } while (next == 4); if (next != 2) { throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ": tag requires a 'drawable' attribute or child tag defining a drawable"); } j10 = xmlPullParser.getName().equals("animated-vector") ? androidx.vectordrawable.graphics.drawable.b.a(context, resources, xmlPullParser, attributeSet, theme) : Drawable.createFromXmlInner(resources, xmlPullParser, attributeSet, theme); } if (j10 == null) { throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ": tag requires a 'drawable' attribute or child tag defining a drawable"); } if (resourceId != -1 && resourceId2 != -1) { return this.f9428o.C(resourceId, resourceId2, j10, z10); } throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ": tag requires 'fromId' & 'toId' attributes"); } private boolean r(int i10) { int c10; int G; g bVar; g gVar = this.f9429p; if (gVar == null) { c10 = c(); } else { if (i10 == this.f9430q) { return true; } if (i10 == this.f9431r && gVar.a()) { gVar.b(); this.f9430q = this.f9431r; this.f9431r = i10; return true; } c10 = this.f9430q; gVar.d(); } this.f9429p = null; this.f9431r = -1; this.f9430q = -1; c cVar = this.f9428o; int E = cVar.E(c10); int E2 = cVar.E(i10); if (E2 == 0 || E == 0 || (G = cVar.G(E, E2)) < 0) { return false; } boolean I = cVar.I(E, E2); g(G); Object current = getCurrent(); if (current instanceof AnimationDrawable) { bVar = new e((AnimationDrawable) current, cVar.H(E, E2), I); } else { if (!(current instanceof androidx.vectordrawable.graphics.drawable.b)) { if (current instanceof Animatable) { bVar = new b((Animatable) current); } return false; } bVar = new d((androidx.vectordrawable.graphics.drawable.b) current); } bVar.c(); this.f9429p = bVar; this.f9431r = c10; this.f9430q = i10; return true; } private void s(TypedArray typedArray) { c cVar = this.f9428o; cVar.f9457d |= typedArray.getChangingConfigurations(); cVar.x(typedArray.getBoolean(g.b.f9658d, cVar.f9462i)); cVar.t(typedArray.getBoolean(g.b.f9659e, cVar.f9465l)); cVar.u(typedArray.getInt(g.b.f9660f, cVar.A)); cVar.v(typedArray.getInt(g.b.f9661g, cVar.B)); setDither(typedArray.getBoolean(g.b.f9656b, cVar.f9477x)); } @Override // f.d, f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ void applyTheme(Resources.Theme theme) { super.applyTheme(theme); } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ boolean canApplyTheme() { return super.canApplyTheme(); } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ void draw(Canvas canvas) { super.draw(canvas); } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ int getAlpha() { return super.getAlpha(); } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ int getChangingConfigurations() { return super.getChangingConfigurations(); } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ Drawable getCurrent() { return super.getCurrent(); } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ void getHotspotBounds(Rect rect) { super.getHotspotBounds(rect); } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ int getIntrinsicHeight() { return super.getIntrinsicHeight(); } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ int getIntrinsicWidth() { return super.getIntrinsicWidth(); } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ int getMinimumHeight() { return super.getMinimumHeight(); } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ int getMinimumWidth() { return super.getMinimumWidth(); } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ int getOpacity() { return super.getOpacity(); } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ void getOutline(Outline outline) { super.getOutline(outline); } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ boolean getPadding(Rect rect) { return super.getPadding(rect); } @Override // f.d, f.b void h(b.d dVar) { super.h(dVar); if (dVar instanceof c) { this.f9428o = (c) dVar; } } @Override // f.b, android.graphics.drawable.Drawable.Callback public /* bridge */ /* synthetic */ void invalidateDrawable(Drawable drawable) { super.invalidateDrawable(drawable); } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ boolean isAutoMirrored() { return super.isAutoMirrored(); } @Override // android.graphics.drawable.Drawable public boolean isStateful() { return true; } @Override // f.b, android.graphics.drawable.Drawable public void jumpToCurrentState() { super.jumpToCurrentState(); g gVar = this.f9429p; if (gVar != null) { gVar.d(); this.f9429p = null; g(this.f9430q); this.f9430q = -1; this.f9431r = -1; } } /* JADX INFO: Access modifiers changed from: package-private */ @Override // f.b /* renamed from: k, reason: merged with bridge method [inline-methods] */ public c b() { return new c(this.f9428o, this, null); } public void m(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) { TypedArray k10 = i.k(resources, theme, attributeSet, g.b.f9655a); setVisible(k10.getBoolean(g.b.f9657c, true), true); s(k10); i(resources); k10.recycle(); n(context, resources, xmlPullParser, attributeSet, theme); o(); } @Override // f.d, f.b, android.graphics.drawable.Drawable public Drawable mutate() { if (!this.f9432s && super.mutate() == this) { this.f9428o.r(); this.f9432s = true; } return this; } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ boolean onLayoutDirectionChanged(int i10) { return super.onLayoutDirectionChanged(i10); } @Override // f.d, android.graphics.drawable.Drawable protected boolean onStateChange(int[] iArr) { int F = this.f9428o.F(iArr); boolean z10 = F != c() && (r(F) || g(F)); Drawable current = getCurrent(); return current != null ? z10 | current.setState(iArr) : z10; } @Override // f.b, android.graphics.drawable.Drawable.Callback public /* bridge */ /* synthetic */ void scheduleDrawable(Drawable drawable, Runnable runnable, long j10) { super.scheduleDrawable(drawable, runnable, j10); } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ void setAlpha(int i10) { super.setAlpha(i10); } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ void setAutoMirrored(boolean z10) { super.setAutoMirrored(z10); } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ void setColorFilter(ColorFilter colorFilter) { super.setColorFilter(colorFilter); } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ void setDither(boolean z10) { super.setDither(z10); } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ void setHotspot(float f10, float f11) { super.setHotspot(f10, f11); } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ void setHotspotBounds(int i10, int i11, int i12, int i13) { super.setHotspotBounds(i10, i11, i12, i13); } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ void setTintList(ColorStateList colorStateList) { super.setTintList(colorStateList); } @Override // f.b, android.graphics.drawable.Drawable public /* bridge */ /* synthetic */ void setTintMode(PorterDuff.Mode mode) { super.setTintMode(mode); } @Override // f.b, android.graphics.drawable.Drawable public boolean setVisible(boolean z10, boolean z11) { boolean visible = super.setVisible(z10, z11); g gVar = this.f9429p; if (gVar != null && (visible || z11)) { if (z10) { gVar.c(); } else { jumpToCurrentState(); } } return visible; } @Override // f.b, android.graphics.drawable.Drawable.Callback public /* bridge */ /* synthetic */ void unscheduleDrawable(Drawable drawable, Runnable runnable) { super.unscheduleDrawable(drawable, runnable); } a(c cVar, Resources resources) { super(null); this.f9430q = -1; this.f9431r = -1; h(new c(cVar, this, resources)); onStateChange(getState()); jumpToCurrentState(); } }