package androidx.appcompat.app;

import X6FRs_4.IMuAHx_6.EuDEkJe_12.ZzDuCHW_20;
import X6FRs_4.KQgRr5e_0.XnFJ5_9;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.TypedArray;
import android.database.Cursor;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.ViewStub;
import android.view.Window;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckedTextView;
import android.widget.CursorAdapter;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;
import androidx.appcompat.widget.LinearLayoutCompat;
import androidx.core.widget.NestedScrollView;
import java.lang.ref.WeakReference;
/* loaded from: classes.dex */
public class AlertController {
    public int EuDEkJe_12;

    /* renamed from: IFxWkV_5  reason: collision with root package name */
    public int f3425IFxWkV_5;

    /* renamed from: KNBe_11  reason: collision with root package name */
    public int f3427KNBe_11;
    public final int KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final X6FRs_4.KQgRr5e_0.Nm6q_10.X6FRs_4 f1826KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final Context f1827KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public Drawable f1828KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public Handler f1829KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public Message f1830KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public View f1832KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final Window f1833KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public Button f1834KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public ImageView f1835KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public ListAdapter f1836KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public ListView f1837KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public TextView f1838KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public NestedScrollView f1839KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public CharSequence f1840KQgRr5e_0;

    /* renamed from: Mqv2r_3  reason: collision with root package name */
    public int f3428Mqv2r_3;

    /* renamed from: Mqv2r_3  reason: collision with other field name */
    public Drawable f1842Mqv2r_3;

    /* renamed from: Mqv2r_3  reason: collision with other field name */
    public CharSequence f1843Mqv2r_3;

    /* renamed from: Nm6q_10  reason: collision with root package name */
    public int f3429Nm6q_10;
    public int PGPF6hQ_2;

    /* renamed from: PGPF6hQ_2  reason: collision with other field name */
    public Drawable f1844PGPF6hQ_2;

    /* renamed from: PGPF6hQ_2  reason: collision with other field name */
    public Message f1845PGPF6hQ_2;

    /* renamed from: PGPF6hQ_2  reason: collision with other field name */
    public Button f1846PGPF6hQ_2;

    /* renamed from: PGPF6hQ_2  reason: collision with other field name */
    public CharSequence f1847PGPF6hQ_2;
    public int QxJ9d_1;

    /* renamed from: QxJ9d_1  reason: collision with other field name */
    public Drawable f1848QxJ9d_1;

    /* renamed from: QxJ9d_1  reason: collision with other field name */
    public Message f1849QxJ9d_1;

    /* renamed from: QxJ9d_1  reason: collision with other field name */
    public View f1850QxJ9d_1;

    /* renamed from: QxJ9d_1  reason: collision with other field name */
    public Button f1851QxJ9d_1;

    /* renamed from: QxJ9d_1  reason: collision with other field name */
    public TextView f1852QxJ9d_1;

    /* renamed from: QxJ9d_1  reason: collision with other field name */
    public CharSequence f1853QxJ9d_1;

    /* renamed from: QxJ9d_1  reason: collision with other field name */
    public boolean f1854QxJ9d_1;
    public int WwEq_13;

    /* renamed from: X6FRs_4  reason: collision with root package name */
    public int f3430X6FRs_4;

    /* renamed from: X6FRs_4  reason: collision with other field name */
    public CharSequence f1855X6FRs_4;

    /* renamed from: Xgtqvk_8  reason: collision with root package name */
    public int f3431Xgtqvk_8;

    /* renamed from: XnFJ5_9  reason: collision with root package name */
    public int f3432XnFJ5_9;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public boolean f1841KQgRr5e_0 = false;

    /* renamed from: IMuAHx_6  reason: collision with root package name */
    public int f3426IMuAHx_6 = 0;

    /* renamed from: FSaI4_7  reason: collision with root package name */
    public int f3424FSaI4_7 = -1;
    public int YghfZG_14 = 0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final View.OnClickListener f1831KQgRr5e_0 = new KQgRr5e_0();

    /* loaded from: classes.dex */
    public static class FSaI4_7 extends ArrayAdapter<CharSequence> {
        public FSaI4_7(Context context, int i, int i2, CharSequence[] charSequenceArr) {
            super(context, i, i2, charSequenceArr);
        }

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

        @Override // android.widget.BaseAdapter, android.widget.Adapter
        public boolean hasStableIds() {
            return true;
        }
    }

    /* loaded from: classes.dex */
    public static class IFxWkV_5 {

        /* renamed from: IFxWkV_5  reason: collision with root package name */
        public int f3434IFxWkV_5;

        /* renamed from: IMuAHx_6  reason: collision with root package name */
        public int f3435IMuAHx_6;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public final Context f1856KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public DialogInterface.OnCancelListener f1857KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public DialogInterface.OnClickListener f1858KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public DialogInterface.OnDismissListener f1859KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public DialogInterface.OnKeyListener f1860KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public DialogInterface.OnMultiChoiceClickListener f1861KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public Cursor f1862KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public Drawable f1863KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public final LayoutInflater f1864KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public View f1865KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public AdapterView.OnItemSelectedListener f1866KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public ListAdapter f1867KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public X6FRs_4 f1868KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public CharSequence f1869KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public String f1870KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public CharSequence[] f1872KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public boolean[] f1873KQgRr5e_0;

        /* renamed from: Mqv2r_3  reason: collision with root package name */
        public int f3436Mqv2r_3;

        /* renamed from: Mqv2r_3  reason: collision with other field name */
        public DialogInterface.OnClickListener f1874Mqv2r_3;

        /* renamed from: Mqv2r_3  reason: collision with other field name */
        public Drawable f1875Mqv2r_3;

