package ῲ.ῲ.ඓ.㳳;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import androidx.appcompat.view.menu.ListMenuItemView;
import java.util.ArrayList;
import ῲ.ῲ.ඓ.㳳.AbstractC1917;

/* renamed from: ῲ.ῲ.ඓ.㳳.㴹  reason: contains not printable characters */
/* compiled from: MenuAdapter */
public class C1924 extends BaseAdapter {

    /* renamed from: ʬ  reason: contains not printable characters */
    public int f6546 = -1;

    /* renamed from: ඓ  reason: contains not printable characters */
    public final boolean f6547;

    /* renamed from: ῲ  reason: contains not printable characters */
    public C1912 f6548;

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

    /* renamed from: 㴹  reason: contains not printable characters */
    public final LayoutInflater f6550;

    /* renamed from: 㸾  reason: contains not printable characters */
    public boolean f6551;

    public C1924(C1912 r2, LayoutInflater layoutInflater, boolean z, int i) {
        this.f6547 = z;
        this.f6550 = layoutInflater;
        this.f6548 = r2;
        this.f6549 = i;
        m4977();
    }

    public int getCount() {
        ArrayList<C1922> nonActionItems = this.f6547 ? this.f6548.getNonActionItems() : this.f6548.getVisibleItems();
        if (this.f6546 < 0) {
            return nonActionItems.size();
        }
        return nonActionItems.size() - 1;
    }

    public long getItemId(int i) {
        return (long) i;
    }

    public View getView(int i, View view, ViewGroup viewGroup) {
        if (view == null) {
            view = this.f6550.inflate(this.f6549, viewGroup, false);
        }
        int i2 = getItem(i).f6527;
        int i3 = i - 1;
        ListMenuItemView listMenuItemView = (ListMenuItemView) view;
        listMenuItemView.setGroupDividerEnabled(this.f6548.isGroupDividerEnabled() && i2 != (i3 >= 0 ? getItem(i3).f6527 : i2));
        AbstractC1917.AbstractC1918 k = (AbstractC1917.AbstractC1918) view;
        if (this.f6551) {
            listMenuItemView.setForceShowIcon(true);
        }
        k.initialize(getItem(i), 0);
        return view;
    }

    public void notifyDataSetChanged() {
        m4977();
        super.notifyDataSetChanged();
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m4977() {
        C1922 expandedItem = this.f6548.getExpandedItem();
        if (expandedItem != null) {
            ArrayList<C1922> nonActionItems = this.f6548.getNonActionItems();
            int size = nonActionItems.size();
            for (int i = 0; i < size; i++) {
                if (nonActionItems.get(i) == expandedItem) {
                    this.f6546 = i;
                    return;
                }
            }
        }
        this.f6546 = -1;
    }

    public C1922 getItem(int i) {
        ArrayList<C1922> nonActionItems = this.f6547 ? this.f6548.getNonActionItems() : this.f6548.getVisibleItems();
        int i2 = this.f6546;
        if (i2 >= 0 && i >= i2) {
            i++;
        }
        return nonActionItems.get(i);
    }
}
