package androidx.fragment.app;

import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.riyaz.zvytour.R;
import d.DialogC0520n;
import p0.AbstractC0928a;
import r4.AbstractC0983h;

/* JADX INFO: renamed from: androidx.fragment.app.w, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public class DialogInterfaceOnCancelListenerC0290w extends I implements DialogInterface.OnCancelListener, DialogInterface.OnDismissListener {

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final DialogInterfaceOnCancelListenerC0286s f4389k;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public final DialogInterfaceOnDismissListenerC0287t f4390l;

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

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

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public boolean f4393o;
    public boolean p;
    public int q;

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

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final C0288u f4395s;

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

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

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

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

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

    public DialogInterfaceOnCancelListenerC0290w() {
        new r(0, this);
        this.f4389k = new DialogInterfaceOnCancelListenerC0286s(this);
        this.f4390l = new DialogInterfaceOnDismissListenerC0287t(this);
        this.f4391m = 0;
        this.f4392n = 0;
        this.f4393o = true;
        this.p = true;
        this.q = -1;
        this.f4395s = new C0288u(this);
        this.f4400x = false;
    }

    @Override // androidx.fragment.app.I
    public final Q createFragmentContainer() {
        return new C0289v(this, super.createFragmentContainer());
    }

    public Dialog f() {
        if (h0.J(3)) {
            Log.d("FragmentManager", "onCreateDialog called for DialogFragment " + this);
        }
        return new DialogC0520n(requireContext(), this.f4392n);
    }

    @Override // androidx.fragment.app.I
    public final void onAttach(Context context) {
        super.onAttach(context);
        getViewLifecycleOwnerLiveData().observeForever(this.f4395s);
        if (this.f4399w) {
            return;
        }
        this.f4398v = false;
    }

    @Override // android.content.DialogInterface.OnCancelListener
    public void onCancel(DialogInterface dialogInterface) {
    }

    @Override // androidx.fragment.app.I
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        new Handler();
        this.p = this.mContainerId == 0;
        if (bundle != null) {
            this.f4391m = bundle.getInt("android:style", 0);
            this.f4392n = bundle.getInt("android:theme", 0);
            this.f4393o = bundle.getBoolean("android:cancelable", true);
            this.p = bundle.getBoolean("android:showsDialog", this.p);
            this.q = bundle.getInt("android:backStackId", -1);
        }
    }

    @Override // androidx.fragment.app.I
    public final void onDestroyView() {
        super.onDestroyView();
        Dialog dialog = this.f4396t;
        if (dialog != null) {
            this.f4397u = true;
            dialog.setOnDismissListener(null);
            this.f4396t.dismiss();
            if (!this.f4398v) {
                onDismiss(this.f4396t);
            }
            this.f4396t = null;
            this.f4400x = false;
        }
    }

    @Override // androidx.fragment.app.I
    public final void onDetach() {
        super.onDetach();
        if (!this.f4399w && !this.f4398v) {
            this.f4398v = true;
        }
        getViewLifecycleOwnerLiveData().removeObserver(this.f4395s);
    }

    @Override // android.content.DialogInterface.OnDismissListener
    public void onDismiss(DialogInterface dialogInterface) {
        if (this.f4397u) {
            return;
        }
        if (h0.J(3)) {
            Log.d("FragmentManager", "onDismiss called for DialogFragment " + this);
        }
        if (this.f4398v) {
            return;
        }
        this.f4398v = true;
        this.f4399w = false;
        Dialog dialog = this.f4396t;
        if (dialog != null) {
            dialog.setOnDismissListener(null);
            this.f4396t.dismiss();
        }
        this.f4397u = true;
        if (this.q >= 0) {
            h0 parentFragmentManager = getParentFragmentManager();
            int i = this.q;
            parentFragmentManager.getClass();
            if (i < 0) {
                throw new IllegalArgumentException(AbstractC0928a.i(i, "Bad id: "));
            }
            parentFragmentManager.x(new C0273f0(parentFragmentManager, i), true);
            this.q = -1;
            return;
        }
        h0 parentFragmentManager2 = getParentFragmentManager();
        parentFragmentManager2.getClass();
        C0262a c0262a = new C0262a(parentFragmentManager2);
        c0262a.f4221o = true;
        h0 h0Var = this.mFragmentManager;
        if (h0Var == null || h0Var == c0262a.p) {
            c0262a.b(new r0(this, 3));
            c0262a.d(true);
        } else {
            throw new IllegalStateException("Cannot remove Fragment attached to a different FragmentManager. Fragment " + toString() + " is already attached to a FragmentManager.");
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:26:0x0046 A[Catch: all -> 0x004e, TryCatch #0 {all -> 0x004e, blocks: (B:12:0x001a, B:14:0x0026, B:24:0x003e, B:26:0x0046, B:29:0x0050, B:20:0x0030, B:22:0x0036, B:23:0x003b, B:30:0x0068), top: B:49:0x001a }] */
    @Override // androidx.fragment.app.I
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public final android.view.LayoutInflater onGetLayoutInflater(android.os.Bundle r8) {
        /*
            Method dump skipped, instruction units count: 214
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: androidx.fragment.app.DialogInterfaceOnCancelListenerC0290w.onGetLayoutInflater(android.os.Bundle):android.view.LayoutInflater");
    }

    @Override // androidx.fragment.app.I
    public void onSaveInstanceState(Bundle bundle) {
        Dialog dialog = this.f4396t;
        if (dialog != null) {
            Bundle bundleOnSaveInstanceState = dialog.onSaveInstanceState();
            bundleOnSaveInstanceState.putBoolean("android:dialogShowing", false);
            bundle.putBundle("android:savedDialogState", bundleOnSaveInstanceState);
        }
        int i = this.f4391m;
        if (i != 0) {
            bundle.putInt("android:style", i);
        }
        int i5 = this.f4392n;
        if (i5 != 0) {
            bundle.putInt("android:theme", i5);
        }
        boolean z5 = this.f4393o;
        if (!z5) {
            bundle.putBoolean("android:cancelable", z5);
        }
        boolean z6 = this.p;
        if (!z6) {
            bundle.putBoolean("android:showsDialog", z6);
        }
        int i6 = this.q;
        if (i6 != -1) {
            bundle.putInt("android:backStackId", i6);
        }
    }

    @Override // androidx.fragment.app.I
    public void onStart() {
        super.onStart();
        Dialog dialog = this.f4396t;
        if (dialog != null) {
            this.f4397u = false;
            dialog.show();
            View decorView = this.f4396t.getWindow().getDecorView();
            AbstractC0983h.e("<this>", decorView);
            decorView.setTag(R.id.view_tree_lifecycle_owner, this);
            decorView.setTag(R.id.view_tree_view_model_store_owner, this);
            decorView.setTag(R.id.view_tree_saved_state_registry_owner, this);
        }
    }

    @Override // androidx.fragment.app.I
    public void onStop() {
        super.onStop();
        Dialog dialog = this.f4396t;
        if (dialog != null) {
            dialog.hide();
        }
    }

    @Override // androidx.fragment.app.I
    public final void onViewStateRestored(Bundle bundle) {
        Bundle bundle2;
        super.onViewStateRestored(bundle);
        if (this.f4396t == null || bundle == null || (bundle2 = bundle.getBundle("android:savedDialogState")) == null) {
            return;
        }
        this.f4396t.onRestoreInstanceState(bundle2);
    }

    @Override // androidx.fragment.app.I
    public final void performCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        Bundle bundle2;
        super.performCreateView(layoutInflater, viewGroup, bundle);
        if (this.mView != null || this.f4396t == null || bundle == null || (bundle2 = bundle.getBundle("android:savedDialogState")) == null) {
            return;
        }
        this.f4396t.onRestoreInstanceState(bundle2);
    }
}
