package p037.p041.p049.p050;

import android.content.Context;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ListAdapter;
import androidx.appcompat.app.AlertController;
import androidx.appcompat.view.menu.ExpandedMenuView;
import java.util.ArrayList;
import p037.p041.C1474;
import p037.p041.p042.DialogInterfaceC1489;
import p037.p041.p049.p050.InterfaceC1587;
import p037.p041.p049.p050.InterfaceC1589;

/* JADX INFO: renamed from: މ.ؠ.ލ.ކ.ނ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C1569 implements InterfaceC1587, AdapterView.OnItemClickListener {

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public Context f5059;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public LayoutInflater f5060;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public C1572 f5061;

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public ExpandedMenuView f5062;

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public int f5063;

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public int f5064 = 0;

    /* JADX INFO: renamed from: މ, reason: contains not printable characters */
    public int f5065;

    /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
    public InterfaceC1587.InterfaceC1588 f5066;

    /* JADX INFO: renamed from: ދ, reason: contains not printable characters */
    public C1570 f5067;

    /* JADX INFO: renamed from: މ.ؠ.ލ.ކ.ނ$֏, reason: contains not printable characters */
    public class C1570 extends BaseAdapter {

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public int f5068 = -1;

        public C1570() {
            m3082();
        }

        @Override // android.widget.Adapter
        public int getCount() {
            C1572 c1572 = C1569.this.f5061;
            c1572.m3086();
            int size = c1572.f5086.size() - C1569.this.f5063;
            return this.f5068 < 0 ? size : size - 1;
        }

        @Override // android.widget.Adapter
        public C1576 getItem(int i) {
            C1572 c1572 = C1569.this.f5061;
            c1572.m3086();
            ArrayList<C1576> arrayList = c1572.f5086;
            int i2 = i + C1569.this.f5063;
            int i3 = this.f5068;
            if (i3 >= 0 && i2 >= i3) {
                i2++;
            }
            return arrayList.get(i2);
        }

        @Override // android.widget.Adapter
        public long getItemId(int i) {
            return i;
        }

        @Override // android.widget.Adapter
        public View getView(int i, View view, ViewGroup viewGroup) {
            if (view == null) {
                C1569 c1569 = C1569.this;
                view = c1569.f5060.inflate(c1569.f5065, viewGroup, false);
            }
            ((InterfaceC1589.InterfaceC1590) view).mo103(getItem(i), 0);
            return view;
        }

        @Override // android.widget.BaseAdapter
        public void notifyDataSetChanged() {
            m3082();
            super.notifyDataSetChanged();
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void m3082() {
            C1572 c1572 = C1569.this.f5061;
            C1576 c1576 = c1572.f5099;
            if (c1576 != null) {
                c1572.m3086();
                ArrayList<C1576> arrayList = c1572.f5086;
                int size = arrayList.size();
                for (int i = 0; i < size; i++) {
                    if (arrayList.get(i) == c1576) {
                        this.f5068 = i;
                        return;
                    }
                }
            }
            this.f5068 = -1;
        }
    }

    public C1569(Context context, int i) {
        this.f5065 = i;
        this.f5059 = context;
        this.f5060 = LayoutInflater.from(context);
    }

    @Override // android.widget.AdapterView.OnItemClickListener
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
        this.f5061.m3095(this.f5067.getItem(i), this, 0);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public ListAdapter m3081() {
        if (this.f5067 == null) {
            this.f5067 = new C1570();
        }
        return this.f5067;
    }

    @Override // p037.p041.p049.p050.InterfaceC1587
    /* JADX INFO: renamed from: ֏ */
    public void mo199(Context context, C1572 c1572) {
        if (this.f5064 != 0) {
            ContextThemeWrapper contextThemeWrapper = new ContextThemeWrapper(context, this.f5064);
            this.f5059 = contextThemeWrapper;
            this.f5060 = LayoutInflater.from(contextThemeWrapper);
        } else if (this.f5059 != null) {
            this.f5059 = context;
            if (this.f5060 == null) {
                this.f5060 = LayoutInflater.from(context);
            }
        }
        this.f5061 = c1572;
        C1570 c1570 = this.f5067;
        if (c1570 != null) {
            c1570.notifyDataSetChanged();
        }
    }

    @Override // p037.p041.p049.p050.InterfaceC1587
    /* JADX INFO: renamed from: ֏ */
    public void mo200(C1572 c1572, boolean z) {
        InterfaceC1587.InterfaceC1588 interfaceC1588 = this.f5066;
        if (interfaceC1588 != null) {
            interfaceC1588.mo142(c1572, z);
        }
    }

    @Override // p037.p041.p049.p050.InterfaceC1587
    /* JADX INFO: renamed from: ֏ */
    public void mo201(InterfaceC1587.InterfaceC1588 interfaceC1588) {
        this.f5066 = interfaceC1588;
    }

    @Override // p037.p041.p049.p050.InterfaceC1587
    /* JADX INFO: renamed from: ֏ */
    public void mo202(boolean z) {
        C1570 c1570 = this.f5067;
        if (c1570 != null) {
            c1570.notifyDataSetChanged();
        }
    }

    @Override // p037.p041.p049.p050.InterfaceC1587
    /* JADX INFO: renamed from: ֏ */
    public boolean mo203(C1572 c1572, C1576 c1576) {
        return false;
    }

    @Override // p037.p041.p049.p050.InterfaceC1587
    /* JADX INFO: renamed from: ֏ */
    public boolean mo204(SubMenuC1596 subMenuC1596) {
        if (!subMenuC1596.hasVisibleItems()) {
            return false;
        }
        DialogInterfaceOnKeyListenerC1575 dialogInterfaceOnKeyListenerC1575 = new DialogInterfaceOnKeyListenerC1575(subMenuC1596);
        C1572 c1572 = dialogInterfaceOnKeyListenerC1575.f5102;
        DialogInterfaceC1489.C1490 c1490 = new DialogInterfaceC1489.C1490(c1572.f5077);
        C1569 c1569 = new C1569(c1490.f4672.f168, C1474.abc_list_menu_item_layout);
        dialogInterfaceOnKeyListenerC1575.f5104 = c1569;
        c1569.f5066 = dialogInterfaceOnKeyListenerC1575;
        C1572 c15722 = dialogInterfaceOnKeyListenerC1575.f5102;
        c15722.m3092(c1569, c15722.f5077);
        ListAdapter listAdapterM3081 = dialogInterfaceOnKeyListenerC1575.f5104.m3081();
        AlertController.C0030 c0030 = c1490.f4672;
        c0030.f185 = listAdapterM3081;
        c0030.f186 = dialogInterfaceOnKeyListenerC1575;
        View view = c1572.f5091;
        if (view != null) {
            c0030.f174 = view;
        } else {
            c0030.f171 = c1572.f5090;
            c0030.f173 = c1572.f5089;
        }
        c1490.f4672.f183 = dialogInterfaceOnKeyListenerC1575;
        DialogInterfaceC1489 dialogInterfaceC1489M2816 = c1490.m2816();
        dialogInterfaceOnKeyListenerC1575.f5103 = dialogInterfaceC1489M2816;
        dialogInterfaceC1489M2816.setOnDismissListener(dialogInterfaceOnKeyListenerC1575);
        WindowManager.LayoutParams attributes = dialogInterfaceOnKeyListenerC1575.f5103.getWindow().getAttributes();
        attributes.type = 1003;
        attributes.flags |= 131072;
        dialogInterfaceOnKeyListenerC1575.f5103.show();
        InterfaceC1587.InterfaceC1588 interfaceC1588 = this.f5066;
        if (interfaceC1588 == null) {
            return true;
        }
        interfaceC1588.mo143(subMenuC1596);
        return true;
    }

    @Override // p037.p041.p049.p050.InterfaceC1587
    /* JADX INFO: renamed from: ؠ */
    public boolean mo205() {
        return false;
    }

    @Override // p037.p041.p049.p050.InterfaceC1587
    /* JADX INFO: renamed from: ؠ */
    public boolean mo206(C1572 c1572, C1576 c1576) {
        return false;
    }
}
