package p037.p041.p042;

import android.R;
import android.content.Context;
import android.content.ContextWrapper;
import android.util.AttributeSet;
import android.view.View;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import p037.p057.C1729;
import p138.p139.p143.p144.C2803;

/* JADX INFO: renamed from: މ.ؠ.ވ.ޑ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C1517 {

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public static final Class<?>[] f4794 = {Context.class, AttributeSet.class};

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public static final int[] f4795 = {R.attr.onClick};

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public static final String[] f4796 = {"android.widget.", "android.view.", "android.webkit."};

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public static final C1729<String, Constructor<? extends View>> f4797 = new C1729<>();

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final Object[] f4798 = new Object[2];

    /* JADX INFO: renamed from: މ.ؠ.ވ.ޑ$֏, reason: contains not printable characters */
    public static class ViewOnClickListenerC1518 implements View.OnClickListener {

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public final View f4799;

        /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
        public final String f4800;

        /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
        public Method f4801;

        /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
        public Context f4802;

        public ViewOnClickListenerC1518(View view, String str) {
            this.f4799 = view;
            this.f4800 = str;
        }

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

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final View m3000(Context context, String str, String str2) {
        String str3;
        Constructor<? extends View> orDefault = f4797.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(f4794);
            f4797.put(str, orDefault);
        }
        orDefault.setAccessible(true);
        return orDefault.newInstance(this.f4798);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m3001(View view, String str) {
        if (view != null) {
            return;
        }
        throw new IllegalStateException(C1517.class.getName() + " asked to inflate view for <" + str + ">, but returned null");
    }
}
