package androidx.appcompat.view.menu;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.appcompat.view.menu.InterfaceC0112i;
import androidx.appcompat.view.menu.InterfaceC0114j;
import java.util.ArrayList;

/* renamed from: androidx.appcompat.view.menu.a */
/* loaded from: classes.dex */
public abstract class AbstractC0093a implements InterfaceC0112i {

    /* renamed from: d */
    public Context f243d;

    /* renamed from: e */
    public Context f244e;

    /* renamed from: f */
    public C0103e f245f;

    /* renamed from: g */
    public LayoutInflater f246g;

    /* renamed from: h */
    public LayoutInflater f247h;

    /* renamed from: i */
    public InterfaceC0112i.InterfaceC0113a f248i;

    /* renamed from: j */
    public int f249j;

    /* renamed from: k */
    public int f250k;

    /* renamed from: l */
    public InterfaceC0114j f251l;

    /* renamed from: m */
    public int f252m;

    public AbstractC0093a(Context context, int i, int i2) {
        this.f243d = context;
        this.f246g = LayoutInflater.from(context);
        this.f249j = i;
        this.f250k = i2;
    }

    @Override // androidx.appcompat.view.menu.InterfaceC0112i
    /* renamed from: a */
    public void mo4649a(C0103e c0103e, boolean z) {
        InterfaceC0112i.InterfaceC0113a interfaceC0113a = this.f248i;
        if (interfaceC0113a != null) {
            interfaceC0113a.mo3381a(c0103e, z);
        }
    }

    /* renamed from: b */
    public void m4932b(View view, int i) {
        ViewGroup viewGroup = (ViewGroup) view.getParent();
        if (viewGroup != null) {
            viewGroup.removeView(view);
        }
        ((ViewGroup) this.f251l).addView(view, i);
    }

    @Override // androidx.appcompat.view.menu.InterfaceC0112i
    /* renamed from: d */
    public void mo2399d(Context context, C0103e c0103e) {
        this.f244e = context;
        this.f247h = LayoutInflater.from(context);
        this.f245f = c0103e;
    }

    @Override // androidx.appcompat.view.menu.InterfaceC0112i
    /* renamed from: e */
    public boolean mo2398e(C0103e c0103e, C0107g c0107g) {
        return false;
    }

    /* renamed from: f */
    public abstract void mo4647f(C0107g c0107g, InterfaceC0114j.InterfaceC0115a interfaceC0115a);

    @Override // androidx.appcompat.view.menu.InterfaceC0112i
    /* renamed from: g */
    public boolean mo2397g(C0103e c0103e, C0107g c0107g) {
        return false;
    }

    @Override // androidx.appcompat.view.menu.InterfaceC0112i
    /* renamed from: h */
    public void mo4821h(InterfaceC0112i.InterfaceC0113a interfaceC0113a) {
        this.f248i = interfaceC0113a;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r2v4, types: [androidx.appcompat.view.menu.e] */
    @Override // androidx.appcompat.view.menu.InterfaceC0112i
    /* renamed from: i */
    public boolean mo4646i(SubMenuC0119l subMenuC0119l) {
        InterfaceC0112i.InterfaceC0113a interfaceC0113a = this.f248i;
        SubMenuC0119l subMenuC0119l2 = subMenuC0119l;
        if (interfaceC0113a != null) {
            if (subMenuC0119l == null) {
                subMenuC0119l2 = this.f245f;
            }
            return interfaceC0113a.mo3380b(subMenuC0119l2);
        }
        return false;
    }

    @Override // androidx.appcompat.view.menu.InterfaceC0112i
    /* renamed from: j */
    public void mo4645j(boolean z) {
        ViewGroup viewGroup = (ViewGroup) this.f251l;
        if (viewGroup == null) {
            return;
        }
        C0103e c0103e = this.f245f;
        int i = 0;
        if (c0103e != null) {
            c0103e.m4873r();
            ArrayList<C0107g> m4909E = this.f245f.m4909E();
            int size = m4909E.size();
            int i2 = 0;
            for (int i3 = 0; i3 < size; i3++) {
                C0107g c0107g = m4909E.get(i3);
                if (mo4641q(i2, c0107g)) {
                    View childAt = viewGroup.getChildAt(i2);
                    C0107g itemData = childAt instanceof InterfaceC0114j.InterfaceC0115a ? ((InterfaceC0114j.InterfaceC0115a) childAt).getItemData() : null;
                    View mo4643n = mo4643n(c0107g, childAt, viewGroup);
                    if (c0107g != itemData) {
                        mo4643n.setPressed(false);
                        mo4643n.jumpDrawablesToCurrentState();
                    }
                    if (mo4643n != childAt) {
                        m4932b(mo4643n, i2);
                    }
                    i2++;
                }
            }
            i = i2;
        }
        while (i < viewGroup.getChildCount()) {
            if (!mo4644l(viewGroup, i)) {
                i++;
            }
        }
    }

    /* renamed from: k */
    public InterfaceC0114j.InterfaceC0115a m4931k(ViewGroup viewGroup) {
        return (InterfaceC0114j.InterfaceC0115a) this.f246g.inflate(this.f250k, viewGroup, false);
    }

    /* renamed from: l */
    public boolean mo4644l(ViewGroup viewGroup, int i) {
        viewGroup.removeViewAt(i);
        return true;
    }

    /* renamed from: m */
    public InterfaceC0112i.InterfaceC0113a m4930m() {
        return this.f248i;
    }

    /* renamed from: n */
    public View mo4643n(C0107g c0107g, View view, ViewGroup viewGroup) {
        InterfaceC0114j.InterfaceC0115a m4931k = view instanceof InterfaceC0114j.InterfaceC0115a ? (InterfaceC0114j.InterfaceC0115a) view : m4931k(viewGroup);
        mo4647f(c0107g, m4931k);
        return (View) m4931k;
    }

    /* renamed from: o */
    public InterfaceC0114j mo4642o(ViewGroup viewGroup) {
        if (this.f251l == null) {
            InterfaceC0114j interfaceC0114j = (InterfaceC0114j) this.f246g.inflate(this.f249j, viewGroup, false);
            this.f251l = interfaceC0114j;
            interfaceC0114j.mo4774b(this.f245f);
            mo4645j(true);
        }
        return this.f251l;
    }

    /* renamed from: p */
    public void m4929p(int i) {
        this.f252m = i;
    }

    /* renamed from: q */
    public abstract boolean mo4641q(int i, C0107g c0107g);
}