package androidx.fragment.app; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.content.Context; import android.graphics.Rect; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; import androidx.core.view.l0; import androidx.core.view.n0; import androidx.core.view.u0; import androidx.fragment.app.b0; import androidx.fragment.app.f; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import v.b; /* loaded from: classes.dex */ class c extends b0 { static /* synthetic */ class a { /* renamed from: a, reason: collision with root package name */ static final /* synthetic */ int[] f1758a; static { int[] iArr = new int[b0.e.c.values().length]; f1758a = iArr; try { iArr[b0.e.c.GONE.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { f1758a[b0.e.c.INVISIBLE.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { f1758a[b0.e.c.REMOVED.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } try { f1758a[b0.e.c.VISIBLE.ordinal()] = 4; } catch (NoSuchFieldError unused4) { } } } class b implements Runnable { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ List f1759a; /* renamed from: b, reason: collision with root package name */ final /* synthetic */ b0.e f1760b; b(List list, b0.e eVar) { this.f1759a = list; this.f1760b = eVar; } @Override // java.lang.Runnable public void run() { if (this.f1759a.contains(this.f1760b)) { this.f1759a.remove(this.f1760b); c.this.s(this.f1760b); } } } /* renamed from: androidx.fragment.app.c$c, reason: collision with other inner class name */ class C0023c extends AnimatorListenerAdapter { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ ViewGroup f1762a; /* renamed from: b, reason: collision with root package name */ final /* synthetic */ View f1763b; /* renamed from: c, reason: collision with root package name */ final /* synthetic */ boolean f1764c; /* renamed from: d, reason: collision with root package name */ final /* synthetic */ b0.e f1765d; /* renamed from: e, reason: collision with root package name */ final /* synthetic */ k f1766e; C0023c(ViewGroup viewGroup, View view, boolean z10, b0.e eVar, k kVar) { this.f1762a = viewGroup; this.f1763b = view; this.f1764c = z10; this.f1765d = eVar; this.f1766e = kVar; } @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener public void onAnimationEnd(Animator animator) { this.f1762a.endViewTransition(this.f1763b); if (this.f1764c) { this.f1765d.e().a(this.f1763b); } this.f1766e.a(); } } class d implements b.a { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ Animator f1768a; d(Animator animator) { this.f1768a = animator; } @Override // v.b.a public void a() { this.f1768a.end(); } } class e implements Animation.AnimationListener { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ ViewGroup f1770a; /* renamed from: b, reason: collision with root package name */ final /* synthetic */ View f1771b; /* renamed from: c, reason: collision with root package name */ final /* synthetic */ k f1772c; class a implements Runnable { a() { } @Override // java.lang.Runnable public void run() { e eVar = e.this; eVar.f1770a.endViewTransition(eVar.f1771b); e.this.f1772c.a(); } } e(ViewGroup viewGroup, View view, k kVar) { this.f1770a = viewGroup; this.f1771b = view; this.f1772c = kVar; } @Override // android.view.animation.Animation.AnimationListener public void onAnimationEnd(Animation animation) { this.f1770a.post(new a()); } @Override // android.view.animation.Animation.AnimationListener public void onAnimationRepeat(Animation animation) { } @Override // android.view.animation.Animation.AnimationListener public void onAnimationStart(Animation animation) { } } class f implements b.a { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ View f1775a; /* renamed from: b, reason: collision with root package name */ final /* synthetic */ ViewGroup f1776b; /* renamed from: c, reason: collision with root package name */ final /* synthetic */ k f1777c; f(View view, ViewGroup viewGroup, k kVar) { this.f1775a = view; this.f1776b = viewGroup; this.f1777c = kVar; } @Override // v.b.a public void a() { this.f1775a.clearAnimation(); this.f1776b.endViewTransition(this.f1775a); this.f1777c.a(); } } class g implements Runnable { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ b0.e f1779a; /* renamed from: b, reason: collision with root package name */ final /* synthetic */ b0.e f1780b; /* renamed from: c, reason: collision with root package name */ final /* synthetic */ boolean f1781c; /* renamed from: d, reason: collision with root package name */ final /* synthetic */ androidx.collection.a f1782d; g(b0.e eVar, b0.e eVar2, boolean z10, androidx.collection.a aVar) { this.f1779a = eVar; this.f1780b = eVar2; this.f1781c = z10; this.f1782d = aVar; } @Override // java.lang.Runnable public void run() { w.f(this.f1779a.f(), this.f1780b.f(), this.f1781c, this.f1782d, false); } } class h implements Runnable { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ y f1784a; /* renamed from: b, reason: collision with root package name */ final /* synthetic */ View f1785b; /* renamed from: c, reason: collision with root package name */ final /* synthetic */ Rect f1786c; h(y yVar, View view, Rect rect) { this.f1784a = yVar; this.f1785b = view; this.f1786c = rect; } @Override // java.lang.Runnable public void run() { this.f1784a.k(this.f1785b, this.f1786c); } } class i implements Runnable { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ ArrayList f1788a; i(ArrayList arrayList) { this.f1788a = arrayList; } @Override // java.lang.Runnable public void run() { w.A(this.f1788a, 4); } } class j implements Runnable { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ m f1790a; j(m mVar) { this.f1790a = mVar; } @Override // java.lang.Runnable public void run() { this.f1790a.a(); } } private static class k extends l { /* renamed from: c, reason: collision with root package name */ private boolean f1792c; /* renamed from: d, reason: collision with root package name */ private boolean f1793d; /* renamed from: e, reason: collision with root package name */ private f.d f1794e; k(b0.e eVar, v.b bVar, boolean z10) { super(eVar, bVar); this.f1793d = false; this.f1792c = z10; } f.d e(Context context) { if (this.f1793d) { return this.f1794e; } f.d c10 = androidx.fragment.app.f.c(context, b().f(), b().e() == b0.e.c.VISIBLE, this.f1792c); this.f1794e = c10; this.f1793d = true; return c10; } } private static class l { /* renamed from: a, reason: collision with root package name */ private final b0.e f1795a; /* renamed from: b, reason: collision with root package name */ private final v.b f1796b; l(b0.e eVar, v.b bVar) { this.f1795a = eVar; this.f1796b = bVar; } void a() { this.f1795a.d(this.f1796b); } b0.e b() { return this.f1795a; } v.b c() { return this.f1796b; } boolean d() { b0.e.c cVar; b0.e.c c10 = b0.e.c.c(this.f1795a.f().mView); b0.e.c e10 = this.f1795a.e(); return c10 == e10 || !(c10 == (cVar = b0.e.c.VISIBLE) || e10 == cVar); } } private static class m extends l { /* renamed from: c, reason: collision with root package name */ private final Object f1797c; /* renamed from: d, reason: collision with root package name */ private final boolean f1798d; /* renamed from: e, reason: collision with root package name */ private final Object f1799e; m(b0.e eVar, v.b bVar, boolean z10, boolean z11) { super(eVar, bVar); if (eVar.e() == b0.e.c.VISIBLE) { this.f1797c = z10 ? eVar.f().getReenterTransition() : eVar.f().getEnterTransition(); this.f1798d = z10 ? eVar.f().getAllowReturnTransitionOverlap() : eVar.f().getAllowEnterTransitionOverlap(); } else { this.f1797c = z10 ? eVar.f().getReturnTransition() : eVar.f().getExitTransition(); this.f1798d = true; } if (!z11) { this.f1799e = null; } else if (z10) { this.f1799e = eVar.f().getSharedElementReturnTransition(); } else { this.f1799e = eVar.f().getSharedElementEnterTransition(); } } private y f(Object obj) { if (obj == null) { return null; } y yVar = w.f1960b; if (yVar != null && yVar.e(obj)) { return yVar; } y yVar2 = w.f1961c; if (yVar2 != null && yVar2.e(obj)) { return yVar2; } throw new IllegalArgumentException("Transition " + obj + " for fragment " + b().f() + " is not a valid framework Transition or AndroidX Transition"); } y e() { y f10 = f(this.f1797c); y f11 = f(this.f1799e); if (f10 == null || f11 == null || f10 == f11) { return f10 != null ? f10 : f11; } throw new IllegalArgumentException("Mixing framework transitions and AndroidX transitions is not allowed. Fragment " + b().f() + " returned Transition " + this.f1797c + " which uses a different Transition type than its shared element transition " + this.f1799e); } public Object g() { return this.f1799e; } Object h() { return this.f1797c; } public boolean i() { return this.f1799e != null; } boolean j() { return this.f1798d; } } c(ViewGroup viewGroup) { super(viewGroup); } private void w(List list, List list2, boolean z10, Map map) { ViewGroup m10 = m(); Context context = m10.getContext(); ArrayList arrayList = new ArrayList(); Iterator it = list.iterator(); boolean z11 = false; while (it.hasNext()) { k kVar = (k) it.next(); if (kVar.d()) { kVar.a(); } else { f.d e10 = kVar.e(context); if (e10 == null) { kVar.a(); } else { Animator animator = e10.f1821b; if (animator == null) { arrayList.add(kVar); } else { b0.e b10 = kVar.b(); Fragment f10 = b10.f(); if (Boolean.TRUE.equals(map.get(b10))) { if (n.E0(2)) { Log.v("FragmentManager", "Ignoring Animator set on " + f10 + " as this Fragment was involved in a Transition."); } kVar.a(); } else { boolean z12 = b10.e() == b0.e.c.GONE; if (z12) { list2.remove(b10); } View view = f10.mView; m10.startViewTransition(view); animator.addListener(new C0023c(m10, view, z12, b10, kVar)); animator.setTarget(view); animator.start(); kVar.c().c(new d(animator)); z11 = true; } } } } } Iterator it2 = arrayList.iterator(); while (it2.hasNext()) { k kVar2 = (k) it2.next(); b0.e b11 = kVar2.b(); Fragment f11 = b11.f(); if (z10) { if (n.E0(2)) { Log.v("FragmentManager", "Ignoring Animation set on " + f11 + " as Animations cannot run alongside Transitions."); } kVar2.a(); } else if (z11) { if (n.E0(2)) { Log.v("FragmentManager", "Ignoring Animation set on " + f11 + " as Animations cannot run alongside Animators."); } kVar2.a(); } else { View view2 = f11.mView; Animation animation = (Animation) y.h.e(((f.d) y.h.e(kVar2.e(context))).f1820a); if (b11.e() != b0.e.c.REMOVED) { view2.startAnimation(animation); kVar2.a(); } else { m10.startViewTransition(view2); f.e eVar = new f.e(animation, m10, view2); eVar.setAnimationListener(new e(m10, view2, kVar2)); view2.startAnimation(eVar); } kVar2.c().c(new f(view2, m10, kVar2)); } } } private Map x(List list, List list2, boolean z10, b0.e eVar, b0.e eVar2) { View view; Object obj; ArrayList arrayList; Object obj2; ArrayList arrayList2; b0.e eVar3; b0.e eVar4; View view2; Object n10; androidx.collection.a aVar; ArrayList arrayList3; b0.e eVar5; ArrayList arrayList4; Rect rect; View view3; y yVar; b0.e eVar6; View view4; boolean z11 = z10; b0.e eVar7 = eVar; b0.e eVar8 = eVar2; HashMap hashMap = new HashMap(); Iterator it = list.iterator(); y yVar2 = null; while (it.hasNext()) { m mVar = (m) it.next(); if (!mVar.d()) { y e10 = mVar.e(); if (yVar2 == null) { yVar2 = e10; } else if (e10 != null && yVar2 != e10) { throw new IllegalArgumentException("Mixing framework transitions and AndroidX transitions is not allowed. Fragment " + mVar.b().f() + " returned Transition " + mVar.h() + " which uses a different Transition type than other Fragments."); } } } if (yVar2 == null) { Iterator it2 = list.iterator(); while (it2.hasNext()) { m mVar2 = (m) it2.next(); hashMap.put(mVar2.b(), Boolean.FALSE); mVar2.a(); } return hashMap; } View view5 = new View(m().getContext()); Rect rect2 = new Rect(); ArrayList arrayList5 = new ArrayList(); ArrayList arrayList6 = new ArrayList(); androidx.collection.a aVar2 = new androidx.collection.a(); Iterator it3 = list.iterator(); Object obj3 = null; View view6 = null; boolean z12 = false; while (it3.hasNext()) { m mVar3 = (m) it3.next(); if (!mVar3.i() || eVar7 == null || eVar8 == null) { aVar = aVar2; arrayList3 = arrayList6; eVar5 = eVar7; arrayList4 = arrayList5; rect = rect2; view3 = view5; yVar = yVar2; eVar6 = eVar8; view6 = view6; } else { Object B = yVar2.B(yVar2.g(mVar3.g())); ArrayList sharedElementSourceNames = eVar2.f().getSharedElementSourceNames(); ArrayList sharedElementSourceNames2 = eVar.f().getSharedElementSourceNames(); ArrayList sharedElementTargetNames = eVar.f().getSharedElementTargetNames(); View view7 = view6; int i10 = 0; while (i10 < sharedElementTargetNames.size()) { int indexOf = sharedElementSourceNames.indexOf(sharedElementTargetNames.get(i10)); ArrayList arrayList7 = sharedElementTargetNames; if (indexOf != -1) { sharedElementSourceNames.set(indexOf, sharedElementSourceNames2.get(i10)); } i10++; sharedElementTargetNames = arrayList7; } ArrayList sharedElementTargetNames2 = eVar2.f().getSharedElementTargetNames(); if (z11) { eVar.f().getEnterTransitionCallback(); eVar2.f().getExitTransitionCallback(); } else { eVar.f().getExitTransitionCallback(); eVar2.f().getEnterTransitionCallback(); } int i11 = 0; for (int size = sharedElementSourceNames.size(); i11 < size; size = size) { aVar2.put(sharedElementSourceNames.get(i11), sharedElementTargetNames2.get(i11)); i11++; } androidx.collection.a aVar3 = new androidx.collection.a(); u(aVar3, eVar.f().mView); aVar3.o(sharedElementSourceNames); aVar2.o(aVar3.keySet()); androidx.collection.a aVar4 = new androidx.collection.a(); u(aVar4, eVar2.f().mView); aVar4.o(sharedElementTargetNames2); aVar4.o(aVar2.values()); w.x(aVar2, aVar4); v(aVar3, aVar2.keySet()); v(aVar4, aVar2.values()); if (aVar2.isEmpty()) { arrayList5.clear(); arrayList6.clear(); aVar = aVar2; arrayList3 = arrayList6; eVar5 = eVar7; arrayList4 = arrayList5; rect = rect2; view3 = view5; yVar = yVar2; view6 = view7; obj3 = null; eVar6 = eVar8; } else { w.f(eVar2.f(), eVar.f(), z11, aVar3, true); aVar = aVar2; ArrayList arrayList8 = arrayList6; l0.a(m(), new g(eVar2, eVar, z10, aVar4)); arrayList5.addAll(aVar3.values()); if (sharedElementSourceNames.isEmpty()) { view6 = view7; } else { View view8 = (View) aVar3.get((String) sharedElementSourceNames.get(0)); yVar2.v(B, view8); view6 = view8; } arrayList3 = arrayList8; arrayList3.addAll(aVar4.values()); if (!sharedElementTargetNames2.isEmpty() && (view4 = (View) aVar4.get((String) sharedElementTargetNames2.get(0))) != null) { l0.a(m(), new h(yVar2, view4, rect2)); z12 = true; } yVar2.z(B, view5, arrayList5); arrayList4 = arrayList5; rect = rect2; view3 = view5; yVar = yVar2; yVar2.t(B, null, null, null, null, B, arrayList3); Boolean bool = Boolean.TRUE; eVar5 = eVar; hashMap.put(eVar5, bool); eVar6 = eVar2; hashMap.put(eVar6, bool); obj3 = B; } } eVar7 = eVar5; arrayList5 = arrayList4; rect2 = rect; view5 = view3; eVar8 = eVar6; aVar2 = aVar; z11 = z10; arrayList6 = arrayList3; yVar2 = yVar; } View view9 = view6; androidx.collection.a aVar5 = aVar2; ArrayList arrayList9 = arrayList6; b0.e eVar9 = eVar7; ArrayList arrayList10 = arrayList5; Rect rect3 = rect2; View view10 = view5; y yVar3 = yVar2; b0.e eVar10 = eVar8; ArrayList arrayList11 = new ArrayList(); Iterator it4 = list.iterator(); Object obj4 = null; Object obj5 = null; while (it4.hasNext()) { m mVar4 = (m) it4.next(); if (mVar4.d()) { hashMap.put(mVar4.b(), Boolean.FALSE); mVar4.a(); } else { Object g10 = yVar3.g(mVar4.h()); b0.e b10 = mVar4.b(); boolean z13 = obj3 != null && (b10 == eVar9 || b10 == eVar10); if (g10 == null) { if (!z13) { hashMap.put(b10, Boolean.FALSE); mVar4.a(); } arrayList2 = arrayList9; arrayList = arrayList10; view = view10; n10 = obj4; eVar3 = eVar10; view2 = view9; } else { ArrayList arrayList12 = new ArrayList(); Object obj6 = obj4; t(arrayList12, b10.f().mView); if (z13) { if (b10 == eVar9) { arrayList12.removeAll(arrayList10); } else { arrayList12.removeAll(arrayList9); } } if (arrayList12.isEmpty()) { yVar3.a(g10, view10); arrayList2 = arrayList9; arrayList = arrayList10; view = view10; eVar4 = b10; obj2 = obj5; eVar3 = eVar10; obj = obj6; } else { yVar3.b(g10, arrayList12); view = view10; obj = obj6; arrayList = arrayList10; obj2 = obj5; arrayList2 = arrayList9; eVar3 = eVar10; yVar3.t(g10, g10, arrayList12, null, null, null, null); if (b10.e() == b0.e.c.GONE) { eVar4 = b10; list2.remove(eVar4); ArrayList arrayList13 = new ArrayList(arrayList12); arrayList13.remove(eVar4.f().mView); yVar3.r(g10, eVar4.f().mView, arrayList13); l0.a(m(), new i(arrayList12)); } else { eVar4 = b10; } } if (eVar4.e() == b0.e.c.VISIBLE) { arrayList11.addAll(arrayList12); if (z12) { yVar3.u(g10, rect3); } view2 = view9; } else { view2 = view9; yVar3.v(g10, view2); } hashMap.put(eVar4, Boolean.TRUE); if (mVar4.j()) { obj5 = yVar3.n(obj2, g10, null); n10 = obj; } else { n10 = yVar3.n(obj, g10, null); obj5 = obj2; } } eVar10 = eVar3; obj4 = n10; view9 = view2; view10 = view; arrayList10 = arrayList; arrayList9 = arrayList2; } } ArrayList arrayList14 = arrayList9; ArrayList arrayList15 = arrayList10; b0.e eVar11 = eVar10; Object m10 = yVar3.m(obj5, obj4, obj3); Iterator it5 = list.iterator(); while (it5.hasNext()) { m mVar5 = (m) it5.next(); if (!mVar5.d()) { Object h10 = mVar5.h(); b0.e b11 = mVar5.b(); boolean z14 = obj3 != null && (b11 == eVar9 || b11 == eVar11); if (h10 != null || z14) { if (n0.R(m())) { yVar3.w(mVar5.b().f(), m10, mVar5.c(), new j(mVar5)); } else { if (n.E0(2)) { Log.v("FragmentManager", "SpecialEffectsController: Container " + m() + " has not been laid out. Completing operation " + b11); } mVar5.a(); } } } } if (!n0.R(m())) { return hashMap; } w.A(arrayList11, 4); ArrayList o10 = yVar3.o(arrayList14); yVar3.c(m(), m10); yVar3.y(m(), arrayList15, arrayList14, o10, aVar5); w.A(arrayList11, 0); yVar3.A(obj3, arrayList15, arrayList14); return hashMap; } @Override // androidx.fragment.app.b0 void f(List list, boolean z10) { Iterator it = list.iterator(); b0.e eVar = null; b0.e eVar2 = null; while (it.hasNext()) { b0.e eVar3 = (b0.e) it.next(); b0.e.c c10 = b0.e.c.c(eVar3.f().mView); int i10 = a.f1758a[eVar3.e().ordinal()]; if (i10 == 1 || i10 == 2 || i10 == 3) { if (c10 == b0.e.c.VISIBLE && eVar == null) { eVar = eVar3; } } else if (i10 == 4 && c10 != b0.e.c.VISIBLE) { eVar2 = eVar3; } } ArrayList arrayList = new ArrayList(); ArrayList arrayList2 = new ArrayList(); ArrayList arrayList3 = new ArrayList(list); Iterator it2 = list.iterator(); while (it2.hasNext()) { b0.e eVar4 = (b0.e) it2.next(); v.b bVar = new v.b(); eVar4.j(bVar); arrayList.add(new k(eVar4, bVar, z10)); v.b bVar2 = new v.b(); eVar4.j(bVar2); boolean z11 = false; if (z10) { if (eVar4 != eVar) { arrayList2.add(new m(eVar4, bVar2, z10, z11)); eVar4.a(new b(arrayList3, eVar4)); } z11 = true; arrayList2.add(new m(eVar4, bVar2, z10, z11)); eVar4.a(new b(arrayList3, eVar4)); } else { if (eVar4 != eVar2) { arrayList2.add(new m(eVar4, bVar2, z10, z11)); eVar4.a(new b(arrayList3, eVar4)); } z11 = true; arrayList2.add(new m(eVar4, bVar2, z10, z11)); eVar4.a(new b(arrayList3, eVar4)); } } Map x10 = x(arrayList2, arrayList3, z10, eVar, eVar2); w(arrayList, arrayList3, x10.containsValue(Boolean.TRUE), x10); Iterator it3 = arrayList3.iterator(); while (it3.hasNext()) { s((b0.e) it3.next()); } arrayList3.clear(); } void s(b0.e eVar) { eVar.e().a(eVar.f().mView); } void t(ArrayList arrayList, View view) { if (!(view instanceof ViewGroup)) { if (arrayList.contains(view)) { return; } arrayList.add(view); return; } ViewGroup viewGroup = (ViewGroup) view; if (u0.a(viewGroup)) { if (arrayList.contains(view)) { return; } arrayList.add(viewGroup); return; } int childCount = viewGroup.getChildCount(); for (int i10 = 0; i10 < childCount; i10++) { View childAt = viewGroup.getChildAt(i10); if (childAt.getVisibility() == 0) { t(arrayList, childAt); } } } void u(Map map, View view) { String J = n0.J(view); if (J != null) { map.put(J, view); } if (view instanceof ViewGroup) { ViewGroup viewGroup = (ViewGroup) view; int childCount = viewGroup.getChildCount(); for (int i10 = 0; i10 < childCount; i10++) { View childAt = viewGroup.getChildAt(i10); if (childAt.getVisibility() == 0) { u(map, childAt); } } } } void v(androidx.collection.a aVar, Collection collection) { Iterator it = aVar.entrySet().iterator(); while (it.hasNext()) { if (!collection.contains(n0.J((View) ((Map.Entry) it.next()).getValue()))) { it.remove(); } } } }