package f; import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.StateSet; import f.b; /* loaded from: classes.dex */ abstract class d extends b { /* renamed from: m, reason: collision with root package name */ private a f9481m; /* renamed from: n, reason: collision with root package name */ private boolean f9482n; static class a extends b.d { int[][] J; a(a aVar, d dVar, Resources resources) { super(aVar, dVar, resources); if (aVar != null) { this.J = aVar.J; } else { this.J = new int[f()][]; } } int A(int[] iArr) { int[][] iArr2 = this.J; int h10 = h(); for (int i10 = 0; i10 < h10; i10++) { if (StateSet.stateSetMatches(iArr2[i10], iArr)) { return i10; } } return -1; } @Override // f.b.d public void o(int i10, int i11) { super.o(i10, i11); int[][] iArr = new int[i11][]; System.arraycopy(this.J, 0, iArr, 0, i10); this.J = iArr; } @Override // f.b.d abstract void r(); int z(int[] iArr, Drawable drawable) { int a10 = a(drawable); this.J[a10] = iArr; return a10; } } d(a aVar) { if (aVar != null) { h(aVar); } } @Override // f.b, android.graphics.drawable.Drawable public void applyTheme(Resources.Theme theme) { super.applyTheme(theme); onStateChange(getState()); } @Override // f.b void h(b.d dVar) { super.h(dVar); if (dVar instanceof a) { this.f9481m = (a) dVar; } } int[] j(AttributeSet attributeSet) { int attributeCount = attributeSet.getAttributeCount(); int[] iArr = new int[attributeCount]; int i10 = 0; for (int i11 = 0; i11 < attributeCount; i11++) { int attributeNameResource = attributeSet.getAttributeNameResource(i11); if (attributeNameResource != 0 && attributeNameResource != 16842960 && attributeNameResource != 16843161) { int i12 = i10 + 1; if (!attributeSet.getAttributeBooleanValue(i11, false)) { attributeNameResource = -attributeNameResource; } iArr[i10] = attributeNameResource; i10 = i12; } } return StateSet.trimStateSet(iArr, i10); } @Override // f.b, android.graphics.drawable.Drawable public Drawable mutate() { if (!this.f9482n && super.mutate() == this) { this.f9481m.r(); this.f9482n = true; } return this; } @Override // android.graphics.drawable.Drawable protected abstract boolean onStateChange(int[] iArr); }