        /* renamed from: Mqv2r_3  reason: collision with other field name */
        public CharSequence f1876Mqv2r_3;

        /* renamed from: Mqv2r_3  reason: collision with other field name */
        public boolean f1877Mqv2r_3;
        public int PGPF6hQ_2;

        /* renamed from: PGPF6hQ_2  reason: collision with other field name */
        public DialogInterface.OnClickListener f1878PGPF6hQ_2;

        /* renamed from: PGPF6hQ_2  reason: collision with other field name */
        public Drawable f1879PGPF6hQ_2;

        /* renamed from: PGPF6hQ_2  reason: collision with other field name */
        public CharSequence f1880PGPF6hQ_2;

        /* renamed from: PGPF6hQ_2  reason: collision with other field name */
        public boolean f1881PGPF6hQ_2;

        /* renamed from: QxJ9d_1  reason: collision with other field name */
        public DialogInterface.OnClickListener f1882QxJ9d_1;

        /* renamed from: QxJ9d_1  reason: collision with other field name */
        public Drawable f1883QxJ9d_1;

        /* renamed from: QxJ9d_1  reason: collision with other field name */
        public View f1884QxJ9d_1;

        /* renamed from: QxJ9d_1  reason: collision with other field name */
        public CharSequence f1885QxJ9d_1;

        /* renamed from: QxJ9d_1  reason: collision with other field name */
        public String f1886QxJ9d_1;

        /* renamed from: X6FRs_4  reason: collision with root package name */
        public int f3437X6FRs_4;

        /* renamed from: X6FRs_4  reason: collision with other field name */
        public CharSequence f1888X6FRs_4;
        public int KQgRr5e_0 = 0;
        public int QxJ9d_1 = 0;

        /* renamed from: QxJ9d_1  reason: collision with other field name */
        public boolean f1887QxJ9d_1 = false;

        /* renamed from: FSaI4_7  reason: collision with root package name */
        public int f3433FSaI4_7 = -1;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public boolean f1871KQgRr5e_0 = true;

        /* loaded from: classes.dex */
        public class KQgRr5e_0 extends ArrayAdapter<CharSequence> {

            /* renamed from: KQgRr5e_0  reason: collision with other field name */
            public final /* synthetic */ RecycleListView f1889KQgRr5e_0;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            public KQgRr5e_0(Context context, int i, int i2, CharSequence[] charSequenceArr, RecycleListView recycleListView) {
                super(context, i, i2, charSequenceArr);
                this.f1889KQgRr5e_0 = recycleListView;
            }

            @Override // android.widget.ArrayAdapter, android.widget.Adapter
            public View getView(int i, View view, ViewGroup viewGroup) {
                View view2 = super.getView(i, view, viewGroup);
                boolean[] zArr = IFxWkV_5.this.f1873KQgRr5e_0;
                if (zArr != null && zArr[i]) {
                    this.f1889KQgRr5e_0.setItemChecked(i, true);
                }
                return view2;
            }
        }

        /* loaded from: classes.dex */
        public class Mqv2r_3 implements AdapterView.OnItemClickListener {

            /* renamed from: KQgRr5e_0  reason: collision with other field name */
            public final /* synthetic */ RecycleListView f1890KQgRr5e_0;

            /* renamed from: KQgRr5e_0  reason: collision with other field name */
            public final /* synthetic */ AlertController f1891KQgRr5e_0;

            public Mqv2r_3(RecycleListView recycleListView, AlertController alertController) {
                this.f1890KQgRr5e_0 = recycleListView;
                this.f1891KQgRr5e_0 = alertController;
            }

            @Override // android.widget.AdapterView.OnItemClickListener
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
                boolean[] zArr = IFxWkV_5.this.f1873KQgRr5e_0;
                if (zArr != null) {
                    zArr[i] = this.f1890KQgRr5e_0.isItemChecked(i);
                }
                IFxWkV_5.this.f1861KQgRr5e_0.onClick(this.f1891KQgRr5e_0.f1826KQgRr5e_0, i, this.f1890KQgRr5e_0.isItemChecked(i));
            }
        }

        /* loaded from: classes.dex */
        public class PGPF6hQ_2 implements AdapterView.OnItemClickListener {

            /* renamed from: KQgRr5e_0  reason: collision with other field name */
            public final /* synthetic */ AlertController f1892KQgRr5e_0;

            public PGPF6hQ_2(AlertController alertController) {
                this.f1892KQgRr5e_0 = alertController;
            }

