package androidx.appcompat.app;

import android.R;
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.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.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.view.s0;
import androidx.core.widget.NestedScrollView;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import h.f;
import h.j;
import i.g;
import java.lang.ref.WeakReference;

/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public class AlertController {
    NestedScrollView A;
    private Drawable C;
    private ImageView D;
    private TextView E;
    private TextView F;
    private View G;
    ListAdapter H;
    private int J;
    private int K;
    int L;
    int M;
    int N;
    int O;
    private boolean P;
    Handler R;

    /* renamed from: a, reason: collision with root package name */
    private final Context f569a;

    /* renamed from: b, reason: collision with root package name */
    final g f570b;

    /* renamed from: c, reason: collision with root package name */
    private final Window f571c;

    /* renamed from: d, reason: collision with root package name */
    private final int f572d;

    /* renamed from: e, reason: collision with root package name */
    private CharSequence f573e;

    /* renamed from: f, reason: collision with root package name */
    private CharSequence f574f;

    /* renamed from: g, reason: collision with root package name */
    ListView f575g;

    /* renamed from: h, reason: collision with root package name */
    private View f576h;

    /* renamed from: i, reason: collision with root package name */
    private int f577i;

    /* renamed from: j, reason: collision with root package name */
    private int f578j;

    /* renamed from: k, reason: collision with root package name */
    private int f579k;

    /* renamed from: l, reason: collision with root package name */
    private int f580l;

    /* renamed from: m, reason: collision with root package name */
    private int f581m;

    /* renamed from: o, reason: collision with root package name */
    Button f583o;

    /* renamed from: p, reason: collision with root package name */
    private CharSequence f584p;

    /* renamed from: q, reason: collision with root package name */
    Message f585q;

    /* renamed from: r, reason: collision with root package name */
    private Drawable f586r;

    /* renamed from: s, reason: collision with root package name */
    Button f587s;

    /* renamed from: t, reason: collision with root package name */
    private CharSequence f588t;

    /* renamed from: u, reason: collision with root package name */
    Message f589u;

    /* renamed from: v, reason: collision with root package name */
    private Drawable f590v;

    /* renamed from: w, reason: collision with root package name */
    Button f591w;

    /* renamed from: x, reason: collision with root package name */
    private CharSequence f592x;

    /* renamed from: y, reason: collision with root package name */
    Message f593y;

    /* renamed from: z, reason: collision with root package name */
    private Drawable f594z;

    /* renamed from: n, reason: collision with root package name */
    private boolean f582n = false;
    private int B = 0;
    int I = -1;
    private int Q = 0;
    private final View.OnClickListener S = new a();

    /* loaded from: classes.dex */
    public static class RecycleListView extends ListView {

        /* renamed from: p, reason: collision with root package name */
        private final int f595p;

        /* renamed from: q, reason: collision with root package name */
        private final int f596q;

        public RecycleListView(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
            TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, j.f20334k2);
            this.f596q = obtainStyledAttributes.getDimensionPixelOffset(j.f20339l2, -1);
            this.f595p = obtainStyledAttributes.getDimensionPixelOffset(j.f20344m2, -1);
        }

        public void a(boolean z10, boolean z11) {
            if (z11 && z10) {
                return;
            }
            setPadding(getPaddingLeft(), z10 ? getPaddingTop() : this.f595p, getPaddingRight(), z11 ? getPaddingBottom() : this.f596q);
        }
    }

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

        @Override // android.view.View.OnClickListener
        public void onClick(View view) {
            Message message;
            Message message2;
            Message message3;
            AlertController alertController = AlertController.this;
            Message obtain = (view != alertController.f583o || (message3 = alertController.f585q) == null) ? (view != alertController.f587s || (message2 = alertController.f589u) == null) ? (view != alertController.f591w || (message = alertController.f593y) == null) ? null : Message.obtain(message) : Message.obtain(message2) : Message.obtain(message3);
            if (obtain != null) {
                obtain.sendToTarget();
            }
            AlertController alertController2 = AlertController.this;
            alertController2.R.obtainMessage(1, alertController2.f570b).sendToTarget();
        }
    }

    /* loaded from: classes.dex */
    public static class b {
        public int A;
        public int B;
        public int C;
        public int D;
        public boolean[] F;
        public boolean G;
        public boolean H;
        public DialogInterface.OnMultiChoiceClickListener J;
        public Cursor K;
        public String L;
        public String M;
        public AdapterView.OnItemSelectedListener N;

        /* renamed from: a, reason: collision with root package name */
        public final Context f598a;

        /* renamed from: b, reason: collision with root package name */
        public final LayoutInflater f599b;

        /* renamed from: d, reason: collision with root package name */
        public Drawable f601d;

        /* renamed from: f, reason: collision with root package name */
        public CharSequence f603f;

        /* renamed from: g, reason: collision with root package name */
        public View f604g;

        /* renamed from: h, reason: collision with root package name */
        public CharSequence f605h;

        /* renamed from: i, reason: collision with root package name */
        public CharSequence f606i;

        /* renamed from: j, reason: collision with root package name */
        public Drawable f607j;

        /* renamed from: k, reason: collision with root package name */
        public DialogInterface.OnClickListener f608k;

        /* renamed from: l, reason: collision with root package name */
        public CharSequence f609l;

        /* renamed from: m, reason: collision with root package name */
        public Drawable f610m;

        /* renamed from: n, reason: collision with root package name */
        public DialogInterface.OnClickListener f611n;

        /* renamed from: o, reason: collision with root package name */
        public CharSequence f612o;

        /* renamed from: p, reason: collision with root package name */
        public Drawable f613p;

        /* renamed from: q, reason: collision with root package name */
        public DialogInterface.OnClickListener f614q;

        /* renamed from: s, reason: collision with root package name */
        public DialogInterface.OnCancelListener f616s;

        /* renamed from: t, reason: collision with root package name */
        public DialogInterface.OnDismissListener f617t;

        /* renamed from: u, reason: collision with root package name */
        public DialogInterface.OnKeyListener f618u;

        /* renamed from: v, reason: collision with root package name */
        public CharSequence[] f619v;

        /* renamed from: w, reason: collision with root package name */
        public ListAdapter f620w;

        /* renamed from: x, reason: collision with root package name */
        public DialogInterface.OnClickListener f621x;

        /* renamed from: y, reason: collision with root package name */
        public int f622y;

        /* renamed from: z, reason: collision with root package name */
        public View f623z;

        /* renamed from: c, reason: collision with root package name */
        public int f600c = 0;

        /* renamed from: e, reason: collision with root package name */
        public int f602e = 0;
        public boolean E = false;
        public int I = -1;
        public boolean O = true;

        /* renamed from: r, reason: collision with root package name */
        public boolean f615r = true;

        /* JADX INFO: Access modifiers changed from: package-private */
        /* loaded from: classes.dex */
        public class a extends ArrayAdapter {

            /* renamed from: p, reason: collision with root package name */
            final /* synthetic */ RecycleListView f624p;

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

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

        /* JADX INFO: Access modifiers changed from: package-private */
        /* renamed from: androidx.appcompat.app.AlertController$b$b, reason: collision with other inner class name */
        /* loaded from: classes.dex */
        public class C0022b extends CursorAdapter {

            /* renamed from: p, reason: collision with root package name */
            private final int f626p;

            /* renamed from: q, reason: collision with root package name */
            private final int f627q;

            /* renamed from: r, reason: collision with root package name */
            final /* synthetic */ RecycleListView f628r;

            /* renamed from: s, reason: collision with root package name */
            final /* synthetic */ AlertController f629s;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            C0022b(Context context, Cursor cursor, boolean z10, RecycleListView recycleListView, AlertController alertController) {
                super(context, cursor, z10);
                this.f628r = recycleListView;
                this.f629s = alertController;
                Cursor cursor2 = getCursor();
                this.f626p = cursor2.getColumnIndexOrThrow(b.this.L);
                this.f627q = cursor2.getColumnIndexOrThrow(b.this.M);
            }

            @Override // android.widget.CursorAdapter
            public void bindView(View view, Context context, Cursor cursor) {
                ((CheckedTextView) view.findViewById(R.id.text1)).setText(cursor.getString(this.f626p));
                this.f628r.setItemChecked(cursor.getPosition(), cursor.getInt(this.f627q) == 1);
            }

            @Override // android.widget.CursorAdapter
            public View newView(Context context, Cursor cursor, ViewGroup viewGroup) {
                return b.this.f599b.inflate(this.f629s.M, viewGroup, false);
            }
        }

        /* JADX INFO: Access modifiers changed from: package-private */
        /* loaded from: classes.dex */
        public class c implements AdapterView.OnItemClickListener {

            /* renamed from: p, reason: collision with root package name */
            final /* synthetic */ AlertController f631p;

            c(AlertController alertController) {
                this.f631p = alertController;
            }

            @Override // android.widget.AdapterView.OnItemClickListener
            public void onItemClick(AdapterView adapterView, View view, int i10, long j10) {
                b.this.f621x.onClick(this.f631p.f570b, i10);
                if (b.this.H) {
                    return;
                }
                this.f631p.f570b.dismiss();
            }
        }

        /* JADX INFO: Access modifiers changed from: package-private */
        /* loaded from: classes.dex */
        public class d implements AdapterView.OnItemClickListener {

            /* renamed from: p, reason: collision with root package name */
            final /* synthetic */ RecycleListView f633p;

            /* renamed from: q, reason: collision with root package name */
            final /* synthetic */ AlertController f634q;

            d(RecycleListView recycleListView, AlertController alertController) {
                this.f633p = recycleListView;
                this.f634q = alertController;
            }

            @Override // android.widget.AdapterView.OnItemClickListener
            public void onItemClick(AdapterView adapterView, View view, int i10, long j10) {
                boolean[] zArr = b.this.F;
                if (zArr != null) {
                    zArr[i10] = this.f633p.isItemChecked(i10);
                }
                b.this.J.onClick(this.f634q.f570b, i10, this.f633p.isItemChecked(i10));
            }
        }

        public b(Context context) {
            this.f598a = context;
            this.f599b = (LayoutInflater) context.getSystemService("layout_inflater");
        }

        private void b(AlertController alertController) {
            ListAdapter listAdapter;
            RecycleListView recycleListView = (RecycleListView) this.f599b.inflate(alertController.L, (ViewGroup) null);
            if (this.G) {
                listAdapter = this.K == null ? new a(this.f598a, alertController.M, R.id.text1, this.f619v, recycleListView) : new C0022b(this.f598a, this.K, false, recycleListView, alertController);
            } else {
                int i10 = this.H ? alertController.N : alertController.O;
                if (this.K != null) {
                    listAdapter = new SimpleCursorAdapter(this.f598a, i10, this.K, new String[]{this.L}, new int[]{R.id.text1});
                } else {
                    listAdapter = this.f620w;
                    if (listAdapter == null) {
                        listAdapter = new d(this.f598a, i10, R.id.text1, this.f619v);
                    }
                }
            }
            alertController.H = listAdapter;
            alertController.I = this.I;
            if (this.f621x != null) {
                recycleListView.setOnItemClickListener(new c(alertController));
            } else if (this.J != null) {
                recycleListView.setOnItemClickListener(new d(recycleListView, alertController));
            }
            AdapterView.OnItemSelectedListener onItemSelectedListener = this.N;
            if (onItemSelectedListener != null) {
                recycleListView.setOnItemSelectedListener(onItemSelectedListener);
            }
            if (this.H) {
                recycleListView.setChoiceMode(1);
            } else if (this.G) {
                recycleListView.setChoiceMode(2);
            }
            alertController.f575g = recycleListView;
        }

        public void a(AlertController alertController) {
            View view = this.f604g;
            if (view != null) {
                alertController.k(view);
            } else {
                CharSequence charSequence = this.f603f;
                if (charSequence != null) {
                    alertController.p(charSequence);
                }
                Drawable drawable = this.f601d;
                if (drawable != null) {
                    alertController.m(drawable);
                }
                int i10 = this.f600c;
                if (i10 != 0) {
                    alertController.l(i10);
                }
                int i11 = this.f602e;
                if (i11 != 0) {
                    alertController.l(alertController.c(i11));
                }
            }
            CharSequence charSequence2 = this.f605h;
            if (charSequence2 != null) {
                alertController.n(charSequence2);
            }
            CharSequence charSequence3 = this.f606i;
            if (charSequence3 != null || this.f607j != null) {
                alertController.j(-1, charSequence3, this.f608k, null, this.f607j);
            }
            CharSequence charSequence4 = this.f609l;
            if (charSequence4 != null || this.f610m != null) {
                alertController.j(-2, charSequence4, this.f611n, null, this.f610m);
            }
            CharSequence charSequence5 = this.f612o;
            if (charSequence5 != null || this.f613p != null) {
                alertController.j(-3, charSequence5, this.f614q, null, this.f613p);
            }
            if (this.f619v != null || this.K != null || this.f620w != null) {
                b(alertController);
            }
            View view2 = this.f623z;
            if (view2 != null) {
                if (this.E) {
                    alertController.s(view2, this.A, this.B, this.C, this.D);
                    return;
                } else {
                    alertController.r(view2);
                    return;
                }
            }
            int i12 = this.f622y;
            if (i12 != 0) {
                alertController.q(i12);
            }
        }
    }

    /* loaded from: classes.dex */
    private static final class c extends Handler {

        /* renamed from: a, reason: collision with root package name */
        private WeakReference f636a;

        public c(DialogInterface dialogInterface) {
            this.f636a = new WeakReference(dialogInterface);
        }

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

    /* JADX INFO: Access modifiers changed from: private */
    /* loaded from: classes.dex */
    public static class d extends ArrayAdapter {
        public d(Context context, int i10, int i11, CharSequence[] charSequenceArr) {
            super(context, i10, i11, charSequenceArr);
        }

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

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

    public AlertController(Context context, g gVar, Window window) {
        this.f569a = context;
        this.f570b = gVar;
        this.f571c = window;
        this.R = new c(gVar);
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(null, j.F, h.a.f20157k, 0);
        this.J = obtainStyledAttributes.getResourceId(j.G, 0);
        this.K = obtainStyledAttributes.getResourceId(j.I, 0);
        this.L = obtainStyledAttributes.getResourceId(j.K, 0);
        this.M = obtainStyledAttributes.getResourceId(j.L, 0);
        this.N = obtainStyledAttributes.getResourceId(j.N, 0);
        this.O = obtainStyledAttributes.getResourceId(j.J, 0);
        this.P = obtainStyledAttributes.getBoolean(j.M, true);
        this.f572d = obtainStyledAttributes.getDimensionPixelSize(j.H, 0);
        obtainStyledAttributes.recycle();
        gVar.d(1);
    }

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

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

    private ViewGroup h(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;
    }

    private int i() {
        int i10 = this.K;
        return (i10 != 0 && this.Q == 1) ? i10 : this.J;
    }

    private void o(ViewGroup viewGroup, View view, int i10, int i11) {
        View findViewById = this.f571c.findViewById(f.f20237u);
        View findViewById2 = this.f571c.findViewById(f.f20236t);
        s0.D0(view, i10, i11);
        if (findViewById != null) {
            viewGroup.removeView(findViewById);
        }
        if (findViewById2 != null) {
            viewGroup.removeView(findViewById2);
        }
    }

    private void t(ViewGroup viewGroup) {
        int i10;
        Button button = (Button) viewGroup.findViewById(R.id.button1);
        this.f583o = button;
        button.setOnClickListener(this.S);
        if (TextUtils.isEmpty(this.f584p) && this.f586r == null) {
            this.f583o.setVisibility(8);
            i10 = 0;
        } else {
            this.f583o.setText(this.f584p);
            Drawable drawable = this.f586r;
            if (drawable != null) {
                int i11 = this.f572d;
                drawable.setBounds(0, 0, i11, i11);
                this.f583o.setCompoundDrawables(this.f586r, null, null, null);
            }
            this.f583o.setVisibility(0);
            i10 = 1;
        }
        Button button2 = (Button) viewGroup.findViewById(R.id.button2);
        this.f587s = button2;
        button2.setOnClickListener(this.S);
        if (TextUtils.isEmpty(this.f588t) && this.f590v == null) {
            this.f587s.setVisibility(8);
        } else {
            this.f587s.setText(this.f588t);
            Drawable drawable2 = this.f590v;
            if (drawable2 != null) {
                int i12 = this.f572d;
                drawable2.setBounds(0, 0, i12, i12);
                this.f587s.setCompoundDrawables(this.f590v, null, null, null);
            }
            this.f587s.setVisibility(0);
            i10 |= 2;
        }
        Button button3 = (Button) viewGroup.findViewById(R.id.button3);
        this.f591w = button3;
        button3.setOnClickListener(this.S);
        if (TextUtils.isEmpty(this.f592x) && this.f594z == null) {
            this.f591w.setVisibility(8);
        } else {
            this.f591w.setText(this.f592x);
            Drawable drawable3 = this.f594z;
            if (drawable3 != null) {
                int i13 = this.f572d;
                drawable3.setBounds(0, 0, i13, i13);
                this.f591w.setCompoundDrawables(this.f594z, null, null, null);
            }
            this.f591w.setVisibility(0);
            i10 |= 4;
        }
        if (y(this.f569a)) {
            if (i10 == 1) {
                b(this.f583o);
            } else if (i10 == 2) {
                b(this.f587s);
            } else if (i10 == 4) {
                b(this.f591w);
            }
        }
        if (i10 != 0) {
            return;
        }
        viewGroup.setVisibility(8);
    }

    private void u(ViewGroup viewGroup) {
        NestedScrollView nestedScrollView = (NestedScrollView) this.f571c.findViewById(f.f20238v);
        this.A = nestedScrollView;
        nestedScrollView.setFocusable(false);
        this.A.setNestedScrollingEnabled(false);
        TextView textView = (TextView) viewGroup.findViewById(R.id.message);
        this.F = textView;
        if (textView == null) {
            return;
        }
        CharSequence charSequence = this.f574f;
        if (charSequence != null) {
            textView.setText(charSequence);
            return;
        }
        textView.setVisibility(8);
        this.A.removeView(this.F);
        if (this.f575g == null) {
            viewGroup.setVisibility(8);
            return;
        }
        ViewGroup viewGroup2 = (ViewGroup) this.A.getParent();
        int indexOfChild = viewGroup2.indexOfChild(this.A);
        viewGroup2.removeViewAt(indexOfChild);
        viewGroup2.addView(this.f575g, indexOfChild, new ViewGroup.LayoutParams(-1, -1));
    }

    private void v(ViewGroup viewGroup) {
        View view = this.f576h;
        if (view == null) {
            view = this.f577i != 0 ? LayoutInflater.from(this.f569a).inflate(this.f577i, viewGroup, false) : null;
        }
        boolean z10 = view != null;
        if (!z10 || !a(view)) {
            this.f571c.setFlags(131072, 131072);
        }
        if (!z10) {
            viewGroup.setVisibility(8);
            return;
        }
        FrameLayout frameLayout = (FrameLayout) this.f571c.findViewById(f.f20230n);
        frameLayout.addView(view, new ViewGroup.LayoutParams(-1, -1));
        if (this.f582n) {
            frameLayout.setPadding(this.f578j, this.f579k, this.f580l, this.f581m);
        }
        if (this.f575g != null) {
            ((LinearLayout.LayoutParams) ((LinearLayoutCompat.a) viewGroup.getLayoutParams())).weight = BitmapDescriptorFactory.HUE_RED;
        }
    }

    private void w(ViewGroup viewGroup) {
        if (this.G != null) {
            viewGroup.addView(this.G, 0, new ViewGroup.LayoutParams(-1, -2));
            this.f571c.findViewById(f.N).setVisibility(8);
            return;
        }
        this.D = (ImageView) this.f571c.findViewById(R.id.icon);
        if (!(!TextUtils.isEmpty(this.f573e)) || !this.P) {
            this.f571c.findViewById(f.N).setVisibility(8);
            this.D.setVisibility(8);
            viewGroup.setVisibility(8);
            return;
        }
        TextView textView = (TextView) this.f571c.findViewById(f.f20226j);
        this.E = textView;
        textView.setText(this.f573e);
        int i10 = this.B;
        if (i10 != 0) {
            this.D.setImageResource(i10);
            return;
        }
        Drawable drawable = this.C;
        if (drawable != null) {
            this.D.setImageDrawable(drawable);
        } else {
            this.E.setPadding(this.D.getPaddingLeft(), this.D.getPaddingTop(), this.D.getPaddingRight(), this.D.getPaddingBottom());
            this.D.setVisibility(8);
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    private void x() {
        View findViewById;
        ListAdapter listAdapter;
        View findViewById2;
        View findViewById3 = this.f571c.findViewById(f.f20235s);
        int i10 = f.O;
        View findViewById4 = findViewById3.findViewById(i10);
        int i11 = f.f20229m;
        View findViewById5 = findViewById3.findViewById(i11);
        int i12 = f.f20227k;
        View findViewById6 = findViewById3.findViewById(i12);
        ViewGroup viewGroup = (ViewGroup) findViewById3.findViewById(f.f20231o);
        v(viewGroup);
        View findViewById7 = viewGroup.findViewById(i10);
        View findViewById8 = viewGroup.findViewById(i11);
        View findViewById9 = viewGroup.findViewById(i12);
        ViewGroup h10 = h(findViewById7, findViewById4);
        ViewGroup h11 = h(findViewById8, findViewById5);
        ViewGroup h12 = h(findViewById9, findViewById6);
        u(h11);
        t(h12);
        w(h10);
        boolean z10 = viewGroup.getVisibility() != 8;
        boolean z11 = (h10 == null || h10.getVisibility() == 8) ? 0 : 1;
        boolean z12 = (h12 == null || h12.getVisibility() == 8) ? false : true;
        if (!z12 && h11 != null && (findViewById2 = h11.findViewById(f.J)) != null) {
            findViewById2.setVisibility(0);
        }
        if (z11 != 0) {
            NestedScrollView nestedScrollView = this.A;
            if (nestedScrollView != null) {
                nestedScrollView.setClipToPadding(true);
            }
            View findViewById10 = (this.f574f == null && this.f575g == null) ? null : h10.findViewById(f.M);
            if (findViewById10 != null) {
                findViewById10.setVisibility(0);
            }
        } else if (h11 != null && (findViewById = h11.findViewById(f.K)) != null) {
            findViewById.setVisibility(0);
        }
        ListView listView = this.f575g;
        if (listView instanceof RecycleListView) {
            ((RecycleListView) listView).a(z11, z12);
        }
        if (!z10) {
            View view = this.f575g;
            if (view == null) {
                view = this.A;
            }
            if (view != null) {
                o(h11, view, z11 | (z12 ? 2 : 0), 3);
            }
        }
        ListView listView2 = this.f575g;
        if (listView2 == null || (listAdapter = this.H) == null) {
            return;
        }
        listView2.setAdapter(listAdapter);
        int i13 = this.I;
        if (i13 > -1) {
            listView2.setItemChecked(i13, true);
            listView2.setSelection(i13);
        }
    }

    private static boolean y(Context context) {
        TypedValue typedValue = new TypedValue();
        context.getTheme().resolveAttribute(h.a.f20156j, typedValue, true);
        return typedValue.data != 0;
    }

    public int c(int i10) {
        TypedValue typedValue = new TypedValue();
        this.f569a.getTheme().resolveAttribute(i10, typedValue, true);
        return typedValue.resourceId;
    }

    public ListView d() {
        return this.f575g;
    }

    public void e() {
        this.f570b.setContentView(i());
        x();
    }

    public boolean f(int i10, KeyEvent keyEvent) {
        NestedScrollView nestedScrollView = this.A;
        return nestedScrollView != null && nestedScrollView.t(keyEvent);
    }

    public boolean g(int i10, KeyEvent keyEvent) {
        NestedScrollView nestedScrollView = this.A;
        return nestedScrollView != null && nestedScrollView.t(keyEvent);
    }

    public void j(int i10, CharSequence charSequence, DialogInterface.OnClickListener onClickListener, Message message, Drawable drawable) {
        if (message == null && onClickListener != null) {
            message = this.R.obtainMessage(i10, onClickListener);
        }
        if (i10 == -3) {
            this.f592x = charSequence;
            this.f593y = message;
            this.f594z = drawable;
        } else if (i10 == -2) {
            this.f588t = charSequence;
            this.f589u = message;
            this.f590v = drawable;
        } else {
            if (i10 != -1) {
                throw new IllegalArgumentException("Button does not exist");
            }
            this.f584p = charSequence;
            this.f585q = message;
            this.f586r = drawable;
        }
    }

    public void k(View view) {
        this.G = view;
    }

    public void l(int i10) {
        this.C = null;
        this.B = i10;
        ImageView imageView = this.D;
        if (imageView != null) {
            if (i10 == 0) {
                imageView.setVisibility(8);
            } else {
                imageView.setVisibility(0);
                this.D.setImageResource(this.B);
            }
        }
    }

    public void m(Drawable drawable) {
        this.C = drawable;
        this.B = 0;
        ImageView imageView = this.D;
        if (imageView != null) {
            if (drawable == null) {
                imageView.setVisibility(8);
            } else {
                imageView.setVisibility(0);
                this.D.setImageDrawable(drawable);
            }
        }
    }

    public void n(CharSequence charSequence) {
        this.f574f = charSequence;
        TextView textView = this.F;
        if (textView != null) {
            textView.setText(charSequence);
        }
    }

    public void p(CharSequence charSequence) {
        this.f573e = charSequence;
        TextView textView = this.E;
        if (textView != null) {
            textView.setText(charSequence);
        }
    }

    public void q(int i10) {
        this.f576h = null;
        this.f577i = i10;
        this.f582n = false;
    }

    public void r(View view) {
        this.f576h = view;
        this.f577i = 0;
        this.f582n = false;
    }

    public void s(View view, int i10, int i11, int i12, int i13) {
        this.f576h = view;
        this.f577i = 0;
        this.f582n = true;
        this.f578j = i10;
        this.f579k = i11;
        this.f580l = i12;
        this.f581m = i13;
    }
}
