package o;

import android.content.Context;
import android.content.ContextWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.AdapterView;
import androidx.appcompat.view.menu.ExpandedMenuView;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class ML implements InterfaceC1093eP, AdapterView.OnItemClickListener {
    public Context l;
    public LayoutInflater m;
    public CO n;

    /* renamed from: o, reason: collision with root package name */
    public ExpandedMenuView f232o;
    public InterfaceC0998dP p;
    public LL q;

    public ML(ContextWrapper contextWrapper) {
        this.l = contextWrapper;
        this.m = LayoutInflater.from(contextWrapper);
    }

    @Override // o.InterfaceC1093eP
    public final void a(CO co, boolean z) {
        InterfaceC0998dP interfaceC0998dP = this.p;
        if (interfaceC0998dP != null) {
            interfaceC0998dP.a(co, z);
        }
    }

    @Override // o.InterfaceC1093eP
    public final void c() {
        LL ll = this.q;
        if (ll != null) {
            ll.notifyDataSetChanged();
        }
    }

    @Override // o.InterfaceC1093eP
    public final boolean d(LO lo) {
        return false;
    }

    @Override // o.InterfaceC1093eP
    public final void f(InterfaceC0998dP interfaceC0998dP) {
        throw null;
    }

    @Override // o.InterfaceC1093eP
    public final void g(Context context, CO co) {
        if (this.l != null) {
            this.l = context;
            if (this.m == null) {
                this.m = LayoutInflater.from(context);
            }
        }
        this.n = co;
        LL ll = this.q;
        if (ll != null) {
            ll.notifyDataSetChanged();
        }
    }

    @Override // o.InterfaceC1093eP
    public final boolean i() {
        return false;
    }

    @Override // o.InterfaceC1093eP
    public final boolean j(SubMenuC2155pb0 subMenuC2155pb0) {
        boolean zHasVisibleItems = subMenuC2155pb0.hasVisibleItems();
        Context context = subMenuC2155pb0.a;
        if (!zHasVisibleItems) {
            return false;
        }
        EO eo = new EO();
        eo.l = subMenuC2155pb0;
        C1254g2 c1254g2 = new C1254g2(context);
        C0871c2 c0871c2 = (C0871c2) c1254g2.n;
        ML ml = new ML(c0871c2.a);
        eo.n = ml;
        ml.p = eo;
        subMenuC2155pb0.b(ml, context);
        ML ml2 = eo.n;
        if (ml2.q == null) {
            ml2.q = new LL(ml2);
        }
        c0871c2.m = ml2.q;
        c0871c2.n = eo;
        View view = subMenuC2155pb0.f68o;
        if (view != null) {
            c0871c2.e = view;
        } else {
            c0871c2.c = subMenuC2155pb0.n;
            c0871c2.d = subMenuC2155pb0.m;
        }
        c0871c2.l = eo;
        DialogInterfaceC1350h2 dialogInterfaceC1350h2E = c1254g2.e();
        eo.m = dialogInterfaceC1350h2E;
        dialogInterfaceC1350h2E.setOnDismissListener(eo);
        WindowManager.LayoutParams attributes = eo.m.getWindow().getAttributes();
        attributes.type = 1003;
        attributes.flags |= 131072;
        eo.m.show();
        InterfaceC0998dP interfaceC0998dP = this.p;
        if (interfaceC0998dP == null) {
            return true;
        }
        interfaceC0998dP.k(subMenuC2155pb0);
        return true;
    }

    @Override // o.InterfaceC1093eP
    public final boolean k(LO lo) {
        return false;
    }

    @Override // android.widget.AdapterView.OnItemClickListener
    public final void onItemClick(AdapterView adapterView, View view, int i, long j) {
        this.n.q(this.q.getItem(i), this, 0);
    }
}
