package p; import android.content.res.ColorStateList; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Color; import android.util.AttributeSet; import android.util.Log; import android.util.TypedValue; import android.util.Xml; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; /* loaded from: classes.dex */ public abstract class c { /* renamed from: a, reason: collision with root package name */ private static final ThreadLocal f12859a = new ThreadLocal(); public static ColorStateList a(Resources resources, XmlPullParser xmlPullParser, Resources.Theme theme) { int next; AttributeSet asAttributeSet = Xml.asAttributeSet(xmlPullParser); do { next = xmlPullParser.next(); if (next == 2) { break; } } while (next != 1); if (next == 2) { return b(resources, xmlPullParser, asAttributeSet, theme); } throw new XmlPullParserException("No start tag found"); } public static ColorStateList b(Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) { String name = xmlPullParser.getName(); if (name.equals("selector")) { return e(resources, xmlPullParser, attributeSet, theme); } throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ": invalid color state list tag " + name); } private static TypedValue c() { ThreadLocal threadLocal = f12859a; TypedValue typedValue = (TypedValue) threadLocal.get(); if (typedValue != null) { return typedValue; } TypedValue typedValue2 = new TypedValue(); threadLocal.set(typedValue2); return typedValue2; } public static ColorStateList d(Resources resources, int i10, Resources.Theme theme) { try { return a(resources, resources.getXml(i10), theme); } catch (Exception e10) { Log.e("CSLCompat", "Failed to inflate ColorStateList.", e10); return null; } } /* JADX WARN: Removed duplicated region for block: B:33:0x00a8 */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ private static android.content.res.ColorStateList e(android.content.res.Resources r17, org.xmlpull.v1.XmlPullParser r18, android.util.AttributeSet r19, android.content.res.Resources.Theme r20) { /* Method dump skipped, instructions count: 253 To view this dump change 'Code comments level' option to 'DEBUG' */ throw new UnsupportedOperationException("Method not decompiled: p.c.e(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources$Theme):android.content.res.ColorStateList"); } private static boolean f(Resources resources, int i10) { TypedValue c10 = c(); resources.getValue(i10, c10, true); int i11 = c10.type; return i11 >= 28 && i11 <= 31; } private static int g(int i10, float f10, float f11) { boolean z10 = f11 >= 0.0f && f11 <= 100.0f; if (f10 == 1.0f && !z10) { return i10; } int b10 = t.a.b((int) ((Color.alpha(i10) * f10) + 0.5f), 0, 255); if (z10) { a c10 = a.c(i10); i10 = a.m(c10.j(), c10.i(), f11); } return (i10 & 16777215) | (b10 << 24); } private static TypedArray h(Resources resources, Resources.Theme theme, AttributeSet attributeSet, int[] iArr) { return theme == null ? resources.obtainAttributes(attributeSet, iArr) : theme.obtainStyledAttributes(attributeSet, iArr, 0, 0); } }