package h0;

import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.content.Context;
import android.content.res.Resources;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import com.martsnew.tv.R;
import e0.C0853a;

/* JADX INFO: renamed from: h0.g, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1007g extends O3.e {

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

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

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

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C1007g(b0 b0Var, boolean z8) {
        super(b0Var);
        P6.g.e(b0Var, "operation");
        this.f13201r = z8;
    }

    /* JADX WARN: Removed duplicated region for block: B:18:0x0027  */
    /* JADX WARN: Removed duplicated region for block: B:80:0x00e6 A[Catch: RuntimeException -> 0x00ec, TRY_LEAVE, TryCatch #2 {RuntimeException -> 0x00ec, blocks: (B:78:0x00e0, B:80:0x00e6), top: B:91:0x00e0 }] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final C0853a F(Context context) {
        int iV;
        Animation animationLoadAnimation;
        C0853a c0853a;
        Animator animatorLoadAnimator;
        if (this.f13202s) {
            return this.f13203t;
        }
        b0 b0Var = (b0) this.f5146q;
        ComponentCallbacksC1023x componentCallbacksC1023x = b0Var.f13181c;
        boolean z8 = b0Var.f13179a == 2;
        C1021v c1021v = componentCallbacksC1023x.f13280a0;
        int i = c1021v == null ? 0 : c1021v.f13251f;
        if (this.f13201r) {
            if (z8) {
                iV = c1021v == null ? 0 : c1021v.f13249d;
            } else if (c1021v != null) {
                iV = c1021v.f13250e;
            }
        } else if (z8) {
            if (c1021v != null) {
                iV = c1021v.f13247b;
            }
        } else if (c1021v != null) {
            iV = c1021v.f13248c;
        }
        componentCallbacksC1023x.c0(0, 0, 0, 0);
        ViewGroup viewGroup = componentCallbacksC1023x.f13277W;
        C0853a c0853a2 = null;
        if (viewGroup != null && viewGroup.getTag(R.id.visible_removing_fragment_view_tag) != null) {
            componentCallbacksC1023x.f13277W.setTag(R.id.visible_removing_fragment_view_tag, null);
        }
        ViewGroup viewGroup2 = componentCallbacksC1023x.f13277W;
        if (viewGroup2 == null || viewGroup2.getLayoutTransition() == null) {
            if (iV == 0 && i != 0) {
                iV = i != 4097 ? i != 8194 ? i != 8197 ? i != 4099 ? i != 4100 ? -1 : z8 ? W3.b.v(context, android.R.attr.activityOpenEnterAnimation) : W3.b.v(context, android.R.attr.activityOpenExitAnimation) : z8 ? R.animator.fragment_fade_enter : R.animator.fragment_fade_exit : z8 ? W3.b.v(context, android.R.attr.activityCloseEnterAnimation) : W3.b.v(context, android.R.attr.activityCloseExitAnimation) : z8 ? R.animator.fragment_close_enter : R.animator.fragment_close_exit : z8 ? R.animator.fragment_open_enter : R.animator.fragment_open_exit;
            }
            if (iV != 0) {
                boolean zEquals = "anim".equals(context.getResources().getResourceTypeName(iV));
                if (zEquals) {
                    try {
                        animationLoadAnimation = AnimationUtils.loadAnimation(context, iV);
                    } catch (Resources.NotFoundException e8) {
                        throw e8;
                    } catch (RuntimeException unused) {
                        try {
                            animatorLoadAnimator = AnimatorInflater.loadAnimator(context, iV);
                            if (animatorLoadAnimator != null) {
                            }
                        } catch (RuntimeException e9) {
                            if (zEquals) {
                                throw e9;
                            }
                            Animation animationLoadAnimation2 = AnimationUtils.loadAnimation(context, iV);
                            if (animationLoadAnimation2 != null) {
                                c0853a2 = new C0853a(6, animationLoadAnimation2);
                            }
                        }
                    }
                    if (animationLoadAnimation != null) {
                        c0853a = new C0853a(6, animationLoadAnimation);
                        c0853a2 = c0853a;
                    }
                } else {
                    animatorLoadAnimator = AnimatorInflater.loadAnimator(context, iV);
                    if (animatorLoadAnimator != null) {
                        c0853a = new C0853a(animatorLoadAnimator);
                        c0853a2 = c0853a;
                    }
                }
            }
        }
        this.f13203t = c0853a2;
        this.f13202s = true;
        return c0853a2;
    }
}
