package defpackage;

import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import ar.tvplayer.tv.R;

/* renamed from: ᵷʜ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public class DialogInterfaceOnCancelListenerC4853 extends AbstractComponentCallbacksC3693 implements DialogInterface.OnCancelListener, DialogInterface.OnDismissListener {

    /* renamed from: ˆᵪᵵ, reason: contains not printable characters */
    public boolean f18008;

    /* renamed from: ˉᵴﹶ, reason: contains not printable characters */
    public Handler f18009;

    /* renamed from: ᵔᵨ, reason: contains not printable characters */
    public boolean f18011;

    /* renamed from: ᵦᵽᵢ, reason: contains not printable characters */
    public boolean f18013;

    /* renamed from: ᵰᵷᵹˆ, reason: contains not printable characters */
    public Dialog f18017;

    /* renamed from: ᵱˑᵲ, reason: contains not printable characters */
    public boolean f18018;

    /* renamed from: ᵴᵯᵴⁱ, reason: contains not printable characters */
    public final RunnableC2802 f18021 = new RunnableC2802(6, this);

    /* renamed from: ᵪᵛʿ, reason: contains not printable characters */
    public final DialogInterfaceOnCancelListenerC2097 f18014 = new DialogInterfaceOnCancelListenerC2097(this);

    /* renamed from: ᵦᵳˎ, reason: contains not printable characters */
    public final DialogInterfaceOnDismissListenerC2164 f18012 = new DialogInterfaceOnDismissListenerC2164(this);

    /* renamed from: ᵳᵮᵸ, reason: contains not printable characters */
    public int f18020 = 0;

    /* renamed from: ˆʕ, reason: contains not printable characters */
    public int f18007 = 0;

    /* renamed from: ˎᵶᵹ, reason: contains not printable characters */
    public boolean f18010 = true;

    /* renamed from: ᵯᵽ, reason: contains not printable characters */
    public boolean f18016 = true;

    /* renamed from: ᵮᴵˊ, reason: contains not printable characters */
    public int f18015 = -1;

    /* renamed from: ᵲʟᵹ, reason: contains not printable characters */
    public final C3559 f18019 = new C3559(this);

    /* renamed from: ˁᵳˉ, reason: contains not printable characters */
    public boolean f18006 = false;

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

    public void onDismiss(DialogInterface dialogInterface) {
        if (this.f18011) {
            return;
        }
        if (AbstractC4731.m9918(3)) {
            toString();
        }
        m10182(true);
    }

    @Override // defpackage.AbstractComponentCallbacksC3693
    /* renamed from: ʾˋˊᵽ */
    public final void mo8288(Context context) {
        super.mo8288(context);
        this.f13741.m1642(this.f18019);
        if (this.f18018) {
            return;
        }
        this.f18013 = false;
    }

    /* renamed from: ˈᵫˊˉ, reason: contains not printable characters */
    public final void m10181() {
        m10182(false);
    }

    @Override // defpackage.AbstractComponentCallbacksC3693
    /* renamed from: ˉᵴﹶ */
    public final void mo1063() {
        this.f13788 = true;
        Dialog dialog = this.f18017;
        if (dialog != null) {
            this.f18011 = true;
            dialog.setOnDismissListener(null);
            this.f18017.dismiss();
            if (!this.f18013) {
                onDismiss(this.f18017);
            }
            this.f18017 = null;
            this.f18006 = false;
        }
    }

    @Override // defpackage.AbstractComponentCallbacksC3693
    /* renamed from: ˎᵶᵹ */
    public void mo1064(Bundle bundle) {
        Dialog dialog = this.f18017;
        if (dialog != null) {
            Bundle bundleOnSaveInstanceState = dialog.onSaveInstanceState();
            bundleOnSaveInstanceState.putBoolean("android:dialogShowing", false);
            bundle.putBundle("android:savedDialogState", bundleOnSaveInstanceState);
        }
        int i = this.f18020;
        if (i != 0) {
            bundle.putInt("android:style", i);
        }
        int i2 = this.f18007;
        if (i2 != 0) {
            bundle.putInt("android:theme", i2);
        }
        boolean z = this.f18010;
        if (!z) {
            bundle.putBoolean("android:cancelable", z);
        }
        boolean z2 = this.f18016;
        if (!z2) {
            bundle.putBoolean("android:showsDialog", z2);
        }
        int i3 = this.f18015;
        if (i3 != -1) {
            bundle.putInt("android:backStackId", i3);
        }
    }

    /* renamed from: ᵖᵖˊ */
    public Dialog mo5452(Bundle bundle) {
        if (AbstractC4731.m9918(3)) {
            toString();
        }
        return new DialogC1493(m8292(), this.f18007);
    }

    @Override // defpackage.AbstractComponentCallbacksC3693
    /* renamed from: ᵠᵪˀᵻ */
    public final void mo8301() {
        this.f13788 = true;
    }

    /* JADX WARN: Removed duplicated region for block: B:26:0x0046 A[Catch: all -> 0x004e, TryCatch #0 {all -> 0x004e, blocks: (B:12:0x0018, B:14:0x0024, B:24:0x003c, B:26:0x0046, B:29:0x0050, B:20:0x002e, B:22:0x0034, B:23:0x0039, B:30:0x0068), top: B:45:0x0018 }] */
    @Override // defpackage.AbstractComponentCallbacksC3693
    /* renamed from: ᵪᵛʿ */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final android.view.LayoutInflater mo8311(android.os.Bundle r7) {
        /*
            r6 = this;
            android.view.LayoutInflater r0 = super.mo8311(r7)
            boolean r1 = r6.f18016
            r2 = 2
            if (r1 == 0) goto L87
            boolean r3 = r6.f18008
            if (r3 == 0) goto Lf
            goto L87
        Lf:
            if (r1 != 0) goto L12
            goto L71
        L12:
            boolean r1 = r6.f18006
            if (r1 != 0) goto L71
            r1 = 0
            r3 = 1
            r6.f18008 = r3     // Catch: java.lang.Throwable -> L4e
            android.app.Dialog r7 = r6.mo5452(r7)     // Catch: java.lang.Throwable -> L4e
            r6.f18017 = r7     // Catch: java.lang.Throwable -> L4e
            boolean r4 = r6.f18016     // Catch: java.lang.Throwable -> L4e
            if (r4 == 0) goto L68
            int r4 = r6.f18020     // Catch: java.lang.Throwable -> L4e
            if (r4 == r3) goto L39
            if (r4 == r2) goto L39
            r5 = 3
            if (r4 == r5) goto L2e
            goto L3c
        L2e:
            android.view.Window r4 = r7.getWindow()     // Catch: java.lang.Throwable -> L4e
            if (r4 == 0) goto L39
            r5 = 24
            r4.addFlags(r5)     // Catch: java.lang.Throwable -> L4e
        L39:
            r7.requestWindowFeature(r3)     // Catch: java.lang.Throwable -> L4e
        L3c:
            android.content.Context r7 = r6.mo4691()     // Catch: java.lang.Throwable -> L4e
            boolean r4 = defpackage.AbstractC3915.m8586(r7)     // Catch: java.lang.Throwable -> L4e
            if (r4 == 0) goto L50
            android.app.Dialog r4 = r6.f18017     // Catch: java.lang.Throwable -> L4e
            android.app.Activity r7 = (android.app.Activity) r7     // Catch: java.lang.Throwable -> L4e
            r4.setOwnerActivity(r7)     // Catch: java.lang.Throwable -> L4e
            goto L50
        L4e:
            r7 = move-exception
            goto L6e
        L50:
            android.app.Dialog r7 = r6.f18017     // Catch: java.lang.Throwable -> L4e
            boolean r4 = r6.f18010     // Catch: java.lang.Throwable -> L4e
            r7.setCancelable(r4)     // Catch: java.lang.Throwable -> L4e
            android.app.Dialog r7 = r6.f18017     // Catch: java.lang.Throwable -> L4e
            ˑᵪᵢ r4 = r6.f18014     // Catch: java.lang.Throwable -> L4e
            r7.setOnCancelListener(r4)     // Catch: java.lang.Throwable -> L4e
            android.app.Dialog r7 = r6.f18017     // Catch: java.lang.Throwable -> L4e
            ᐧʽ r4 = r6.f18012     // Catch: java.lang.Throwable -> L4e
            r7.setOnDismissListener(r4)     // Catch: java.lang.Throwable -> L4e
            r6.f18006 = r3     // Catch: java.lang.Throwable -> L4e
            goto L6b
        L68:
            r7 = 0
            r6.f18017 = r7     // Catch: java.lang.Throwable -> L4e
        L6b:
            r6.f18008 = r1
            goto L71
        L6e:
            r6.f18008 = r1
            throw r7
        L71:
            boolean r7 = defpackage.AbstractC4731.m9918(r2)
            if (r7 == 0) goto L7a
            r6.toString()
        L7a:
            android.app.Dialog r6 = r6.f18017
            if (r6 == 0) goto L90
            android.content.Context r6 = r6.getContext()
            android.view.LayoutInflater r6 = r0.cloneInContext(r6)
            return r6
        L87:
            boolean r7 = defpackage.AbstractC4731.m9918(r2)
            if (r7 == 0) goto L90
            r6.toString()
        L90:
            return r0
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.DialogInterfaceOnCancelListenerC4853.mo8311(android.os.Bundle):android.view.LayoutInflater");
    }

    @Override // defpackage.AbstractComponentCallbacksC3693
    /* renamed from: ᵮᴵˊ */
    public final void mo1068() {
        this.f13788 = true;
        Dialog dialog = this.f18017;
        if (dialog != null) {
            dialog.hide();
        }
    }

    @Override // defpackage.AbstractComponentCallbacksC3693
    /* renamed from: ᵯᵽ */
    public void mo1069() {
        this.f13788 = true;
        Dialog dialog = this.f18017;
        if (dialog != null) {
            this.f18011 = false;
            dialog.show();
            View decorView = this.f18017.getWindow().getDecorView();
            decorView.setTag(R.id._11_res_0x7f0b0444, this);
            decorView.setTag(R.id._11_res_0x7f0b0447, this);
            decorView.setTag(R.id._11_res_0x7f0b0446, this);
        }
    }

    @Override // defpackage.AbstractComponentCallbacksC3693
    /* renamed from: ᵰᵷᵹˆ */
    public final void mo8314(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        Bundle bundle2;
        super.mo8314(layoutInflater, viewGroup, bundle);
        if (this.f13752 != null || this.f18017 == null || bundle == null || (bundle2 = bundle.getBundle("android:savedDialogState")) == null) {
            return;
        }
        this.f18017.onRestoreInstanceState(bundle2);
    }

    @Override // defpackage.AbstractComponentCallbacksC3693
    /* renamed from: ᵲʟᵹ */
    public final void mo8316(Bundle bundle) {
        Bundle bundle2;
        this.f13788 = true;
        if (this.f18017 == null || bundle == null || (bundle2 = bundle.getBundle("android:savedDialogState")) == null) {
            return;
        }
        this.f18017.onRestoreInstanceState(bundle2);
    }

    /* renamed from: ᵳᵮ, reason: contains not printable characters */
    public final void m10182(boolean z) {
        if (this.f18013) {
            return;
        }
        this.f18013 = true;
        this.f18018 = false;
        Dialog dialog = this.f18017;
        if (dialog != null) {
            dialog.setOnDismissListener(null);
            this.f18017.dismiss();
            if (!z) {
                if (Looper.myLooper() == this.f18009.getLooper()) {
                    onDismiss(this.f18017);
                } else {
                    this.f18009.post(this.f18021);
                }
            }
        }
        this.f18011 = true;
        if (this.f18015 >= 0) {
            m8326().m9937(this.f18015, 1, true);
            this.f18015 = -1;
        } else {
            C4877 c4877 = new C4877(m8326());
            c4877.f18146 = true;
            c4877.m10298(this);
            c4877.m10303(true, true);
        }
    }

    @Override // defpackage.AbstractComponentCallbacksC3693
    /* renamed from: ᵳᵹᵺˋ */
    public final ˆᴵ mo8322() {
        return new C4360(this, new C3641(this));
    }

    @Override // defpackage.AbstractComponentCallbacksC3693
    /* renamed from: ᵴᵯᵴⁱ */
    public final void mo8323() {
        this.f13788 = true;
        if (!this.f18018 && !this.f18013) {
            this.f18013 = true;
        }
        this.f13741.m1646(this.f18019);
    }

    @Override // defpackage.AbstractComponentCallbacksC3693
    /* renamed from: ᵺᵜᵰ */
    public void mo1071(Bundle bundle) {
        super.mo1071(bundle);
        this.f18009 = new Handler();
        this.f18016 = this.f13754 == 0;
        if (bundle != null) {
            this.f18020 = bundle.getInt("android:style", 0);
            this.f18007 = bundle.getInt("android:theme", 0);
            this.f18010 = bundle.getBoolean("android:cancelable", true);
            this.f18016 = bundle.getBoolean("android:showsDialog", this.f18016);
            this.f18015 = bundle.getInt("android:backStackId", -1);
        }
    }
}
