package androidx.appcompat.app;

import android.content.Context;
import android.content.DialogInterface;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.ContextThemeWrapper;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ListAdapter;
import android.widget.ListView;
import androidx.appcompat.app.AlertController;
import p007c.C0485a;
import p010d.DialogC0595y;

/* renamed from: androidx.appcompat.app.a */
/* loaded from: classes.dex */
public class DialogInterfaceC0089a extends DialogC0595y implements DialogInterface {

    /* renamed from: h */
    public final AlertController f208h;

    /* renamed from: androidx.appcompat.app.a$a */
    /* loaded from: classes.dex */
    public static class C0090a {

        /* renamed from: a */
        public final AlertController.C0082f f209a;

        /* renamed from: b */
        public final int f210b;

        public C0090a(Context context) {
            this(context, DialogInterfaceC0089a.m4950o(context, 0));
        }

        public C0090a(Context context, int i) {
            this.f209a = new AlertController.C0082f(new ContextThemeWrapper(context, DialogInterfaceC0089a.m4950o(context, i)));
            this.f210b = i;
        }

        /* renamed from: a */
        public DialogInterfaceC0089a m4949a() {
            DialogInterfaceC0089a dialogInterfaceC0089a = new DialogInterfaceC0089a(this.f209a.f169a, this.f210b);
            this.f209a.m4953a(dialogInterfaceC0089a.f208h);
            dialogInterfaceC0089a.setCancelable(this.f209a.f186r);
            if (this.f209a.f186r) {
                dialogInterfaceC0089a.setCanceledOnTouchOutside(true);
            }
            dialogInterfaceC0089a.setOnCancelListener(this.f209a.f187s);
            dialogInterfaceC0089a.setOnDismissListener(this.f209a.f188t);
            DialogInterface.OnKeyListener onKeyListener = this.f209a.f189u;
            if (onKeyListener != null) {
                dialogInterfaceC0089a.setOnKeyListener(onKeyListener);
            }
            return dialogInterfaceC0089a;
        }

        /* renamed from: b */
        public Context m4948b() {
            return this.f209a.f169a;
        }

        /* renamed from: c */
        public C0090a m4947c(ListAdapter listAdapter, DialogInterface.OnClickListener onClickListener) {
            AlertController.C0082f c0082f = this.f209a;
            c0082f.f191w = listAdapter;
            c0082f.f192x = onClickListener;
            return this;
        }

        /* renamed from: d */
        public C0090a m4946d(View view) {
            this.f209a.f175g = view;
            return this;
        }

        /* renamed from: e */
        public C0090a m4945e(Drawable drawable) {
            this.f209a.f172d = drawable;
            return this;
        }

        /* renamed from: f */
        public C0090a m4944f(DialogInterface.OnKeyListener onKeyListener) {
            this.f209a.f189u = onKeyListener;
            return this;
        }

        /* renamed from: g */
        public C0090a m4943g(ListAdapter listAdapter, int i, DialogInterface.OnClickListener onClickListener) {
            AlertController.C0082f c0082f = this.f209a;
            c0082f.f191w = listAdapter;
            c0082f.f192x = onClickListener;
            c0082f.f162I = i;
            c0082f.f161H = true;
            return this;
        }

        /* renamed from: h */
        public C0090a m4942h(CharSequence charSequence) {
            this.f209a.f174f = charSequence;
            return this;
        }
    }

    public DialogInterfaceC0089a(Context context, int i) {
        super(context, m4950o(context, i));
        this.f208h = new AlertController(getContext(), this, getWindow());
    }

    /* renamed from: o */
    public static int m4950o(Context context, int i) {
        if (((i >>> 24) & 255) >= 1) {
            return i;
        }
        TypedValue typedValue = new TypedValue();
        context.getTheme().resolveAttribute(C0485a.alertDialogTheme, typedValue, true);
        return typedValue.resourceId;
    }

    /* renamed from: n */
    public ListView m4951n() {
        return this.f208h.m4977d();
    }

    @Override // p010d.DialogC0595y, androidx.activity.DialogC0059g, android.app.Dialog
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.f208h.m4976e();
    }

    @Override // android.app.Dialog, android.view.KeyEvent.Callback
    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        if (this.f208h.m4974g(i, keyEvent)) {
            return true;
        }
        return super.onKeyDown(i, keyEvent);
    }

    @Override // android.app.Dialog, android.view.KeyEvent.Callback
    public boolean onKeyUp(int i, KeyEvent keyEvent) {
        if (this.f208h.m4973h(i, keyEvent)) {
            return true;
        }
        return super.onKeyUp(i, keyEvent);
    }

    @Override // p010d.DialogC0595y, android.app.Dialog
    public void setTitle(CharSequence charSequence) {
        super.setTitle(charSequence);
        this.f208h.m4964q(charSequence);
    }
}