package o;

import android.content.Context;
import android.content.DialogInterface;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Message;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.ViewStub;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.TextView;
import androidx.appcompat.app.AlertController$RecycleListView;
import androidx.core.widget.NestedScrollView;
import com.google.android.gms.common.R;
import java.lang.ref.WeakReference;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.f2, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C1158f2 {
    public final int A;
    public final boolean B;
    public final HandlerC0967d2 C;
    public final Context a;
    public final DialogInterfaceC1350h2 b;
    public final Window c;
    public CharSequence d;
    public String e;
    public AlertController$RecycleListView f;
    public Button g;
    public CharSequence h;
    public Message i;
    public Button j;
    public CharSequence k;
    public Message l;
    public Button m;
    public CharSequence n;

    /* renamed from: o, reason: collision with root package name */
    public Message f520o;
    public NestedScrollView p;
    public Drawable q;
    public ImageView r;
    public TextView s;
    public TextView t;
    public View u;
    public ListAdapter v;
    public final int x;
    public final int y;
    public final int z;
    public int w = -1;
    public final V0 D = new V0(1, this);

    public C1158f2(Context context, DialogInterfaceC1350h2 dialogInterfaceC1350h2, Window window) {
        this.a = context;
        this.b = dialogInterfaceC1350h2;
        this.c = window;
        HandlerC0967d2 handlerC0967d2 = new HandlerC0967d2();
        handlerC0967d2.a = new WeakReference(dialogInterfaceC1350h2);
        this.C = handlerC0967d2;
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(null, YZ.e, R.attr.alertDialogStyle, 0);
        this.x = typedArrayObtainStyledAttributes.getResourceId(0, 0);
        typedArrayObtainStyledAttributes.getResourceId(2, 0);
        this.y = typedArrayObtainStyledAttributes.getResourceId(4, 0);
        typedArrayObtainStyledAttributes.getResourceId(5, 0);
        this.z = typedArrayObtainStyledAttributes.getResourceId(7, 0);
        this.A = typedArrayObtainStyledAttributes.getResourceId(3, 0);
        this.B = typedArrayObtainStyledAttributes.getBoolean(6, true);
        typedArrayObtainStyledAttributes.getDimensionPixelSize(1, 0);
        typedArrayObtainStyledAttributes.recycle();
        dialogInterfaceC1350h2.c().f(1);
    }

    public static ViewGroup a(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 b(int i, String str, DialogInterface.OnClickListener onClickListener) {
        Message messageObtainMessage = onClickListener != null ? this.C.obtainMessage(i, onClickListener) : null;
        if (i == -3) {
            this.n = str;
            this.f520o = messageObtainMessage;
        } else if (i == -2) {
            this.k = str;
            this.l = messageObtainMessage;
        } else {
            if (i != -1) {
                throw new IllegalArgumentException("Button does not exist");
            }
            this.h = str;
            this.i = messageObtainMessage;
        }
    }
}
