package ῲ.ῲ.ඓ.㳳;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.appcompat.view.menu.ActionMenuItemView;
import androidx.appcompat.widget.ActionMenuPresenter;
import androidx.appcompat.widget.ActionMenuView;
import java.util.ArrayList;
import ῲ.ῲ.ඓ.㳳.AbstractC1897;
import ῲ.ῲ.ඓ.㳳.AbstractC1917;

/* renamed from: ῲ.ῲ.ඓ.㳳.ῲ  reason: contains not printable characters */
/* compiled from: BaseMenuPresenter */
public abstract class AbstractC1911 implements AbstractC1897 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public Context f6462;

    /* renamed from: ඓ  reason: contains not printable characters */
    public LayoutInflater f6463;

    /* renamed from: ᨨ  reason: contains not printable characters */
    public AbstractC1917 f6464;

    /* renamed from: ῲ  reason: contains not printable characters */
    public Context f6465;

    /* renamed from: ⁱ  reason: contains not printable characters */
    public int f6466;

    /* renamed from: 㳳  reason: contains not printable characters */
    public int f6467;

    /* renamed from: 㴹  reason: contains not printable characters */
    public AbstractC1897.AbstractC1898 f6468;

    /* renamed from: 㸾  reason: contains not printable characters */
    public C1912 f6469;

    /* renamed from: 㿎  reason: contains not printable characters */
    public int f6470;

    public AbstractC1911(Context context, int i, int i2) {
        this.f6465 = context;
        this.f6463 = LayoutInflater.from(context);
        this.f6466 = i;
        this.f6470 = i2;
    }

    @Override // ῲ.ῲ.ඓ.㳳.AbstractC1897
    public boolean collapseItemActionView(C1912 r1, C1922 r2) {
        return false;
    }

    @Override // ῲ.ῲ.ඓ.㳳.AbstractC1897
    public boolean expandItemActionView(C1912 r1, C1922 r2) {
        return false;
    }

    @Override // ῲ.ῲ.ඓ.㳳.AbstractC1897
    public int getId() {
        return this.f6467;
    }

    @Override // ῲ.ῲ.ඓ.㳳.AbstractC1897
    public void initForMenu(Context context, C1912 r2) {
        this.f6462 = context;
        LayoutInflater.from(this.f6462);
        this.f6469 = r2;
    }

    @Override // ῲ.ῲ.ඓ.㳳.AbstractC1897
    public void onCloseMenu(C1912 r2, boolean z) {
        AbstractC1897.AbstractC1898 k = this.f6468;
        if (k != null) {
            k.onCloseMenu(r2, z);
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r2v4, types: [ῲ.ῲ.ඓ.㳳.ⁱ] */
    /* JADX WARNING: Unknown variable types count: 1 */
    @Override // ῲ.ῲ.ඓ.㳳.AbstractC1897
    public boolean onSubMenuSelected(SubMenuC1900 r2) {
        AbstractC1897.AbstractC1898 k = this.f6468;
        SubMenuC1900 r22 = r2;
        if (k == null) {
            return false;
        }
        if (r2 == null) {
            r22 = this.f6469;
        }
        return k.m4922(r22);
    }

    @Override // ῲ.ῲ.ඓ.㳳.AbstractC1897
    public void setCallback(AbstractC1897.AbstractC1898 k) {
        this.f6468 = k;
    }

    @Override // ῲ.ῲ.ඓ.㳳.AbstractC1897
    public void updateMenuView(boolean z) {
        ViewGroup viewGroup = (ViewGroup) this.f6464;
        if (viewGroup != null) {
            C1912 r0 = this.f6469;
            int i = 0;
            if (r0 != null) {
                r0.flagActionItems();
                ArrayList<C1922> visibleItems = this.f6469.getVisibleItems();
                int size = visibleItems.size();
                int i2 = 0;
                for (int i3 = 0; i3 < size; i3++) {
                    C1922 r5 = visibleItems.get(i3);
                    ActionMenuPresenter actionMenuPresenter = (ActionMenuPresenter) this;
                    if (r5.m4973()) {
                        View childAt = viewGroup.getChildAt(i2);
                        C1922 itemData = childAt instanceof AbstractC1917.AbstractC1918 ? ((AbstractC1917.AbstractC1918) childAt).getItemData() : null;
                        View r8 = m4933(r5, childAt, viewGroup);
                        if (r5 != itemData) {
                            r8.setPressed(false);
                            r8.jumpDrawablesToCurrentState();
                        }
                        if (r8 != childAt) {
                            ViewGroup viewGroup2 = (ViewGroup) r8.getParent();
                            if (viewGroup2 != null) {
                                viewGroup2.removeView(r8);
                            }
                            ((ViewGroup) this.f6464).addView(r8, i2);
                        }
                        i2++;
                    }
                }
                i = i2;
            }
            while (i < viewGroup.getChildCount()) {
                if (!m4934(viewGroup, i)) {
                    i++;
                }
            }
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public boolean m4934(ViewGroup viewGroup, int i) {
        viewGroup.removeViewAt(i);
        return true;
    }

    /* renamed from: K  reason: contains not printable characters */
    public View m4933(C1922 r3, View view, ViewGroup viewGroup) {
        AbstractC1917.AbstractC1918 k;
        if (view instanceof AbstractC1917.AbstractC1918) {
            k = (AbstractC1917.AbstractC1918) view;
        } else {
            k = (AbstractC1917.AbstractC1918) this.f6463.inflate(this.f6470, viewGroup, false);
        }
        ActionMenuPresenter actionMenuPresenter = (ActionMenuPresenter) this;
        k.initialize(r3, 0);
        ActionMenuItemView actionMenuItemView = (ActionMenuItemView) k;
        actionMenuItemView.setItemInvoker((ActionMenuView) actionMenuPresenter.f6464);
        if (actionMenuPresenter.f430 == null) {
            actionMenuPresenter.f430 = new ActionMenuPresenter.C0063();
        }
        actionMenuItemView.setPopupCallback(actionMenuPresenter.f430);
        return (View) k;
    }
}
