package androidx.appcompat.app;

import android.content.Context;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import androidx.appcompat.view.b;
import androidx.core.view.f;

/* JADX INFO: compiled from: AppCompatDialog.java */
/* JADX INFO: loaded from: classes.dex */
public class h extends androidx.activity.f implements d {

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    private e f250g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    private final f.a f251h;

    public h(Context context, int i3) {
        super(context, i(context, i3));
        this.f251h = new f.a() { // from class: androidx.appcompat.app.g
            @Override // androidx.core.view.f.a
            public final boolean f(KeyEvent keyEvent) {
                return this.f249e.l(keyEvent);
            }
        };
        e eVarG = g();
        eVarG.D(i(context, i3));
        eVarG.q(null);
    }

    private static int i(Context context, int i3) {
        if (i3 != 0) {
            return i3;
        }
        TypedValue typedValue = new TypedValue();
        context.getTheme().resolveAttribute(c.a.f3175z, typedValue, true);
        return typedValue.resourceId;
    }

    @Override // android.app.Dialog
    public void addContentView(View view, ViewGroup.LayoutParams layoutParams) {
        g().d(view, layoutParams);
    }

    @Override // android.app.Dialog, android.content.DialogInterface
    public void dismiss() {
        super.dismiss();
        g().r();
    }

    @Override // android.app.Dialog, android.view.Window.Callback
    public boolean dispatchKeyEvent(KeyEvent keyEvent) {
        return androidx.core.view.f.e(this.f251h, getWindow().getDecorView(), this, keyEvent);
    }

    @Override // android.app.Dialog
    public <T extends View> T findViewById(int i3) {
        return (T) g().i(i3);
    }

    public e g() {
        if (this.f250g == null) {
            this.f250g = e.h(this, this);
        }
        return this.f250g;
    }

    @Override // androidx.appcompat.app.d
    public void h(androidx.appcompat.view.b bVar) {
    }

    @Override // android.app.Dialog
    public void invalidateOptionsMenu() {
        g().o();
    }

    @Override // androidx.appcompat.app.d
    public void j(androidx.appcompat.view.b bVar) {
    }

    @Override // androidx.appcompat.app.d
    public androidx.appcompat.view.b k(b.a aVar) {
        return null;
    }

    boolean l(KeyEvent keyEvent) {
        return super.dispatchKeyEvent(keyEvent);
    }

    public boolean m(int i3) {
        return g().z(i3);
    }

    @Override // androidx.activity.f, android.app.Dialog
    protected void onCreate(Bundle bundle) {
        g().n();
        super.onCreate(bundle);
        g().q(bundle);
    }

    @Override // androidx.activity.f, android.app.Dialog
    protected void onStop() {
        super.onStop();
        g().w();
    }

    @Override // android.app.Dialog
    public void setContentView(int i3) {
        g().A(i3);
    }

    @Override // android.app.Dialog
    public void setTitle(CharSequence charSequence) {
        super.setTitle(charSequence);
        g().E(charSequence);
    }

    @Override // android.app.Dialog
    public void setContentView(View view) {
        g().B(view);
    }

    @Override // android.app.Dialog
    public void setContentView(View view, ViewGroup.LayoutParams layoutParams) {
        g().C(view, layoutParams);
    }

    @Override // android.app.Dialog
    public void setTitle(int i3) {
        super.setTitle(i3);
        g().E(getContext().getString(i3));
    }
}
