package o; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import androidx.appcompat.view.menu.ListMenuItemView; import androidx.appcompat.view.menu.MenuItemImpl; import java.util.ArrayList; import o.Sya; /* renamed from: o.bpj, reason: case insensitive filesystem */ /* loaded from: classes.dex */ public final class C5263bpj extends BaseAdapter { private final LayoutInflater a; private final int b; boolean c; public NoP d; private int e = -1; private final boolean i; @Override // android.widget.Adapter public final long getItemId(int i) { return i; } public C5263bpj(NoP noP, LayoutInflater layoutInflater, boolean z, int i) { this.i = z; this.a = layoutInflater; this.d = noP; this.b = i; d(); } @Override // android.widget.Adapter public final View getView(int i, View view, ViewGroup viewGroup) { boolean z = false; if (view == null) { view = this.a.inflate(this.b, viewGroup, false); } int groupId = getItem(i).getGroupId(); int i2 = i - 1; int groupId2 = i2 >= 0 ? getItem(i2).getGroupId() : groupId; ListMenuItemView listMenuItemView = (ListMenuItemView) view; if (this.d.e() && groupId != groupId2) { z = true; } listMenuItemView.setGroupDividerEnabled(z); Sya.HBt hBt = (Sya.HBt) view; if (this.c) { listMenuItemView.setForceShowIcon(true); } hBt.c(getItem(i)); return view; } @Override // android.widget.BaseAdapter public final void notifyDataSetChanged() { d(); super.notifyDataSetChanged(); } private void d() { MenuItemImpl menuItemImpl = this.d.b; if (menuItemImpl != null) { NoP noP = this.d; noP.a(); ArrayList arrayList = noP.m; int size = arrayList.size(); for (int i = 0; i < size; i++) { if (arrayList.get(i) == menuItemImpl) { this.e = i; return; } } } this.e = -1; } @Override // android.widget.Adapter public final int getCount() { ArrayList d; if (!this.i) { d = this.d.d(); } else { NoP noP = this.d; noP.a(); d = noP.m; } if (this.e < 0) { return d.size(); } return d.size() - 1; } @Override // android.widget.Adapter /* renamed from: e, reason: merged with bridge method [inline-methods] */ public final MenuItemImpl getItem(int i) { ArrayList d; if (!this.i) { d = this.d.d(); } else { NoP noP = this.d; noP.a(); d = noP.m; } int i2 = this.e; if (i2 >= 0 && i >= i2) { i++; } return d.get(i); } }