package X6FRs_4.KQgRr5e_0.YghfZG_14.XnFJ5_9;

import android.content.Context;
import android.graphics.Rect;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.HeaderViewListAdapter;
import android.widget.ListAdapter;
import android.widget.PopupWindow;
/* compiled from: MenuPopup.java */
/* loaded from: classes.dex */
public abstract class EuDEkJe_12 implements Eps4cJe_18, YghfZG_14, AdapterView.OnItemClickListener {
    public Rect KQgRr5e_0;

    public abstract void KQgRr5e_0(int i);

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public abstract void mo474KQgRr5e_0(FSaI4_7 fSaI4_7);

    public void KQgRr5e_0(Rect rect) {
        this.KQgRr5e_0 = rect;
    }

    public abstract void KQgRr5e_0(View view);

    public abstract void KQgRr5e_0(PopupWindow.OnDismissListener onDismissListener);

    public abstract void KQgRr5e_0(boolean z);

    public abstract void PGPF6hQ_2(int i);

    public abstract void QxJ9d_1(int i);

    public abstract void QxJ9d_1(boolean z);

    public boolean QxJ9d_1() {
        return true;
    }

    @Override // X6FRs_4.KQgRr5e_0.YghfZG_14.XnFJ5_9.YghfZG_14
    public boolean collapseItemActionView(FSaI4_7 fSaI4_7, XnFJ5_9 xnFJ5_9) {
        return false;
    }

    @Override // X6FRs_4.KQgRr5e_0.YghfZG_14.XnFJ5_9.YghfZG_14
    public boolean expandItemActionView(FSaI4_7 fSaI4_7, XnFJ5_9 xnFJ5_9) {
        return false;
    }

    @Override // X6FRs_4.KQgRr5e_0.YghfZG_14.XnFJ5_9.YghfZG_14
    public int getId() {
        return 0;
    }

    @Override // X6FRs_4.KQgRr5e_0.YghfZG_14.XnFJ5_9.YghfZG_14
    public void initForMenu(Context context, FSaI4_7 fSaI4_7) {
    }

    @Override // android.widget.AdapterView.OnItemClickListener
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
        ListAdapter listAdapter = (ListAdapter) adapterView.getAdapter();
        KQgRr5e_0(listAdapter).f892KQgRr5e_0.performItemAction((MenuItem) listAdapter.getItem(i), this, QxJ9d_1() ? 0 : 4);
    }

    @Override // X6FRs_4.KQgRr5e_0.YghfZG_14.XnFJ5_9.Eps4cJe_18
    public Rect KQgRr5e_0() {
        return this.KQgRr5e_0;
    }

    public static int KQgRr5e_0(ListAdapter listAdapter, ViewGroup viewGroup, Context context, int i) {
        int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
        int makeMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(0, 0);
        int count = listAdapter.getCount();
        View view = null;
        int i2 = 0;
        int i3 = 0;
        for (int i4 = 0; i4 < count; i4++) {
            int itemViewType = listAdapter.getItemViewType(i4);
            if (itemViewType != i3) {
                view = null;
                i3 = itemViewType;
            }
            if (viewGroup == null) {
                viewGroup = new FrameLayout(context);
            }
            view = listAdapter.getView(i4, view, viewGroup);
            view.measure(makeMeasureSpec, makeMeasureSpec2);
            int measuredWidth = view.getMeasuredWidth();
            if (measuredWidth >= i) {
                return i;
            }
            if (measuredWidth > i2) {
                i2 = measuredWidth;
            }
        }
        return i2;
    }

    public static IMuAHx_6 KQgRr5e_0(ListAdapter listAdapter) {
        if (listAdapter instanceof HeaderViewListAdapter) {
            return (IMuAHx_6) ((HeaderViewListAdapter) listAdapter).getWrappedAdapter();
        }
        return (IMuAHx_6) listAdapter;
    }

    public static boolean KQgRr5e_0(FSaI4_7 fSaI4_7) {
        int size = fSaI4_7.size();
        for (int i = 0; i < size; i++) {
            MenuItem item = fSaI4_7.getItem(i);
            if (item.isVisible() && item.getIcon() != null) {
                return true;
            }
        }
        return false;
    }
}