            @Override // android.widget.AdapterView.OnItemClickListener
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
                IFxWkV_5.this.f1874Mqv2r_3.onClick(this.f1892KQgRr5e_0.f1826KQgRr5e_0, i);
                if (IFxWkV_5.this.f1877Mqv2r_3) {
                    return;
                }
                this.f1892KQgRr5e_0.f1826KQgRr5e_0.dismiss();
            }
        }

        /* loaded from: classes.dex */
        public class QxJ9d_1 extends CursorAdapter {
            public final int KQgRr5e_0;

            /* renamed from: KQgRr5e_0  reason: collision with other field name */
            public final /* synthetic */ RecycleListView f1894KQgRr5e_0;

            /* renamed from: KQgRr5e_0  reason: collision with other field name */
            public final /* synthetic */ AlertController f1895KQgRr5e_0;
            public final int QxJ9d_1;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            public QxJ9d_1(Context context, Cursor cursor, boolean z, RecycleListView recycleListView, AlertController alertController) {
                super(context, cursor, z);
                this.f1894KQgRr5e_0 = recycleListView;
                this.f1895KQgRr5e_0 = alertController;
                Cursor cursor2 = getCursor();
                this.KQgRr5e_0 = cursor2.getColumnIndexOrThrow(IFxWkV_5.this.f1870KQgRr5e_0);
                this.QxJ9d_1 = cursor2.getColumnIndexOrThrow(IFxWkV_5.this.f1886QxJ9d_1);
            }

            @Override // android.widget.CursorAdapter
            public void bindView(View view, Context context, Cursor cursor) {
                ((CheckedTextView) view.findViewById(16908308)).setText(cursor.getString(this.KQgRr5e_0));
                this.f1894KQgRr5e_0.setItemChecked(cursor.getPosition(), cursor.getInt(this.QxJ9d_1) == 1);
            }

            @Override // android.widget.CursorAdapter
            public View newView(Context context, Cursor cursor, ViewGroup viewGroup) {
                return IFxWkV_5.this.f1864KQgRr5e_0.inflate(this.f1895KQgRr5e_0.f3427KNBe_11, viewGroup, false);
            }
        }

        /* loaded from: classes.dex */
        public interface X6FRs_4 {
            void KQgRr5e_0(ListView listView);
        }

        public IFxWkV_5(Context context) {
            this.f1856KQgRr5e_0 = context;
            this.f1864KQgRr5e_0 = (LayoutInflater) context.getSystemService("layout_inflater");
        }

        public void KQgRr5e_0(AlertController alertController) {
            View view = this.f1865KQgRr5e_0;
            if (view != null) {
                alertController.m827KQgRr5e_0(view);
            } else {
                CharSequence charSequence = this.f1869KQgRr5e_0;
                if (charSequence != null) {
                    alertController.QxJ9d_1(charSequence);
                }
                Drawable drawable = this.f1863KQgRr5e_0;
                if (drawable != null) {
                    alertController.KQgRr5e_0(drawable);
                }
                int i = this.KQgRr5e_0;
                if (i != 0) {
                    alertController.m826KQgRr5e_0(i);
                }
                int i2 = this.QxJ9d_1;
                if (i2 != 0) {
                    alertController.m826KQgRr5e_0(alertController.KQgRr5e_0(i2));
                }
            }
            CharSequence charSequence2 = this.f1885QxJ9d_1;
            if (charSequence2 != null) {
                alertController.KQgRr5e_0(charSequence2);
            }
            if (this.f1880PGPF6hQ_2 != null || this.f1883QxJ9d_1 != null) {
                alertController.KQgRr5e_0(-1, this.f1880PGPF6hQ_2, this.f1858KQgRr5e_0, (Message) null, this.f1883QxJ9d_1);
            }
            if (this.f1876Mqv2r_3 != null || this.f1879PGPF6hQ_2 != null) {
                alertController.KQgRr5e_0(-2, this.f1876Mqv2r_3, this.f1882QxJ9d_1, (Message) null, this.f1879PGPF6hQ_2);
            }
            if (this.f1888X6FRs_4 != null || this.f1875Mqv2r_3 != null) {
                alertController.KQgRr5e_0(-3, this.f1888X6FRs_4, this.f1878PGPF6hQ_2, (Message) null, this.f1875Mqv2r_3);
            }
            if (this.f1872KQgRr5e_0 != null || this.f1862KQgRr5e_0 != null || this.f1867KQgRr5e_0 != null) {
                QxJ9d_1(alertController);
            }
            View view2 = this.f1884QxJ9d_1;
            if (view2 != null) {
                if (this.f1887QxJ9d_1) {
                    alertController.KQgRr5e_0(view2, this.f3436Mqv2r_3, this.f3437X6FRs_4, this.f3434IFxWkV_5, this.f3435IMuAHx_6);
                    return;
                } else {
                    alertController.QxJ9d_1(view2);
                    return;
                }
            }
            int i3 = this.PGPF6hQ_2;
            if (i3 != 0) {
                alertController.QxJ9d_1(i3);
            }
        }

        public final void QxJ9d_1(AlertController alertController) {
            int i;
            ListAdapter listAdapter;
            RecycleListView recycleListView = (RecycleListView) this.f1864KQgRr5e_0.inflate(alertController.f3429Nm6q_10, (ViewGroup) null);
            if (this.f1881PGPF6hQ_2) {
                if (this.f1862KQgRr5e_0 == null) {
                    listAdapter = new KQgRr5e_0(this.f1856KQgRr5e_0, alertController.f3427KNBe_11, 16908308, this.f1872KQgRr5e_0, recycleListView);
                } else {
                    listAdapter = new QxJ9d_1(this.f1856KQgRr5e_0, this.f1862KQgRr5e_0, false, recycleListView, alertController);
                }
            } else {
                if (this.f1877Mqv2r_3) {
                    i = alertController.EuDEkJe_12;
                } else {
                    i = alertController.WwEq_13;
                }
                int i2 = i;
                if (this.f1862KQgRr5e_0 != null) {
                    listAdapter = new SimpleCursorAdapter(this.f1856KQgRr5e_0, i2, this.f1862KQgRr5e_0, new String[]{this.f1870KQgRr5e_0}, new int[]{16908308});
                } else {
                    listAdapter = this.f1867KQgRr5e_0;
                    if (listAdapter == null) {
                        listAdapter = new FSaI4_7(this.f1856KQgRr5e_0, i2, 16908308, this.f1872KQgRr5e_0);
                    }
                }
            }
            X6FRs_4 x6FRs_4 = this.f1868KQgRr5e_0;
            if (x6FRs_4 != null) {
                x6FRs_4.KQgRr5e_0(recycleListView);
            }
            alertController.f1836KQgRr5e_0 = listAdapter;
            alertController.f3424FSaI4_7 = this.f3433FSaI4_7;
            if (this.f1874Mqv2r_3 != null) {
                recycleListView.setOnItemClickListener(new PGPF6hQ_2(alertController));
            } else if (this.f1861KQgRr5e_0 != null) {
                recycleListView.setOnItemClickListener(new Mqv2r_3(recycleListView, alertController));
            }
            AdapterView.OnItemSelectedListener onItemSelectedListener = this.f1866KQgRr5e_0;
            if (onItemSelectedListener != null) {
                recycleListView.setOnItemSelectedListener(onItemSelectedListener);
            }
            if (this.f1877Mqv2r_3) {
                recycleListView.setChoiceMode(1);
            } else if (this.f1881PGPF6hQ_2) {
                recycleListView.setChoiceMode(2);
            }
            alertController.f1837KQgRr5e_0 = recycleListView;
        }
    }

    /* loaded from: classes.dex */
    public static final class IMuAHx_6 extends Handler {
        public WeakReference<DialogInterface> KQgRr5e_0;

        public IMuAHx_6(DialogInterface dialogInterface) {
            this.KQgRr5e_0 = new WeakReference<>(dialogInterface);
        }

        @Override // android.os.Handler
        public void handleMessage(Message message) {
            int i = message.what;
            if (i == -3 || i == -2 || i == -1) {
                ((DialogInterface.OnClickListener) message.obj).onClick(this.KQgRr5e_0.get(), message.what);
            } else if (i != 1) {
            } else {
                ((DialogInterface) message.obj).dismiss();
            }
        }
    }

    /* loaded from: classes.dex */
    public class KQgRr5e_0 implements View.OnClickListener {
        public KQgRr5e_0() {
        }

        @Override // android.view.View.OnClickListener
        public void onClick(View view) {
            Message obtain;
            Message message;
            Message message2;
            Message message3;
            AlertController alertController = AlertController.this;
            if (view == alertController.f1834KQgRr5e_0 && (message3 = alertController.f1830KQgRr5e_0) != null) {
                obtain = Message.obtain(message3);
            } else {
                AlertController alertController2 = AlertController.this;
                if (view == alertController2.f1851QxJ9d_1 && (message2 = alertController2.f1849QxJ9d_1) != null) {
                    obtain = Message.obtain(message2);
                } else {
                    AlertController alertController3 = AlertController.this;
                    obtain = (view != alertController3.f1846PGPF6hQ_2 || (message = alertController3.f1845PGPF6hQ_2) == null) ? null : Message.obtain(message);
                }
            }
            if (obtain != null) {
                obtain.sendToTarget();
            }
            AlertController alertController4 = AlertController.this;
            alertController4.f1829KQgRr5e_0.obtainMessage(1, alertController4.f1826KQgRr5e_0).sendToTarget();
        }
    }

    /* loaded from: classes.dex */
    public class Mqv2r_3 implements AbsListView.OnScrollListener {
        public final /* synthetic */ View KQgRr5e_0;
        public final /* synthetic */ View QxJ9d_1;

        public Mqv2r_3(AlertController alertController, View view, View view2) {
            this.KQgRr5e_0 = view;
            this.QxJ9d_1 = view2;
        }

        @Override // android.widget.AbsListView.OnScrollListener
        public void onScroll(AbsListView absListView, int i, int i2, int i3) {
            AlertController.KQgRr5e_0(absListView, this.KQgRr5e_0, this.QxJ9d_1);
        }

        @Override // android.widget.AbsListView.OnScrollListener
        public void onScrollStateChanged(AbsListView absListView, int i) {
        }
    }

    /* loaded from: classes.dex */
    public class PGPF6hQ_2 implements Runnable {
        public final /* synthetic */ View KQgRr5e_0;
        public final /* synthetic */ View QxJ9d_1;

        public PGPF6hQ_2(View view, View view2) {
            this.KQgRr5e_0 = view;
            this.QxJ9d_1 = view2;
        }

        @Override // java.lang.Runnable
        public void run() {
            AlertController.KQgRr5e_0(AlertController.this.f1839KQgRr5e_0, this.KQgRr5e_0, this.QxJ9d_1);
        }
    }

    /* loaded from: classes.dex */
    public class QxJ9d_1 implements NestedScrollView.QxJ9d_1 {
        public final /* synthetic */ View KQgRr5e_0;
        public final /* synthetic */ View QxJ9d_1;

        public QxJ9d_1(AlertController alertController, View view, View view2) {
            this.KQgRr5e_0 = view;
            this.QxJ9d_1 = view2;
        }

        @Override // androidx.core.widget.NestedScrollView.QxJ9d_1
        public void KQgRr5e_0(NestedScrollView nestedScrollView, int i, int i2, int i3, int i4) {
            AlertController.KQgRr5e_0(nestedScrollView, this.KQgRr5e_0, this.QxJ9d_1);
        }
    }

    /* loaded from: classes.dex */
    public static class RecycleListView extends ListView {
        public final int KQgRr5e_0;
        public final int QxJ9d_1;

        public RecycleListView(Context context) {
            this(context, null);
        }

        public void KQgRr5e_0(boolean z, boolean z2) {
            if (z2 && z) {
                return;
            }
            setPadding(getPaddingLeft(), z ? getPaddingTop() : this.KQgRr5e_0, getPaddingRight(), z2 ? getPaddingBottom() : this.QxJ9d_1);
        }

        public RecycleListView(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
            TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, XnFJ5_9.RecycleListView);
            this.QxJ9d_1 = obtainStyledAttributes.getDimensionPixelOffset(XnFJ5_9.RecycleListView_paddingBottomNoButtons, -1);
            this.KQgRr5e_0 = obtainStyledAttributes.getDimensionPixelOffset(XnFJ5_9.RecycleListView_paddingTopNoTitle, -1);
        }
    }

    /* loaded from: classes.dex */
    public class X6FRs_4 implements Runnable {
        public final /* synthetic */ View KQgRr5e_0;
        public final /* synthetic */ View QxJ9d_1;

        public X6FRs_4(View view, View view2) {
            this.KQgRr5e_0 = view;
            this.QxJ9d_1 = view2;
        }

        @Override // java.lang.Runnable
        public void run() {
            AlertController.KQgRr5e_0(AlertController.this.f1837KQgRr5e_0, this.KQgRr5e_0, this.QxJ9d_1);
        }
    }

    public AlertController(Context context, X6FRs_4.KQgRr5e_0.Nm6q_10.X6FRs_4 x6FRs_4, Window window) {
        this.f1827KQgRr5e_0 = context;
        this.f1826KQgRr5e_0 = x6FRs_4;
        this.f1833KQgRr5e_0 = window;
        this.f1829KQgRr5e_0 = new IMuAHx_6(x6FRs_4);
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(null, XnFJ5_9.AlertDialog, X6FRs_4.KQgRr5e_0.KQgRr5e_0.alertDialogStyle, 0);
        this.f3431Xgtqvk_8 = obtainStyledAttributes.getResourceId(XnFJ5_9.AlertDialog_android_layout, 0);
        this.f3432XnFJ5_9 = obtainStyledAttributes.getResourceId(XnFJ5_9.AlertDialog_buttonPanelSideLayout, 0);
        this.f3429Nm6q_10 = obtainStyledAttributes.getResourceId(XnFJ5_9.AlertDialog_listLayout, 0);
        this.f3427KNBe_11 = obtainStyledAttributes.getResourceId(XnFJ5_9.AlertDialog_multiChoiceItemLayout, 0);
        this.EuDEkJe_12 = obtainStyledAttributes.getResourceId(XnFJ5_9.AlertDialog_singleChoiceItemLayout, 0);
        this.WwEq_13 = obtainStyledAttributes.getResourceId(XnFJ5_9.AlertDialog_listItemLayout, 0);
        this.f1854QxJ9d_1 = obtainStyledAttributes.getBoolean(XnFJ5_9.AlertDialog_showTitle, true);
        this.KQgRr5e_0 = obtainStyledAttributes.getDimensionPixelSize(XnFJ5_9.AlertDialog_buttonIconDimen, 0);
        obtainStyledAttributes.recycle();
        x6FRs_4.supportRequestWindowFeature(1);
    }

    public static boolean KQgRr5e_0(Context context) {
        TypedValue typedValue = new TypedValue();
        context.getTheme().resolveAttribute(X6FRs_4.KQgRr5e_0.KQgRr5e_0.alertDialogCenterButtons, typedValue, true);
        return typedValue.data != 0;
    }

    public final void Mqv2r_3(ViewGroup viewGroup) {
        if (this.f1850QxJ9d_1 != null) {
            viewGroup.addView(this.f1850QxJ9d_1, 0, new ViewGroup.LayoutParams(-1, -2));
            this.f1833KQgRr5e_0.findViewById(X6FRs_4.KQgRr5e_0.IFxWkV_5.title_template).setVisibility(8);
            return;
        }
        this.f1835KQgRr5e_0 = (ImageView) this.f1833KQgRr5e_0.findViewById(16908294);
        if ((!TextUtils.isEmpty(this.f1840KQgRr5e_0)) && this.f1854QxJ9d_1) {
            TextView textView = (TextView) this.f1833KQgRr5e_0.findViewById(X6FRs_4.KQgRr5e_0.IFxWkV_5.alertTitle);
            this.f1838KQgRr5e_0 = textView;
            textView.setText(this.f1840KQgRr5e_0);
            int i = this.f3426IMuAHx_6;
            if (i != 0) {
                this.f1835KQgRr5e_0.setImageResource(i);
                return;
            }
            Drawable drawable = this.f1842Mqv2r_3;
            if (drawable != null) {
                this.f1835KQgRr5e_0.setImageDrawable(drawable);
                return;
            }
            this.f1838KQgRr5e_0.setPadding(this.f1835KQgRr5e_0.getPaddingLeft(), this.f1835KQgRr5e_0.getPaddingTop(), this.f1835KQgRr5e_0.getPaddingRight(), this.f1835KQgRr5e_0.getPaddingBottom());
            this.f1835KQgRr5e_0.setVisibility(8);
            return;
        }
        this.f1833KQgRr5e_0.findViewById(X6FRs_4.KQgRr5e_0.IFxWkV_5.title_template).setVisibility(8);
        this.f1835KQgRr5e_0.setVisibility(8);
        viewGroup.setVisibility(8);
    }

    public final void PGPF6hQ_2(ViewGroup viewGroup) {
        View view = this.f1832KQgRr5e_0;
        if (view == null) {
            view = this.QxJ9d_1 != 0 ? LayoutInflater.from(this.f1827KQgRr5e_0).inflate(this.QxJ9d_1, viewGroup, false) : null;
        }
        boolean z = view != null;
        if (!z || !KQgRr5e_0(view)) {
            this.f1833KQgRr5e_0.setFlags(131072, 131072);
        }
        if (z) {
            FrameLayout frameLayout = (FrameLayout) this.f1833KQgRr5e_0.findViewById(X6FRs_4.KQgRr5e_0.IFxWkV_5.custom);
            frameLayout.addView(view, new ViewGroup.LayoutParams(-1, -1));
            if (this.f1841KQgRr5e_0) {
                frameLayout.setPadding(this.PGPF6hQ_2, this.f3428Mqv2r_3, this.f3430X6FRs_4, this.f3425IFxWkV_5);
            }
            if (this.f1837KQgRr5e_0 != null) {
                ((LinearLayoutCompat.LayoutParams) viewGroup.getLayoutParams()).KQgRr5e_0 = 0.0f;
                return;
            }
            return;
        }
        viewGroup.setVisibility(8);
    }

    public void QxJ9d_1(CharSequence charSequence) {
        this.f1840KQgRr5e_0 = charSequence;
        TextView textView = this.f1838KQgRr5e_0;
        if (textView != null) {
            textView.setText(charSequence);
        }
    }

    public static boolean KQgRr5e_0(View view) {
        if (view.onCheckIsTextEditor()) {
            return true;
        }
        if (view instanceof ViewGroup) {
            ViewGroup viewGroup = (ViewGroup) view;
            int childCount = viewGroup.getChildCount();
            while (childCount > 0) {
                childCount--;
                if (KQgRr5e_0(viewGroup.getChildAt(childCount))) {
                    return true;
                }
            }
            return false;
        }
        return false;
    }

    public void QxJ9d_1(int i) {
        this.f1832KQgRr5e_0 = null;
        this.QxJ9d_1 = i;
        this.f1841KQgRr5e_0 = false;
    }

    public void QxJ9d_1(View view) {
        this.f1832KQgRr5e_0 = view;
        this.QxJ9d_1 = 0;
        this.f1841KQgRr5e_0 = false;
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public void m825KQgRr5e_0() {
        this.f1826KQgRr5e_0.setContentView(KQgRr5e_0());
        QxJ9d_1();
    }

    public boolean QxJ9d_1(int i, KeyEvent keyEvent) {
        NestedScrollView nestedScrollView = this.f1839KQgRr5e_0;
        return nestedScrollView != null && nestedScrollView.KQgRr5e_0(keyEvent);
    }

    /* JADX WARN: Multi-variable type inference failed */
    public final void QxJ9d_1() {
        View findViewById;
        ListAdapter listAdapter;
        View findViewById2;
        View findViewById3 = this.f1833KQgRr5e_0.findViewById(X6FRs_4.KQgRr5e_0.IFxWkV_5.parentPanel);
        View findViewById4 = findViewById3.findViewById(X6FRs_4.KQgRr5e_0.IFxWkV_5.topPanel);
        View findViewById5 = findViewById3.findViewById(X6FRs_4.KQgRr5e_0.IFxWkV_5.contentPanel);
        View findViewById6 = findViewById3.findViewById(X6FRs_4.KQgRr5e_0.IFxWkV_5.buttonPanel);
        ViewGroup viewGroup = (ViewGroup) findViewById3.findViewById(X6FRs_4.KQgRr5e_0.IFxWkV_5.customPanel);
        PGPF6hQ_2(viewGroup);
        View findViewById7 = viewGroup.findViewById(X6FRs_4.KQgRr5e_0.IFxWkV_5.topPanel);
        View findViewById8 = viewGroup.findViewById(X6FRs_4.KQgRr5e_0.IFxWkV_5.contentPanel);
        View findViewById9 = viewGroup.findViewById(X6FRs_4.KQgRr5e_0.IFxWkV_5.buttonPanel);
        ViewGroup KQgRr5e_02 = KQgRr5e_0(findViewById7, findViewById4);
        ViewGroup KQgRr5e_03 = KQgRr5e_0(findViewById8, findViewById5);
        ViewGroup KQgRr5e_04 = KQgRr5e_0(findViewById9, findViewById6);
        QxJ9d_1(KQgRr5e_03);
        KQgRr5e_0(KQgRr5e_04);
        Mqv2r_3(KQgRr5e_02);
        boolean z = (viewGroup == null || viewGroup.getVisibility() == 8) ? false : true;
        boolean z2 = (KQgRr5e_02 == null || KQgRr5e_02.getVisibility() == 8) ? 0 : 1;
        boolean z3 = (KQgRr5e_04 == null || KQgRr5e_04.getVisibility() == 8) ? false : true;
        if (!z3 && KQgRr5e_03 != null && (findViewById2 = KQgRr5e_03.findViewById(X6FRs_4.KQgRr5e_0.IFxWkV_5.textSpacerNoButtons)) != null) {
            findViewById2.setVisibility(0);
        }
        if (z2) {
            NestedScrollView nestedScrollView = this.f1839KQgRr5e_0;
            if (nestedScrollView != null) {
                nestedScrollView.setClipToPadding(true);
            }
            View view = null;
            if (this.f1853QxJ9d_1 != null || this.f1837KQgRr5e_0 != null) {
                view = KQgRr5e_02.findViewById(X6FRs_4.KQgRr5e_0.IFxWkV_5.titleDividerNoCustom);
            }
            if (view != null) {
                view.setVisibility(0);
            }
        } else if (KQgRr5e_03 != null && (findViewById = KQgRr5e_03.findViewById(X6FRs_4.KQgRr5e_0.IFxWkV_5.textSpacerNoTitle)) != null) {
            findViewById.setVisibility(0);
        }
        ListView listView = this.f1837KQgRr5e_0;
        if (listView instanceof RecycleListView) {
            ((RecycleListView) listView).KQgRr5e_0(z2, z3);
        }
        if (!z) {
            View view2 = this.f1837KQgRr5e_0;
            if (view2 == null) {
                view2 = this.f1839KQgRr5e_0;
            }
            if (view2 != null) {
                KQgRr5e_0(KQgRr5e_03, view2, z2 | (z3 ? 2 : 0), 3);
            }
        }
        ListView listView2 = this.f1837KQgRr5e_0;
        if (listView2 == null || (listAdapter = this.f1836KQgRr5e_0) == null) {
            return;
        }
        listView2.setAdapter(listAdapter);
        int i = this.f3424FSaI4_7;
        if (i > -1) {
            listView2.setItemChecked(i, true);
            listView2.setSelection(i);
        }
    }

    public final int KQgRr5e_0() {
        int i = this.f3432XnFJ5_9;
        if (i == 0) {
            return this.f3431Xgtqvk_8;
        }
        return this.YghfZG_14 == 1 ? i : this.f3431Xgtqvk_8;
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public void m827KQgRr5e_0(View view) {
        this.f1850QxJ9d_1 = view;
    }

    public void KQgRr5e_0(CharSequence charSequence) {
        this.f1853QxJ9d_1 = charSequence;
        TextView textView = this.f1852QxJ9d_1;
        if (textView != null) {
            textView.setText(charSequence);
        }
    }

    public void KQgRr5e_0(View view, int i, int i2, int i3, int i4) {
        this.f1832KQgRr5e_0 = view;
        this.QxJ9d_1 = 0;
        this.f1841KQgRr5e_0 = true;
        this.PGPF6hQ_2 = i;
        this.f3428Mqv2r_3 = i2;
        this.f3430X6FRs_4 = i3;
        this.f3425IFxWkV_5 = i4;
    }

    public void KQgRr5e_0(int i, CharSequence charSequence, DialogInterface.OnClickListener onClickListener, Message message, Drawable drawable) {
        if (message == null && onClickListener != null) {
            message = this.f1829KQgRr5e_0.obtainMessage(i, onClickListener);
        }
        if (i == -3) {
            this.f1855X6FRs_4 = charSequence;
            this.f1845PGPF6hQ_2 = message;
            this.f1844PGPF6hQ_2 = drawable;
        } else if (i == -2) {
            this.f1843Mqv2r_3 = charSequence;
            this.f1849QxJ9d_1 = message;
            this.f1848QxJ9d_1 = drawable;
        } else if (i == -1) {
            this.f1847PGPF6hQ_2 = charSequence;
            this.f1830KQgRr5e_0 = message;
            this.f1828KQgRr5e_0 = drawable;
        } else {
            throw new IllegalArgumentException("Button does not exist");
        }
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public void m826KQgRr5e_0(int i) {
        this.f1842Mqv2r_3 = null;
        this.f3426IMuAHx_6 = i;
        ImageView imageView = this.f1835KQgRr5e_0;
        if (imageView != null) {
            if (i != 0) {
                imageView.setVisibility(0);
                this.f1835KQgRr5e_0.setImageResource(this.f3426IMuAHx_6);
                return;
            }
            imageView.setVisibility(8);
        }
    }

    public void KQgRr5e_0(Drawable drawable) {
        this.f1842Mqv2r_3 = drawable;
        this.f3426IMuAHx_6 = 0;
        ImageView imageView = this.f1835KQgRr5e_0;
        if (imageView != null) {
            if (drawable != null) {
                imageView.setVisibility(0);
                this.f1835KQgRr5e_0.setImageDrawable(drawable);
                return;
            }
            imageView.setVisibility(8);
        }
    }

    public final void QxJ9d_1(ViewGroup viewGroup) {
        NestedScrollView nestedScrollView = (NestedScrollView) this.f1833KQgRr5e_0.findViewById(X6FRs_4.KQgRr5e_0.IFxWkV_5.scrollView);
        this.f1839KQgRr5e_0 = nestedScrollView;
        nestedScrollView.setFocusable(false);
        this.f1839KQgRr5e_0.setNestedScrollingEnabled(false);
        TextView textView = (TextView) viewGroup.findViewById(16908299);
        this.f1852QxJ9d_1 = textView;
        if (textView == null) {
            return;
        }
        CharSequence charSequence = this.f1853QxJ9d_1;
        if (charSequence != null) {
            textView.setText(charSequence);
            return;
        }
        textView.setVisibility(8);
        this.f1839KQgRr5e_0.removeView(this.f1852QxJ9d_1);
        if (this.f1837KQgRr5e_0 != null) {
            ViewGroup viewGroup2 = (ViewGroup) this.f1839KQgRr5e_0.getParent();
            int indexOfChild = viewGroup2.indexOfChild(this.f1839KQgRr5e_0);
            viewGroup2.removeViewAt(indexOfChild);
            viewGroup2.addView(this.f1837KQgRr5e_0, indexOfChild, new ViewGroup.LayoutParams(-1, -1));
            return;
        }
        viewGroup.setVisibility(8);
    }

    public int KQgRr5e_0(int i) {
        TypedValue typedValue = new TypedValue();
        this.f1827KQgRr5e_0.getTheme().resolveAttribute(i, typedValue, true);
        return typedValue.resourceId;
    }

    public boolean KQgRr5e_0(int i, KeyEvent keyEvent) {
        NestedScrollView nestedScrollView = this.f1839KQgRr5e_0;
        return nestedScrollView != null && nestedScrollView.KQgRr5e_0(keyEvent);
    }

    public final ViewGroup KQgRr5e_0(View view, View view2) {
        if (view == null) {
            if (view2 instanceof ViewStub) {
                view2 = ((ViewStub) view2).inflate();
            }
            return (ViewGroup) view2;
        }
        if (view2 != null) {
            ViewParent parent = view2.getParent();
            if (parent instanceof ViewGroup) {
                ((ViewGroup) parent).removeView(view2);
            }
        }
        if (view instanceof ViewStub) {
            view = ((ViewStub) view).inflate();
        }
        return (ViewGroup) view;
    }

    public final void KQgRr5e_0(ViewGroup viewGroup, View view, int i, int i2) {
        View findViewById = this.f1833KQgRr5e_0.findViewById(X6FRs_4.KQgRr5e_0.IFxWkV_5.scrollIndicatorUp);
        View findViewById2 = this.f1833KQgRr5e_0.findViewById(X6FRs_4.KQgRr5e_0.IFxWkV_5.scrollIndicatorDown);
        if (Build.VERSION.SDK_INT >= 23) {
            ZzDuCHW_20.KQgRr5e_0(view, i, i2);
            if (findViewById != null) {
                viewGroup.removeView(findViewById);
            }
            if (findViewById2 != null) {
                viewGroup.removeView(findViewById2);
                return;
            }
            return;
        }
        if (findViewById != null && (i & 1) == 0) {
            viewGroup.removeView(findViewById);
            findViewById = null;
        }
        if (findViewById2 != null && (i & 2) == 0) {
            viewGroup.removeView(findViewById2);
            findViewById2 = null;
        }
        if (findViewById == null && findViewById2 == null) {
            return;
        }
        if (this.f1853QxJ9d_1 != null) {
            this.f1839KQgRr5e_0.setOnScrollChangeListener(new QxJ9d_1(this, findViewById, findViewById2));
            this.f1839KQgRr5e_0.post(new PGPF6hQ_2(findViewById, findViewById2));
            return;
        }
        ListView listView = this.f1837KQgRr5e_0;
        if (listView != null) {
            listView.setOnScrollListener(new Mqv2r_3(this, findViewById, findViewById2));
            this.f1837KQgRr5e_0.post(new X6FRs_4(findViewById, findViewById2));
            return;
        }
        if (findViewById != null) {
            viewGroup.removeView(findViewById);
        }
        if (findViewById2 != null) {
            viewGroup.removeView(findViewById2);
        }
    }

    public static void KQgRr5e_0(View view, View view2, View view3) {
        if (view2 != null) {
            view2.setVisibility(view.canScrollVertically(-1) ? 0 : 4);
        }
        if (view3 != null) {
            view3.setVisibility(view.canScrollVertically(1) ? 0 : 4);
        }
    }

    public final void KQgRr5e_0(ViewGroup viewGroup) {
        boolean z;
        Button button = (Button) viewGroup.findViewById(16908313);
        this.f1834KQgRr5e_0 = button;
        button.setOnClickListener(this.f1831KQgRr5e_0);
        if (TextUtils.isEmpty(this.f1847PGPF6hQ_2) && this.f1828KQgRr5e_0 == null) {
            this.f1834KQgRr5e_0.setVisibility(8);
            z = false;
        } else {
            this.f1834KQgRr5e_0.setText(this.f1847PGPF6hQ_2);
            Drawable drawable = this.f1828KQgRr5e_0;
            if (drawable != null) {
                int i = this.KQgRr5e_0;
                drawable.setBounds(0, 0, i, i);
                this.f1834KQgRr5e_0.setCompoundDrawables(this.f1828KQgRr5e_0, null, null, null);
            }
            this.f1834KQgRr5e_0.setVisibility(0);
            z = true;
        }
        Button button2 = (Button) viewGroup.findViewById(16908314);
        this.f1851QxJ9d_1 = button2;
        button2.setOnClickListener(this.f1831KQgRr5e_0);
        if (TextUtils.isEmpty(this.f1843Mqv2r_3) && this.f1848QxJ9d_1 == null) {
            this.f1851QxJ9d_1.setVisibility(8);
        } else {
            this.f1851QxJ9d_1.setText(this.f1843Mqv2r_3);
            Drawable drawable2 = this.f1848QxJ9d_1;
            if (drawable2 != null) {
                int i2 = this.KQgRr5e_0;
                drawable2.setBounds(0, 0, i2, i2);
                this.f1851QxJ9d_1.setCompoundDrawables(this.f1848QxJ9d_1, null, null, null);
            }
            this.f1851QxJ9d_1.setVisibility(0);
            z |= true;
        }
        Button button3 = (Button) viewGroup.findViewById(16908315);
        this.f1846PGPF6hQ_2 = button3;
        button3.setOnClickListener(this.f1831KQgRr5e_0);
        if (TextUtils.isEmpty(this.f1855X6FRs_4) && this.f1844PGPF6hQ_2 == null) {
            this.f1846PGPF6hQ_2.setVisibility(8);
        } else {
            this.f1846PGPF6hQ_2.setText(this.f1855X6FRs_4);
            Drawable drawable3 = this.f1828KQgRr5e_0;
            if (drawable3 != null) {
                int i3 = this.KQgRr5e_0;
                drawable3.setBounds(0, 0, i3, i3);
                this.f1834KQgRr5e_0.setCompoundDrawables(this.f1828KQgRr5e_0, null, null, null);
            }
            this.f1846PGPF6hQ_2.setVisibility(0);
            z |= true;
        }
        if (KQgRr5e_0(this.f1827KQgRr5e_0)) {
            if (z) {
                KQgRr5e_0(this.f1834KQgRr5e_0);
            } else if (z) {
                KQgRr5e_0(this.f1851QxJ9d_1);
            } else if (z) {
                KQgRr5e_0(this.f1846PGPF6hQ_2);
            }
        }
        if (z) {
            return;
        }
        viewGroup.setVisibility(8);
    }

    public final void KQgRr5e_0(Button button) {
        LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) button.getLayoutParams();
        layoutParams.gravity = 1;
        layoutParams.weight = 0.5f;
        button.setLayoutParams(layoutParams);
    }
}
