package d.f.c;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.util.TypedValue;
import android.util.Xml;
import android.view.View;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import org.xmlpull.v1.XmlPullParser;

/* JADX INFO: loaded from: classes.dex */
public class a {
    public boolean a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public String f2432b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public int f2433c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public int f2434d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public float f2435e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public String f2436f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public boolean f2437g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public int f2438h;

    public a(a aVar, Object obj) {
        this.a = false;
        this.f2432b = aVar.f2432b;
        this.f2433c = aVar.f2433c;
        c(obj);
    }

    public a(String str, int i2, Object obj, boolean z2) {
        this.a = false;
        this.f2432b = str;
        this.f2433c = i2;
        this.a = z2;
        c(obj);
    }

    public static void a(Context context, XmlPullParser xmlPullParser, HashMap<String, a> map) {
        int resourceId;
        float dimension;
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(Xml.asAttributeSet(xmlPullParser), i.f2549e);
        int indexCount = typedArrayObtainStyledAttributes.getIndexCount();
        String string = null;
        int i2 = 0;
        boolean z2 = false;
        Object string2 = null;
        for (int i3 = 0; i3 < indexCount; i3++) {
            int index = typedArrayObtainStyledAttributes.getIndex(i3);
            int i4 = 1;
            if (index == 0) {
                string = typedArrayObtainStyledAttributes.getString(index);
                if (string != null && string.length() > 0) {
                    string = Character.toUpperCase(string.charAt(0)) + string.substring(1);
                }
            } else if (index == 10) {
                string = typedArrayObtainStyledAttributes.getString(index);
                z2 = true;
            } else if (index == 1) {
                string2 = Boolean.valueOf(typedArrayObtainStyledAttributes.getBoolean(index, false));
                i2 = 6;
            } else {
                if (index == 3) {
                    i4 = 3;
                } else if (index == 2) {
                    i4 = 4;
                } else {
                    if (index == 7) {
                        dimension = TypedValue.applyDimension(1, typedArrayObtainStyledAttributes.getDimension(index, 0.0f), context.getResources().getDisplayMetrics());
                    } else if (index == 4) {
                        dimension = typedArrayObtainStyledAttributes.getDimension(index, 0.0f);
                    } else if (index == 5) {
                        string2 = Float.valueOf(typedArrayObtainStyledAttributes.getFloat(index, Float.NaN));
                        i2 = 2;
                    } else {
                        if (index == 6) {
                            resourceId = typedArrayObtainStyledAttributes.getInteger(index, -1);
                        } else if (index == 9) {
                            string2 = typedArrayObtainStyledAttributes.getString(index);
                            i2 = 5;
                        } else if (index == 8) {
                            resourceId = typedArrayObtainStyledAttributes.getResourceId(index, -1);
                            if (resourceId == -1) {
                                resourceId = typedArrayObtainStyledAttributes.getInt(index, -1);
                            }
                            i4 = 8;
                        }
                        string2 = Integer.valueOf(resourceId);
                        i2 = i4;
                    }
                    string2 = Float.valueOf(dimension);
                    i2 = 7;
                }
                resourceId = typedArrayObtainStyledAttributes.getColor(index, 0);
                string2 = Integer.valueOf(resourceId);
                i2 = i4;
            }
        }
        if (string != null && string2 != null) {
            map.put(string, new a(string, i2, string2, z2));
        }
        typedArrayObtainStyledAttributes.recycle();
    }

    public static void b(View view, HashMap<String, a> map) {
        Class<?> cls = view.getClass();
        for (String str : map.keySet()) {
            a aVar = map.get(str);
            String strT = !aVar.a ? g.a.a.a.a.t("set", str) : str;
            try {
                switch (d.f.a.g.a(aVar.f2433c)) {
                    case 0:
                        cls.getMethod(strT, Integer.TYPE).invoke(view, Integer.valueOf(aVar.f2434d));
                        break;
                    case 1:
                        cls.getMethod(strT, Float.TYPE).invoke(view, Float.valueOf(aVar.f2435e));
                        break;
                    case 2:
                        cls.getMethod(strT, Integer.TYPE).invoke(view, Integer.valueOf(aVar.f2438h));
                        break;
                    case 3:
                        Method method = cls.getMethod(strT, Drawable.class);
                        ColorDrawable colorDrawable = new ColorDrawable();
                        colorDrawable.setColor(aVar.f2438h);
                        method.invoke(view, colorDrawable);
                        break;
                    case 4:
                        cls.getMethod(strT, CharSequence.class).invoke(view, aVar.f2436f);
                        break;
                    case 5:
                        cls.getMethod(strT, Boolean.TYPE).invoke(view, Boolean.valueOf(aVar.f2437g));
                        break;
                    case 6:
                        cls.getMethod(strT, Float.TYPE).invoke(view, Float.valueOf(aVar.f2435e));
                        break;
                    case 7:
                        cls.getMethod(strT, Integer.TYPE).invoke(view, Integer.valueOf(aVar.f2434d));
                        break;
                }
            } catch (IllegalAccessException e2) {
                StringBuilder sbK = g.a.a.a.a.K(" Custom Attribute \"", str, "\" not found on ");
                sbK.append(cls.getName());
                Log.e("TransitionLayout", sbK.toString());
                e2.printStackTrace();
            } catch (NoSuchMethodException e3) {
                Log.e("TransitionLayout", e3.getMessage());
                Log.e("TransitionLayout", " Custom Attribute \"" + str + "\" not found on " + cls.getName());
                StringBuilder sb = new StringBuilder();
                sb.append(cls.getName());
                sb.append(" must have a method ");
                sb.append(strT);
                Log.e("TransitionLayout", sb.toString());
            } catch (InvocationTargetException e4) {
                StringBuilder sbK2 = g.a.a.a.a.K(" Custom Attribute \"", str, "\" not found on ");
                sbK2.append(cls.getName());
                Log.e("TransitionLayout", sbK2.toString());
                e4.printStackTrace();
            }
        }
    }

    public void c(Object obj) {
        switch (d.f.a.g.a(this.f2433c)) {
            case 0:
            case 7:
                this.f2434d = ((Integer) obj).intValue();
                break;
            case 1:
            case 6:
                this.f2435e = ((Float) obj).floatValue();
                break;
            case 2:
            case 3:
                this.f2438h = ((Integer) obj).intValue();
                break;
            case 4:
                this.f2436f = (String) obj;
                break;
            case 5:
                this.f2437g = ((Boolean) obj).booleanValue();
                break;
        }
    }
}
