package o; import android.content.Context; import android.content.res.TypedArray; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.util.TypedValue; import android.util.Xml; import android.view.View; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Iterator; import o.C3345avm; import org.xmlpull.v1.XmlPullParser; /* loaded from: classes.dex */ public final class Prc { public int a; public boolean b; public boolean c; public int d; public float e; public String f; public LWm g; public String i; /* loaded from: classes.dex */ public enum LWm { INT_TYPE, FLOAT_TYPE, COLOR_TYPE, COLOR_DRAWABLE_TYPE, STRING_TYPE, BOOLEAN_TYPE, DIMENSION_TYPE, REFERENCE_TYPE } /* renamed from: o.Prc$1, reason: invalid class name */ /* loaded from: classes.dex */ public static /* synthetic */ class AnonymousClass1 { public static final int[] a; static { int[] iArr = new int[LWm.values().length]; a = iArr; try { iArr[LWm.REFERENCE_TYPE.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { a[LWm.BOOLEAN_TYPE.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { a[LWm.STRING_TYPE.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } try { a[LWm.COLOR_TYPE.ordinal()] = 4; } catch (NoSuchFieldError unused4) { } try { a[LWm.COLOR_DRAWABLE_TYPE.ordinal()] = 5; } catch (NoSuchFieldError unused5) { } try { a[LWm.INT_TYPE.ordinal()] = 6; } catch (NoSuchFieldError unused6) { } try { a[LWm.FLOAT_TYPE.ordinal()] = 7; } catch (NoSuchFieldError unused7) { } try { a[LWm.DIMENSION_TYPE.ordinal()] = 8; } catch (NoSuchFieldError unused8) { } } } public final float c() { switch (AnonymousClass1.a[this.g.ordinal()]) { case 2: if (this.b) { return 1.0f; } return BitmapDescriptorFactory.HUE_RED; case 3: throw new RuntimeException("Cannot interpolate String"); case 4: case 5: throw new RuntimeException("Color does not have a single color to interpolate"); case 6: return this.a; case 7: return this.e; case 8: return this.e; default: return Float.NaN; } } public final void e(float[] fArr) { float f; switch (AnonymousClass1.a[this.g.ordinal()]) { case 2: if (!this.b) { f = BitmapDescriptorFactory.HUE_RED; break; } else { f = 1.0f; break; } case 3: throw new RuntimeException("Color does not have a single color to interpolate"); case 4: case 5: int i = this.d; float pow = (float) Math.pow(((i >> 16) & 255) / 255.0f, 2.2d); float pow2 = (float) Math.pow(((i >> 8) & 255) / 255.0f, 2.2d); float pow3 = (float) Math.pow((i & 255) / 255.0f, 2.2d); fArr[0] = pow; fArr[1] = pow2; fArr[2] = pow3; fArr[3] = (i >>> 24) / 255.0f; return; case 6: f = this.a; break; case 7: f = this.e; break; case 8: f = this.e; break; default: return; } fArr[0] = f; } private Prc(String str, LWm lWm, Object obj, boolean z) { this.f = str; this.g = lWm; this.c = z; a(obj); } private Prc(Prc prc, Object obj) { this.c = false; this.f = prc.f; this.g = prc.g; a(obj); } private void a(Object obj) { switch (AnonymousClass1.a[this.g.ordinal()]) { case 1: case 6: this.a = ((Integer) obj).intValue(); return; case 2: this.b = ((Boolean) obj).booleanValue(); return; case 3: this.i = (String) obj; return; case 4: case 5: this.d = ((Integer) obj).intValue(); return; case 7: this.e = ((Float) obj).floatValue(); return; case 8: this.e = ((Float) obj).floatValue(); return; default: return; } } public static HashMap e(HashMap hashMap, View view) { HashMap hashMap2 = new HashMap<>(); Class cls = view.getClass(); for (String str : hashMap.keySet()) { Prc prc = hashMap.get(str); try { if (str.equals("BackgroundColor")) { hashMap2.put(str, new Prc(prc, Integer.valueOf(((ColorDrawable) view.getBackground()).getColor()))); } else { StringBuilder sb = new StringBuilder(); sb.append("getMap"); sb.append(str); hashMap2.put(str, new Prc(prc, cls.getMethod(sb.toString(), new Class[0]).invoke(view, new Object[0]))); } } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException unused) { } } return hashMap2; } /* JADX WARN: Failed to find 'out' block for switch in B:9:0x0038. Please report as an issue. */ public static void d(View view, HashMap hashMap) { Class cls = view.getClass(); Iterator it = hashMap.keySet().iterator(); while (it.hasNext()) { String next = it.next(); Prc prc = hashMap.get(next); if (!prc.c) { next = "set".concat(String.valueOf(next)); } try { switch (AnonymousClass1.a[prc.g.ordinal()]) { case 1: cls.getMethod(next, Integer.TYPE).invoke(view, Integer.valueOf(prc.a)); break; case 2: cls.getMethod(next, Boolean.TYPE).invoke(view, Boolean.valueOf(prc.b)); break; case 3: cls.getMethod(next, CharSequence.class).invoke(view, prc.i); break; case 4: cls.getMethod(next, Integer.TYPE).invoke(view, Integer.valueOf(prc.d)); break; case 5: Method method = cls.getMethod(next, Drawable.class); ColorDrawable colorDrawable = new ColorDrawable(); colorDrawable.setColor(prc.d); method.invoke(view, colorDrawable); break; case 6: cls.getMethod(next, Integer.TYPE).invoke(view, Integer.valueOf(prc.a)); break; case 7: cls.getMethod(next, Float.TYPE).invoke(view, Float.valueOf(prc.e)); break; case 8: cls.getMethod(next, Float.TYPE).invoke(view, Float.valueOf(prc.e)); break; } } catch (IllegalAccessException | InvocationTargetException unused) { } catch (NoSuchMethodException e) { e.getMessage(); } } } public static void a(Context context, XmlPullParser xmlPullParser, HashMap hashMap) { LWm lWm; Object valueOf; TypedArray obtainStyledAttributes = context.obtainStyledAttributes(Xml.asAttributeSet(xmlPullParser), C3345avm.IeS.CustomAttribute); int indexCount = obtainStyledAttributes.getIndexCount(); String str = null; Object obj = null; LWm lWm2 = null; boolean z = false; for (int i = 0; i < indexCount; i++) { int index = obtainStyledAttributes.getIndex(i); if (index == C3345avm.IeS.CustomAttribute_attributeName) { str = obtainStyledAttributes.getString(index); if (str != null && str.length() > 0) { StringBuilder sb = new StringBuilder(); sb.append(Character.toUpperCase(str.charAt(0))); sb.append(str.substring(1)); str = sb.toString(); } } else if (index == C3345avm.IeS.CustomAttribute_methodName) { str = obtainStyledAttributes.getString(index); z = true; } else if (index == C3345avm.IeS.CustomAttribute_customBoolean) { obj = Boolean.valueOf(obtainStyledAttributes.getBoolean(index, false)); lWm2 = LWm.BOOLEAN_TYPE; } else { if (index == C3345avm.IeS.CustomAttribute_customColorValue) { lWm = LWm.COLOR_TYPE; valueOf = Integer.valueOf(obtainStyledAttributes.getColor(index, 0)); } else if (index == C3345avm.IeS.CustomAttribute_customColorDrawableValue) { lWm = LWm.COLOR_DRAWABLE_TYPE; valueOf = Integer.valueOf(obtainStyledAttributes.getColor(index, 0)); } else if (index == C3345avm.IeS.CustomAttribute_customPixelDimension) { lWm = LWm.DIMENSION_TYPE; valueOf = Float.valueOf(TypedValue.applyDimension(1, obtainStyledAttributes.getDimension(index, BitmapDescriptorFactory.HUE_RED), context.getResources().getDisplayMetrics())); } else if (index == C3345avm.IeS.CustomAttribute_customDimension) { lWm = LWm.DIMENSION_TYPE; valueOf = Float.valueOf(obtainStyledAttributes.getDimension(index, BitmapDescriptorFactory.HUE_RED)); } else if (index == C3345avm.IeS.CustomAttribute_customFloatValue) { lWm = LWm.FLOAT_TYPE; valueOf = Float.valueOf(obtainStyledAttributes.getFloat(index, Float.NaN)); } else if (index == C3345avm.IeS.CustomAttribute_customIntegerValue) { lWm = LWm.INT_TYPE; valueOf = Integer.valueOf(obtainStyledAttributes.getInteger(index, -1)); } else if (index == C3345avm.IeS.CustomAttribute_customStringValue) { lWm = LWm.STRING_TYPE; valueOf = obtainStyledAttributes.getString(index); } else if (index == C3345avm.IeS.CustomAttribute_customReference) { lWm = LWm.REFERENCE_TYPE; int resourceId = obtainStyledAttributes.getResourceId(index, -1); if (resourceId == -1) { resourceId = obtainStyledAttributes.getInt(index, -1); } valueOf = Integer.valueOf(resourceId); } Object obj2 = valueOf; lWm2 = lWm; obj = obj2; } } if (str != null && obj != null) { hashMap.put(str, new Prc(str, lWm2, obj, z)); } obtainStyledAttributes.recycle(); } }