package d.b.c;

import android.R;
import android.content.Context;
import android.content.ContextWrapper;
import android.util.AttributeSet;
import android.view.View;
import d.b.g.b0;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/* JADX INFO: loaded from: classes.dex */
public class o {
    public static final Class<?>[] a = {Context.class, AttributeSet.class};

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final int[] f1609b = {R.attr.onClick};

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final String[] f1610c = {"android.widget.", "android.view.", "android.webkit."};

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static final d.e.h<String, Constructor<? extends View>> f1611d = new d.e.h<>();

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final Object[] f1612e = new Object[2];

    public static class a implements View.OnClickListener {

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        public final View f1613f;

        /* JADX INFO: renamed from: m, reason: collision with root package name */
        public final String f1614m;

        /* JADX INFO: renamed from: n, reason: collision with root package name */
        public Method f1615n;

        /* JADX INFO: renamed from: o, reason: collision with root package name */
        public Context f1616o;

        public a(View view, String str) {
            this.f1613f = view;
            this.f1614m = str;
        }

        @Override // android.view.View.OnClickListener
        public void onClick(View view) {
            String string;
            Method method;
            if (this.f1615n == null) {
                Context context = this.f1613f.getContext();
                while (context != null) {
                    try {
                        if (!context.isRestricted() && (method = context.getClass().getMethod(this.f1614m, View.class)) != null) {
                            this.f1615n = method;
                            this.f1616o = context;
                        }
                    } catch (NoSuchMethodException unused) {
                    }
                    context = context instanceof ContextWrapper ? ((ContextWrapper) context).getBaseContext() : null;
                }
                int id = this.f1613f.getId();
                if (id == -1) {
                    string = "";
                } else {
                    StringBuilder sbF = g.a.a.a.a.F(" with id '");
                    sbF.append(this.f1613f.getContext().getResources().getResourceEntryName(id));
                    sbF.append("'");
                    string = sbF.toString();
                }
                StringBuilder sbF2 = g.a.a.a.a.F("Could not find method ");
                sbF2.append(this.f1614m);
                sbF2.append("(View) in a parent or ancestor Context for android:onClick attribute defined on view ");
                sbF2.append(this.f1613f.getClass());
                sbF2.append(string);
                throw new IllegalStateException(sbF2.toString());
            }
            try {
                this.f1615n.invoke(this.f1616o, view);
            } catch (IllegalAccessException e2) {
                throw new IllegalStateException("Could not execute non-public method for android:onClick", e2);
            } catch (InvocationTargetException e3) {
                throw new IllegalStateException("Could not execute method for android:onClick", e3);
            }
        }
    }

    public d.b.g.d a(Context context, AttributeSet attributeSet) {
        return new d.b.g.d(context, attributeSet);
    }

    public d.b.g.f b(Context context, AttributeSet attributeSet) {
        return new d.b.g.f(context, attributeSet);
    }

    public d.b.g.g c(Context context, AttributeSet attributeSet) {
        return new d.b.g.g(context, attributeSet);
    }

    public d.b.g.r d(Context context, AttributeSet attributeSet) {
        return new d.b.g.r(context, attributeSet, com.ifpdos.udi.service.core.pc.R.attr.radioButtonStyle);
    }

    public b0 e(Context context, AttributeSet attributeSet) {
        return new b0(context, attributeSet);
    }

    public View f() {
        return null;
    }

    public final View g(Context context, String str, String str2) {
        String str3;
        d.e.h<String, Constructor<? extends View>> hVar = f1611d;
        Constructor<? extends View> orDefault = hVar.getOrDefault(str, null);
        if (orDefault == null) {
            if (str2 != null) {
                try {
                    str3 = str2 + str;
                } catch (Exception unused) {
                    return null;
                }
            } else {
                str3 = str;
            }
            orDefault = Class.forName(str3, false, context.getClassLoader()).asSubclass(View.class).getConstructor(a);
            hVar.put(str, orDefault);
        }
        orDefault.setAccessible(true);
        return orDefault.newInstance(this.f1612e);
    }

    public final void h(View view, String str) {
        if (view != null) {
            return;
        }
        throw new IllegalStateException(getClass().getName() + " asked to inflate view for <" + str + ">, but returned null");
    }
}
