package androidx.activity;

import android.app.Dialog;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import androidx.lifecycle.AbstractC0424i;
import androidx.lifecycle.C0435n;
import androidx.lifecycle.InterfaceC0434m;
import p039m1.C1470g;

/* renamed from: androidx.activity.g */
/* loaded from: classes.dex */
public class DialogC0059g extends Dialog implements InterfaceC0434m, InterfaceC0065m {

    /* renamed from: d */
    public C0435n f65d;

    /* renamed from: e */
    public final OnBackPressedDispatcher f66e;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public DialogC0059g(Context context, int i) {
        super(context, i);
        C1470g.m1292e(context, "context");
        this.f66e = new OnBackPressedDispatcher(new Runnable() { // from class: androidx.activity.f
            @Override // java.lang.Runnable
            public final void run() {
                DialogC0059g.m5005f(DialogC0059g.this);
            }
        });
    }

    /* renamed from: f */
    public static final void m5005f(DialogC0059g dialogC0059g) {
        C1470g.m1292e(dialogC0059g, "this$0");
        super.onBackPressed();
    }

    @Override // androidx.lifecycle.InterfaceC0434m
    /* renamed from: a */
    public final AbstractC0424i mo421a() {
        return m5006e();
    }

    @Override // androidx.activity.InterfaceC0065m
    /* renamed from: c */
    public final OnBackPressedDispatcher mo4120c() {
        return this.f66e;
    }

    /* renamed from: e */
    public final C0435n m5006e() {
        C0435n c0435n = this.f65d;
        if (c0435n == null) {
            C0435n c0435n2 = new C0435n(this);
            this.f65d = c0435n2;
            return c0435n2;
        }
        return c0435n;
    }

    @Override // android.app.Dialog
    public void onBackPressed() {
        this.f66e.m5014f();
    }

    @Override // android.app.Dialog
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        if (Build.VERSION.SDK_INT >= 33) {
            this.f66e.m5013g(getOnBackInvokedDispatcher());
        }
        m5006e().m3686h(AbstractC0424i.EnumC0426b.ON_CREATE);
    }

    @Override // android.app.Dialog
    public void onStart() {
        super.onStart();
        m5006e().m3686h(AbstractC0424i.EnumC0426b.ON_RESUME);
    }

    @Override // android.app.Dialog
    public void onStop() {
        m5006e().m3686h(AbstractC0424i.EnumC0426b.ON_DESTROY);
        this.f65d = null;
        super.onStop();
    }
}