package androidx.fragment.app; import android.animation.Animator; import android.animation.AnimatorInflater; import android.animation.AnimatorListenerAdapter; import android.content.Context; import android.content.res.Resources; import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.view.animation.Transformation; import androidx.fragment.app.C0379v; import p011d0.C0605h; import p023h0.ViewTreeObserver$OnPreDrawListenerC0801d1; import p047p0.C1534a; import p047p0.C1535b; /* renamed from: androidx.fragment.app.e */ /* loaded from: classes.dex */ public class C0301e { /* renamed from: androidx.fragment.app.e$a */ /* loaded from: classes.dex */ public class C0302a implements C0605h.InterfaceC0607b { /* renamed from: a */ public final /* synthetic */ Fragment f1303a; public C0302a(Fragment fragment) { this.f1303a = fragment; } @Override // p011d0.C0605h.InterfaceC0607b public void onCancel() { if (this.f1303a.m4204n() != null) { View m4204n = this.f1303a.m4204n(); this.f1303a.m4202n1(null); m4204n.clearAnimation(); } this.f1303a.m4196p1(null); } } /* renamed from: androidx.fragment.app.e$b reason: invalid class name */ /* loaded from: classes.dex */ public class animationAnimation$AnimationListenerC0303b implements Animation.AnimationListener { /* renamed from: a */ public final /* synthetic */ ViewGroup f1304a; /* renamed from: b */ public final /* synthetic */ Fragment f1305b; /* renamed from: c */ public final /* synthetic */ C0379v.InterfaceC0386g f1306c; /* renamed from: d */ public final /* synthetic */ C0605h f1307d; /* renamed from: androidx.fragment.app.e$b$a */ /* loaded from: classes.dex */ public class RunnableC0304a implements Runnable { public RunnableC0304a() { } @Override // java.lang.Runnable public void run() { if (animationAnimation$AnimationListenerC0303b.this.f1305b.m4204n() != null) { animationAnimation$AnimationListenerC0303b.this.f1305b.m4202n1(null); animationAnimation$AnimationListenerC0303b animationanimation_animationlistenerc0303b = animationAnimation$AnimationListenerC0303b.this; animationanimation_animationlistenerc0303b.f1306c.mo3758a(animationanimation_animationlistenerc0303b.f1305b, animationanimation_animationlistenerc0303b.f1307d); } } } public animationAnimation$AnimationListenerC0303b(ViewGroup viewGroup, Fragment fragment, C0379v.InterfaceC0386g interfaceC0386g, C0605h c0605h) { this.f1304a = viewGroup; this.f1305b = fragment; this.f1306c = interfaceC0386g; this.f1307d = c0605h; } @Override // android.view.animation.Animation.AnimationListener public void onAnimationEnd(Animation animation) { this.f1304a.post(new RunnableC0304a()); } @Override // android.view.animation.Animation.AnimationListener public void onAnimationRepeat(Animation animation) { } @Override // android.view.animation.Animation.AnimationListener public void onAnimationStart(Animation animation) { } } /* renamed from: androidx.fragment.app.e$c */ /* loaded from: classes.dex */ public class C0305c extends AnimatorListenerAdapter { /* renamed from: a */ public final /* synthetic */ ViewGroup f1309a; /* renamed from: b */ public final /* synthetic */ View f1310b; /* renamed from: c */ public final /* synthetic */ Fragment f1311c; /* renamed from: d */ public final /* synthetic */ C0379v.InterfaceC0386g f1312d; /* renamed from: e */ public final /* synthetic */ C0605h f1313e; public C0305c(ViewGroup viewGroup, View view, Fragment fragment, C0379v.InterfaceC0386g interfaceC0386g, C0605h c0605h) { this.f1309a = viewGroup; this.f1310b = view; this.f1311c = fragment; this.f1312d = interfaceC0386g; this.f1313e = c0605h; } @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener public void onAnimationEnd(Animator animator) { this.f1309a.endViewTransition(this.f1310b); Animator m4201o = this.f1311c.m4201o(); this.f1311c.m4196p1(null); if (m4201o == null || this.f1309a.indexOfChild(this.f1310b) >= 0) { return; } this.f1312d.mo3758a(this.f1311c, this.f1313e); } } /* renamed from: androidx.fragment.app.e$d */ /* loaded from: classes.dex */ public static class C0306d { /* renamed from: a */ public final Animation f1314a; /* renamed from: b */ public final Animator f1315b; public C0306d(Animator animator) { this.f1314a = null; this.f1315b = animator; if (animator == null) { throw new IllegalStateException("Animator cannot be null"); } } public C0306d(Animation animation) { this.f1314a = animation; this.f1315b = null; if (animation == null) { throw new IllegalStateException("Animation cannot be null"); } } } /* renamed from: androidx.fragment.app.e$e */ /* loaded from: classes.dex */ public static class RunnableC0307e extends AnimationSet implements Runnable { /* renamed from: d */ public final ViewGroup f1316d; /* renamed from: e */ public final View f1317e; /* renamed from: f */ public boolean f1318f; /* renamed from: g */ public boolean f1319g; /* renamed from: h */ public boolean f1320h; public RunnableC0307e(Animation animation, ViewGroup viewGroup, View view) { super(false); this.f1320h = true; this.f1316d = viewGroup; this.f1317e = view; addAnimation(animation); viewGroup.post(this); } @Override // android.view.animation.AnimationSet, android.view.animation.Animation public boolean getTransformation(long j, Transformation transformation) { this.f1320h = true; if (this.f1318f) { return !this.f1319g; } if (!super.getTransformation(j, transformation)) { this.f1318f = true; ViewTreeObserver$OnPreDrawListenerC0801d1.m2889a(this.f1316d, this); } return true; } @Override // android.view.animation.Animation public boolean getTransformation(long j, Transformation transformation, float f) { this.f1320h = true; if (this.f1318f) { return !this.f1319g; } if (!super.getTransformation(j, transformation, f)) { this.f1318f = true; ViewTreeObserver$OnPreDrawListenerC0801d1.m2889a(this.f1316d, this); } return true; } @Override // java.lang.Runnable public void run() { if (this.f1318f || !this.f1320h) { this.f1316d.endViewTransition(this.f1317e); this.f1319g = true; return; } this.f1320h = false; this.f1316d.post(this); } } /* renamed from: a */ public static void m4116a(Fragment fragment, C0306d c0306d, C0379v.InterfaceC0386g interfaceC0386g) { View view = fragment.f1162K; ViewGroup viewGroup = fragment.f1161J; viewGroup.startViewTransition(view); C0605h c0605h = new C0605h(); c0605h.m3279c(new C0302a(fragment)); interfaceC0386g.mo3757b(fragment, c0605h); if (c0306d.f1314a != null) { RunnableC0307e runnableC0307e = new RunnableC0307e(c0306d.f1314a, viewGroup, view); fragment.m4202n1(fragment.f1162K); runnableC0307e.setAnimationListener(new animationAnimation$AnimationListenerC0303b(viewGroup, fragment, interfaceC0386g, c0605h)); fragment.f1162K.startAnimation(runnableC0307e); return; } Animator animator = c0306d.f1315b; fragment.m4196p1(animator); animator.addListener(new C0305c(viewGroup, view, fragment, interfaceC0386g, c0605h)); animator.setTarget(fragment.f1162K); animator.start(); } /* renamed from: b */ public static int m4115b(Fragment fragment, boolean z, boolean z2) { return z2 ? z ? fragment.m4280F() : fragment.m4278G() : z ? fragment.m4192r() : fragment.m4183u(); } /* renamed from: c */ public static C0306d m4114c(Context context, Fragment fragment, boolean z, boolean z2) { int m4288B = fragment.m4288B(); int m4115b = m4115b(fragment, z, z2); boolean z3 = false; fragment.m4199o1(0, 0, 0, 0); ViewGroup viewGroup = fragment.f1161J; if (viewGroup != null) { int i = C1535b.visible_removing_fragment_view_tag; if (viewGroup.getTag(i) != null) { fragment.f1161J.setTag(i, null); } } ViewGroup viewGroup2 = fragment.f1161J; if (viewGroup2 == null || viewGroup2.getLayoutTransition() == null) { Animation m4215j0 = fragment.m4215j0(m4288B, z, m4115b); if (m4215j0 != null) { return new C0306d(m4215j0); } Animator m4212k0 = fragment.m4212k0(m4288B, z, m4115b); if (m4212k0 != null) { return new C0306d(m4212k0); } if (m4115b == 0 && m4288B != 0) { m4115b = m4113d(m4288B, z); } if (m4115b != 0) { boolean equals = "anim".equals(context.getResources().getResourceTypeName(m4115b)); if (equals) { try { Animation loadAnimation = AnimationUtils.loadAnimation(context, m4115b); if (loadAnimation != null) { return new C0306d(loadAnimation); } z3 = true; } catch (Resources.NotFoundException e) { throw e; } catch (RuntimeException unused) { } } if (!z3) { try { Animator loadAnimator = AnimatorInflater.loadAnimator(context, m4115b); if (loadAnimator != null) { return new C0306d(loadAnimator); } } catch (RuntimeException e2) { if (equals) { throw e2; } Animation loadAnimation2 = AnimationUtils.loadAnimation(context, m4115b); if (loadAnimation2 != null) { return new C0306d(loadAnimation2); } } } } return null; } return null; } /* renamed from: d */ public static int m4113d(int i, boolean z) { if (i == 4097) { return z ? C1534a.fragment_open_enter : C1534a.fragment_open_exit; } else if (i == 4099) { return z ? C1534a.fragment_fade_enter : C1534a.fragment_fade_exit; } else if (i != 8194) { return -1; } else { return z ? C1534a.fragment_close_enter : C1534a.fragment_close_exit; } } }