package androidx.appcompat.app;

import android.content.Context;
import android.content.DialogInterface;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Message;
import android.util.AttributeSet;
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.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import androidx.core.widget.NestedScrollView;
import com.ifpdos.udi.service.core.pc.R;
import d.b.c.n;
import java.lang.ref.WeakReference;

/* JADX INFO: loaded from: classes.dex */
public class AlertController {
    public NestedScrollView A;
    public Drawable C;
    public ImageView D;
    public TextView E;
    public TextView F;
    public View G;
    public ListAdapter H;
    public int J;
    public int K;
    public int L;
    public int M;
    public int N;
    public int O;
    public boolean P;
    public Handler Q;
    public final Context a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final n f395b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final Window f396c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final int f397d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public CharSequence f398e;

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

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public ListView f400g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public View f401h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public int f402i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public int f403j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public int f404k;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public int f405l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public int f406m;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public Button f408o;

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public CharSequence f409p;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public Message f410q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public Drawable f411r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public Button f412s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public CharSequence f413t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public Message f414u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public Drawable f415v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public Button f416w;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public CharSequence f417x;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public Message f418y;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public Drawable f419z;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public boolean f407n = false;
    public int B = 0;
    public int I = -1;
    public final View.OnClickListener R = new a();

    public static class RecycleListView extends ListView {

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        public final int f420f;

        /* JADX INFO: renamed from: m, reason: collision with root package name */
        public final int f421m;

        public RecycleListView(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
            TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, d.b.b.f1546s);
            this.f421m = typedArrayObtainStyledAttributes.getDimensionPixelOffset(0, -1);
            this.f420f = typedArrayObtainStyledAttributes.getDimensionPixelOffset(1, -1);
        }
    }

    public class a implements View.OnClickListener {
        public a() {
        }

        @Override // android.view.View.OnClickListener
        public void onClick(View view) {
            Message message;
            Message message2;
            AlertController alertController = AlertController.this;
            Message messageObtain = ((view != alertController.f408o || (message2 = alertController.f410q) == null) && (view != alertController.f412s || (message2 = alertController.f414u) == null)) ? (view != alertController.f416w || (message = alertController.f418y) == null) ? null : Message.obtain(message) : Message.obtain(message2);
            if (messageObtain != null) {
                messageObtain.sendToTarget();
            }
            AlertController alertController2 = AlertController.this;
            alertController2.Q.obtainMessage(1, alertController2.f395b).sendToTarget();
        }
    }

    public static class b {
        public final Context a;

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

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        public Drawable f424c;

        /* JADX INFO: renamed from: d, reason: collision with root package name */
        public CharSequence f425d;

        /* JADX INFO: renamed from: e, reason: collision with root package name */
        public View f426e;

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        public DialogInterface.OnKeyListener f427f;

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        public ListAdapter f428g;

        /* JADX INFO: renamed from: h, reason: collision with root package name */
        public DialogInterface.OnClickListener f429h;

        /* JADX INFO: renamed from: i, reason: collision with root package name */
        public boolean f430i;

        /* JADX INFO: renamed from: j, reason: collision with root package name */
        public int f431j = -1;

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

    public static final class c extends Handler {
        public WeakReference<DialogInterface> a;

        public c(DialogInterface dialogInterface) {
            this.a = new WeakReference<>(dialogInterface);
        }

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

    public static class d extends ArrayAdapter<CharSequence> {
        public d(Context context, int i2, int i3, CharSequence[] charSequenceArr) {
            super(context, i2, i3, (Object[]) null);
        }

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

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

    public AlertController(Context context, n nVar, Window window) {
        this.a = context;
        this.f395b = nVar;
        this.f396c = window;
        this.Q = new c(nVar);
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(null, d.b.b.f1532e, R.attr.alertDialogStyle, 0);
        this.J = typedArrayObtainStyledAttributes.getResourceId(0, 0);
        this.K = typedArrayObtainStyledAttributes.getResourceId(2, 0);
        this.L = typedArrayObtainStyledAttributes.getResourceId(4, 0);
        this.M = typedArrayObtainStyledAttributes.getResourceId(5, 0);
        this.N = typedArrayObtainStyledAttributes.getResourceId(7, 0);
        this.O = typedArrayObtainStyledAttributes.getResourceId(3, 0);
        this.P = typedArrayObtainStyledAttributes.getBoolean(6, true);
        this.f397d = typedArrayObtainStyledAttributes.getDimensionPixelSize(1, 0);
        typedArrayObtainStyledAttributes.recycle();
        nVar.a().u(1);
    }

    public 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;
    }

    public static void c(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 b(Button button) {
        LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) button.getLayoutParams();
        layoutParams.gravity = 1;
        layoutParams.weight = 0.5f;
        button.setLayoutParams(layoutParams);
    }

    public final ViewGroup d(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;
    }
}
