package p025i;

import android.content.Context;
import android.view.MenuItem;
import android.view.SubMenu;
import p005b0.InterfaceMenuItemC0469b;
import p005b0.InterfaceSubMenuC0470c;
import p037m.C1457g;

/* renamed from: i.b */
/* loaded from: classes.dex */
public abstract class AbstractC1005b {

    /* renamed from: a */
    public final Context f2530a;

    /* renamed from: b */
    public C1457g<InterfaceMenuItemC0469b, MenuItem> f2531b;

    /* renamed from: c */
    public C1457g<InterfaceSubMenuC0470c, SubMenu> f2532c;

    public AbstractC1005b(Context context) {
        this.f2530a = context;
    }

    /* renamed from: c */
    public final MenuItem m2414c(MenuItem menuItem) {
        if (menuItem instanceof InterfaceMenuItemC0469b) {
            InterfaceMenuItemC0469b interfaceMenuItemC0469b = (InterfaceMenuItemC0469b) menuItem;
            if (this.f2531b == null) {
                this.f2531b = new C1457g<>();
            }
            MenuItem menuItem2 = this.f2531b.get(interfaceMenuItemC0469b);
            if (menuItem2 == null) {
                MenuItemC1006c menuItemC1006c = new MenuItemC1006c(this.f2530a, interfaceMenuItemC0469b);
                this.f2531b.put(interfaceMenuItemC0469b, menuItemC1006c);
                return menuItemC1006c;
            }
            return menuItem2;
        }
        return menuItem;
    }

    /* renamed from: d */
    public final SubMenu m2413d(SubMenu subMenu) {
        if (subMenu instanceof InterfaceSubMenuC0470c) {
            InterfaceSubMenuC0470c interfaceSubMenuC0470c = (InterfaceSubMenuC0470c) subMenu;
            if (this.f2532c == null) {
                this.f2532c = new C1457g<>();
            }
            SubMenu subMenu2 = this.f2532c.get(interfaceSubMenuC0470c);
            if (subMenu2 == null) {
                SubMenuC1016h subMenuC1016h = new SubMenuC1016h(this.f2530a, interfaceSubMenuC0470c);
                this.f2532c.put(interfaceSubMenuC0470c, subMenuC1016h);
                return subMenuC1016h;
            }
            return subMenu2;
        }
        return subMenu;
    }

    /* renamed from: e */
    public final void m2412e() {
        C1457g<InterfaceMenuItemC0469b, MenuItem> c1457g = this.f2531b;
        if (c1457g != null) {
            c1457g.clear();
        }
        C1457g<InterfaceSubMenuC0470c, SubMenu> c1457g2 = this.f2532c;
        if (c1457g2 != null) {
            c1457g2.clear();
        }
    }

    /* renamed from: f */
    public final void m2411f(int i) {
        if (this.f2531b == null) {
            return;
        }
        int i2 = 0;
        while (i2 < this.f2531b.size()) {
            if (this.f2531b.m1322i(i2).getGroupId() == i) {
                this.f2531b.m1321j(i2);
                i2--;
            }
            i2++;
        }
    }

    /* renamed from: g */
    public final void m2410g(int i) {
        if (this.f2531b == null) {
            return;
        }
        for (int i2 = 0; i2 < this.f2531b.size(); i2++) {
            if (this.f2531b.m1322i(i2).getItemId() == i) {
                this.f2531b.m1321j(i2);
                return;
            }
        }
    }
}