825 lines
42 KiB
Java
825 lines
42 KiB
Java
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.collection.ArrayMap;
|
|
import androidx.core.app.SharedElementCallback;
|
|
import androidx.core.os.CancellationSignal;
|
|
import androidx.core.util.Preconditions;
|
|
import androidx.core.view.OneShotPreDrawListener;
|
|
import androidx.core.view.ViewCompat;
|
|
import androidx.core.view.ViewGroupCompat;
|
|
import androidx.fragment.app.FragmentAnim;
|
|
import androidx.fragment.app.SpecialEffectsController;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/* loaded from: classes.dex */
|
|
class DefaultSpecialEffectsController extends SpecialEffectsController {
|
|
DefaultSpecialEffectsController(ViewGroup viewGroup) {
|
|
super(viewGroup);
|
|
}
|
|
|
|
@Override // androidx.fragment.app.SpecialEffectsController
|
|
void executeOperations(List<SpecialEffectsController.Operation> list, boolean z) {
|
|
SpecialEffectsController.Operation operation = null;
|
|
SpecialEffectsController.Operation operation2 = null;
|
|
for (SpecialEffectsController.Operation operation3 : list) {
|
|
SpecialEffectsController.Operation.State from = SpecialEffectsController.Operation.State.from(operation3.getFragment().mView);
|
|
int i = AnonymousClass10.$SwitchMap$androidx$fragment$app$SpecialEffectsController$Operation$State[operation3.getFinalState().ordinal()];
|
|
if (i == 1 || i == 2 || i == 3) {
|
|
if (from == SpecialEffectsController.Operation.State.VISIBLE && operation == null) {
|
|
operation = operation3;
|
|
}
|
|
} else if (i == 4 && from != SpecialEffectsController.Operation.State.VISIBLE) {
|
|
operation2 = operation3;
|
|
}
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
ArrayList arrayList2 = new ArrayList();
|
|
final ArrayList arrayList3 = new ArrayList(list);
|
|
for (final SpecialEffectsController.Operation operation4 : list) {
|
|
CancellationSignal cancellationSignal = new CancellationSignal();
|
|
operation4.markStartedSpecialEffect(cancellationSignal);
|
|
arrayList.add(new AnimationInfo(operation4, cancellationSignal, z));
|
|
CancellationSignal cancellationSignal2 = new CancellationSignal();
|
|
operation4.markStartedSpecialEffect(cancellationSignal2);
|
|
boolean z2 = false;
|
|
if (z) {
|
|
if (operation4 != operation) {
|
|
arrayList2.add(new TransitionInfo(operation4, cancellationSignal2, z, z2));
|
|
operation4.addCompletionListener(new Runnable() { // from class: androidx.fragment.app.DefaultSpecialEffectsController.1
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (arrayList3.contains(operation4)) {
|
|
arrayList3.remove(operation4);
|
|
DefaultSpecialEffectsController.this.applyContainerChanges(operation4);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
z2 = true;
|
|
arrayList2.add(new TransitionInfo(operation4, cancellationSignal2, z, z2));
|
|
operation4.addCompletionListener(new Runnable() { // from class: androidx.fragment.app.DefaultSpecialEffectsController.1
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (arrayList3.contains(operation4)) {
|
|
arrayList3.remove(operation4);
|
|
DefaultSpecialEffectsController.this.applyContainerChanges(operation4);
|
|
}
|
|
}
|
|
});
|
|
} else {
|
|
if (operation4 != operation2) {
|
|
arrayList2.add(new TransitionInfo(operation4, cancellationSignal2, z, z2));
|
|
operation4.addCompletionListener(new Runnable() { // from class: androidx.fragment.app.DefaultSpecialEffectsController.1
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (arrayList3.contains(operation4)) {
|
|
arrayList3.remove(operation4);
|
|
DefaultSpecialEffectsController.this.applyContainerChanges(operation4);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
z2 = true;
|
|
arrayList2.add(new TransitionInfo(operation4, cancellationSignal2, z, z2));
|
|
operation4.addCompletionListener(new Runnable() { // from class: androidx.fragment.app.DefaultSpecialEffectsController.1
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (arrayList3.contains(operation4)) {
|
|
arrayList3.remove(operation4);
|
|
DefaultSpecialEffectsController.this.applyContainerChanges(operation4);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
Map<SpecialEffectsController.Operation, Boolean> startTransitions = startTransitions(arrayList2, arrayList3, z, operation, operation2);
|
|
startAnimations(arrayList, arrayList3, startTransitions.containsValue(true), startTransitions);
|
|
Iterator<SpecialEffectsController.Operation> it = arrayList3.iterator();
|
|
while (it.hasNext()) {
|
|
applyContainerChanges(it.next());
|
|
}
|
|
arrayList3.clear();
|
|
}
|
|
|
|
/* renamed from: androidx.fragment.app.DefaultSpecialEffectsController$10, reason: invalid class name */
|
|
static /* synthetic */ class AnonymousClass10 {
|
|
static final /* synthetic */ int[] $SwitchMap$androidx$fragment$app$SpecialEffectsController$Operation$State;
|
|
|
|
static {
|
|
int[] iArr = new int[SpecialEffectsController.Operation.State.values().length];
|
|
$SwitchMap$androidx$fragment$app$SpecialEffectsController$Operation$State = iArr;
|
|
try {
|
|
iArr[SpecialEffectsController.Operation.State.GONE.ordinal()] = 1;
|
|
} catch (NoSuchFieldError unused) {
|
|
}
|
|
try {
|
|
$SwitchMap$androidx$fragment$app$SpecialEffectsController$Operation$State[SpecialEffectsController.Operation.State.INVISIBLE.ordinal()] = 2;
|
|
} catch (NoSuchFieldError unused2) {
|
|
}
|
|
try {
|
|
$SwitchMap$androidx$fragment$app$SpecialEffectsController$Operation$State[SpecialEffectsController.Operation.State.REMOVED.ordinal()] = 3;
|
|
} catch (NoSuchFieldError unused3) {
|
|
}
|
|
try {
|
|
$SwitchMap$androidx$fragment$app$SpecialEffectsController$Operation$State[SpecialEffectsController.Operation.State.VISIBLE.ordinal()] = 4;
|
|
} catch (NoSuchFieldError unused4) {
|
|
}
|
|
}
|
|
}
|
|
|
|
private void startAnimations(List<AnimationInfo> list, List<SpecialEffectsController.Operation> list2, boolean z, Map<SpecialEffectsController.Operation, Boolean> map) {
|
|
final ViewGroup container = getContainer();
|
|
Context context = container.getContext();
|
|
ArrayList arrayList = new ArrayList();
|
|
boolean z2 = false;
|
|
for (final AnimationInfo animationInfo : list) {
|
|
if (animationInfo.isVisibilityUnchanged()) {
|
|
animationInfo.completeSpecialEffect();
|
|
} else {
|
|
FragmentAnim.AnimationOrAnimator animation = animationInfo.getAnimation(context);
|
|
if (animation == null) {
|
|
animationInfo.completeSpecialEffect();
|
|
} else {
|
|
final Animator animator = animation.animator;
|
|
if (animator == null) {
|
|
arrayList.add(animationInfo);
|
|
} else {
|
|
final SpecialEffectsController.Operation operation = animationInfo.getOperation();
|
|
Fragment fragment = operation.getFragment();
|
|
if (Boolean.TRUE.equals(map.get(operation))) {
|
|
if (FragmentManager.isLoggingEnabled(2)) {
|
|
Log.v("FragmentManager", "Ignoring Animator set on " + fragment + " as this Fragment was involved in a Transition.");
|
|
}
|
|
animationInfo.completeSpecialEffect();
|
|
} else {
|
|
final boolean z3 = operation.getFinalState() == SpecialEffectsController.Operation.State.GONE;
|
|
if (z3) {
|
|
list2.remove(operation);
|
|
}
|
|
final View view = fragment.mView;
|
|
container.startViewTransition(view);
|
|
animator.addListener(new AnimatorListenerAdapter() { // from class: androidx.fragment.app.DefaultSpecialEffectsController.2
|
|
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
|
public void onAnimationEnd(Animator animator2) {
|
|
container.endViewTransition(view);
|
|
if (z3) {
|
|
operation.getFinalState().applyState(view);
|
|
}
|
|
animationInfo.completeSpecialEffect();
|
|
}
|
|
});
|
|
animator.setTarget(view);
|
|
animator.start();
|
|
animationInfo.getSignal().setOnCancelListener(new CancellationSignal.OnCancelListener() { // from class: androidx.fragment.app.DefaultSpecialEffectsController.3
|
|
@Override // androidx.core.os.CancellationSignal.OnCancelListener
|
|
public void onCancel() {
|
|
animator.end();
|
|
}
|
|
});
|
|
z2 = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Iterator it = arrayList.iterator();
|
|
while (it.hasNext()) {
|
|
final AnimationInfo animationInfo2 = (AnimationInfo) it.next();
|
|
SpecialEffectsController.Operation operation2 = animationInfo2.getOperation();
|
|
Fragment fragment2 = operation2.getFragment();
|
|
if (z) {
|
|
if (FragmentManager.isLoggingEnabled(2)) {
|
|
Log.v("FragmentManager", "Ignoring Animation set on " + fragment2 + " as Animations cannot run alongside Transitions.");
|
|
}
|
|
animationInfo2.completeSpecialEffect();
|
|
} else if (z2) {
|
|
if (FragmentManager.isLoggingEnabled(2)) {
|
|
Log.v("FragmentManager", "Ignoring Animation set on " + fragment2 + " as Animations cannot run alongside Animators.");
|
|
}
|
|
animationInfo2.completeSpecialEffect();
|
|
} else {
|
|
final View view2 = fragment2.mView;
|
|
Animation animation2 = (Animation) Preconditions.checkNotNull(((FragmentAnim.AnimationOrAnimator) Preconditions.checkNotNull(animationInfo2.getAnimation(context))).animation);
|
|
if (operation2.getFinalState() != SpecialEffectsController.Operation.State.REMOVED) {
|
|
view2.startAnimation(animation2);
|
|
animationInfo2.completeSpecialEffect();
|
|
} else {
|
|
container.startViewTransition(view2);
|
|
FragmentAnim.EndViewTransitionAnimation endViewTransitionAnimation = new FragmentAnim.EndViewTransitionAnimation(animation2, container, view2);
|
|
endViewTransitionAnimation.setAnimationListener(new Animation.AnimationListener() { // from class: androidx.fragment.app.DefaultSpecialEffectsController.4
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public void onAnimationRepeat(Animation animation3) {
|
|
}
|
|
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public void onAnimationStart(Animation animation3) {
|
|
}
|
|
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public void onAnimationEnd(Animation animation3) {
|
|
container.post(new Runnable() { // from class: androidx.fragment.app.DefaultSpecialEffectsController.4.1
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
container.endViewTransition(view2);
|
|
animationInfo2.completeSpecialEffect();
|
|
}
|
|
});
|
|
}
|
|
});
|
|
view2.startAnimation(endViewTransitionAnimation);
|
|
}
|
|
animationInfo2.getSignal().setOnCancelListener(new CancellationSignal.OnCancelListener() { // from class: androidx.fragment.app.DefaultSpecialEffectsController.5
|
|
@Override // androidx.core.os.CancellationSignal.OnCancelListener
|
|
public void onCancel() {
|
|
view2.clearAnimation();
|
|
container.endViewTransition(view2);
|
|
animationInfo2.completeSpecialEffect();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
private Map<SpecialEffectsController.Operation, Boolean> startTransitions(List<TransitionInfo> list, List<SpecialEffectsController.Operation> list2, final boolean z, final SpecialEffectsController.Operation operation, final SpecialEffectsController.Operation operation2) {
|
|
Iterator<TransitionInfo> it;
|
|
View view;
|
|
Object obj;
|
|
ArrayList<View> arrayList;
|
|
Object obj2;
|
|
ArrayList<View> arrayList2;
|
|
HashMap hashMap;
|
|
SpecialEffectsController.Operation operation3;
|
|
View view2;
|
|
Object mergeTransitionsTogether;
|
|
ArrayMap arrayMap;
|
|
SpecialEffectsController.Operation operation4;
|
|
FragmentTransitionImpl fragmentTransitionImpl;
|
|
ArrayList<View> arrayList3;
|
|
HashMap hashMap2;
|
|
Rect rect;
|
|
SpecialEffectsController.Operation operation5;
|
|
View view3;
|
|
ArrayList<View> arrayList4;
|
|
DefaultSpecialEffectsController defaultSpecialEffectsController;
|
|
SharedElementCallback enterTransitionCallback;
|
|
SharedElementCallback exitTransitionCallback;
|
|
ArrayList<String> arrayList5;
|
|
int i;
|
|
View view4;
|
|
final View view5;
|
|
String findKeyForValue;
|
|
ArrayList<String> arrayList6;
|
|
DefaultSpecialEffectsController defaultSpecialEffectsController2 = this;
|
|
boolean z2 = z;
|
|
SpecialEffectsController.Operation operation6 = operation;
|
|
SpecialEffectsController.Operation operation7 = operation2;
|
|
HashMap hashMap3 = new HashMap();
|
|
final FragmentTransitionImpl fragmentTransitionImpl2 = null;
|
|
for (TransitionInfo transitionInfo : list) {
|
|
if (!transitionInfo.isVisibilityUnchanged()) {
|
|
FragmentTransitionImpl handlingImpl = transitionInfo.getHandlingImpl();
|
|
if (fragmentTransitionImpl2 == null) {
|
|
fragmentTransitionImpl2 = handlingImpl;
|
|
} else if (handlingImpl != null && fragmentTransitionImpl2 != handlingImpl) {
|
|
throw new IllegalArgumentException("Mixing framework transitions and AndroidX transitions is not allowed. Fragment " + transitionInfo.getOperation().getFragment() + " returned Transition " + transitionInfo.getTransition() + " which uses a different Transition type than other Fragments.");
|
|
}
|
|
}
|
|
}
|
|
if (fragmentTransitionImpl2 == null) {
|
|
for (TransitionInfo transitionInfo2 : list) {
|
|
hashMap3.put(transitionInfo2.getOperation(), false);
|
|
transitionInfo2.completeSpecialEffect();
|
|
}
|
|
return hashMap3;
|
|
}
|
|
View view6 = new View(getContainer().getContext());
|
|
final Rect rect2 = new Rect();
|
|
ArrayList<View> arrayList7 = new ArrayList<>();
|
|
ArrayList<View> arrayList8 = new ArrayList<>();
|
|
ArrayMap arrayMap2 = new ArrayMap();
|
|
Object obj3 = null;
|
|
View view7 = null;
|
|
boolean z3 = false;
|
|
for (TransitionInfo transitionInfo3 : list) {
|
|
if (!transitionInfo3.hasSharedElementTransition() || operation6 == null || operation7 == null) {
|
|
arrayMap = arrayMap2;
|
|
operation4 = operation7;
|
|
fragmentTransitionImpl = fragmentTransitionImpl2;
|
|
arrayList3 = arrayList8;
|
|
hashMap2 = hashMap3;
|
|
rect = rect2;
|
|
operation5 = operation6;
|
|
view3 = view6;
|
|
DefaultSpecialEffectsController defaultSpecialEffectsController3 = defaultSpecialEffectsController2;
|
|
arrayList4 = arrayList7;
|
|
defaultSpecialEffectsController = defaultSpecialEffectsController3;
|
|
view7 = view7;
|
|
} else {
|
|
Object wrapTransitionInSet = fragmentTransitionImpl2.wrapTransitionInSet(fragmentTransitionImpl2.cloneTransition(transitionInfo3.getSharedElementTransition()));
|
|
ArrayList<String> sharedElementSourceNames = operation2.getFragment().getSharedElementSourceNames();
|
|
ArrayList<String> sharedElementSourceNames2 = operation.getFragment().getSharedElementSourceNames();
|
|
ArrayList<String> sharedElementTargetNames = operation.getFragment().getSharedElementTargetNames();
|
|
View view8 = view7;
|
|
int i2 = 0;
|
|
while (i2 < sharedElementTargetNames.size()) {
|
|
int indexOf = sharedElementSourceNames.indexOf(sharedElementTargetNames.get(i2));
|
|
ArrayList<String> arrayList9 = sharedElementTargetNames;
|
|
if (indexOf != -1) {
|
|
sharedElementSourceNames.set(indexOf, sharedElementSourceNames2.get(i2));
|
|
}
|
|
i2++;
|
|
sharedElementTargetNames = arrayList9;
|
|
}
|
|
ArrayList<String> sharedElementTargetNames2 = operation2.getFragment().getSharedElementTargetNames();
|
|
if (!z2) {
|
|
enterTransitionCallback = operation.getFragment().getExitTransitionCallback();
|
|
exitTransitionCallback = operation2.getFragment().getEnterTransitionCallback();
|
|
} else {
|
|
enterTransitionCallback = operation.getFragment().getEnterTransitionCallback();
|
|
exitTransitionCallback = operation2.getFragment().getExitTransitionCallback();
|
|
}
|
|
int i3 = 0;
|
|
for (int size = sharedElementSourceNames.size(); i3 < size; size = size) {
|
|
arrayMap2.put(sharedElementSourceNames.get(i3), sharedElementTargetNames2.get(i3));
|
|
i3++;
|
|
}
|
|
ArrayMap<String, View> arrayMap3 = new ArrayMap<>();
|
|
defaultSpecialEffectsController2.findNamedViews(arrayMap3, operation.getFragment().mView);
|
|
arrayMap3.retainAll(sharedElementSourceNames);
|
|
if (enterTransitionCallback != null) {
|
|
enterTransitionCallback.onMapSharedElements(sharedElementSourceNames, arrayMap3);
|
|
int size2 = sharedElementSourceNames.size() - 1;
|
|
while (size2 >= 0) {
|
|
String str = sharedElementSourceNames.get(size2);
|
|
View view9 = arrayMap3.get(str);
|
|
if (view9 == null) {
|
|
arrayMap2.remove(str);
|
|
arrayList6 = sharedElementSourceNames;
|
|
} else {
|
|
arrayList6 = sharedElementSourceNames;
|
|
if (!str.equals(ViewCompat.getTransitionName(view9))) {
|
|
arrayMap2.put(ViewCompat.getTransitionName(view9), (String) arrayMap2.remove(str));
|
|
}
|
|
}
|
|
size2--;
|
|
sharedElementSourceNames = arrayList6;
|
|
}
|
|
arrayList5 = sharedElementSourceNames;
|
|
} else {
|
|
arrayList5 = sharedElementSourceNames;
|
|
arrayMap2.retainAll(arrayMap3.keySet());
|
|
}
|
|
final ArrayMap<String, View> arrayMap4 = new ArrayMap<>();
|
|
defaultSpecialEffectsController2.findNamedViews(arrayMap4, operation2.getFragment().mView);
|
|
arrayMap4.retainAll(sharedElementTargetNames2);
|
|
arrayMap4.retainAll(arrayMap2.values());
|
|
if (exitTransitionCallback != null) {
|
|
exitTransitionCallback.onMapSharedElements(sharedElementTargetNames2, arrayMap4);
|
|
for (int size3 = sharedElementTargetNames2.size() - 1; size3 >= 0; size3--) {
|
|
String str2 = sharedElementTargetNames2.get(size3);
|
|
View view10 = arrayMap4.get(str2);
|
|
if (view10 == null) {
|
|
String findKeyForValue2 = FragmentTransition.findKeyForValue(arrayMap2, str2);
|
|
if (findKeyForValue2 != null) {
|
|
arrayMap2.remove(findKeyForValue2);
|
|
}
|
|
} else if (!str2.equals(ViewCompat.getTransitionName(view10)) && (findKeyForValue = FragmentTransition.findKeyForValue(arrayMap2, str2)) != null) {
|
|
arrayMap2.put(findKeyForValue, ViewCompat.getTransitionName(view10));
|
|
}
|
|
}
|
|
} else {
|
|
FragmentTransition.retainValues(arrayMap2, arrayMap4);
|
|
}
|
|
defaultSpecialEffectsController2.retainMatchingViews(arrayMap3, arrayMap2.keySet());
|
|
defaultSpecialEffectsController2.retainMatchingViews(arrayMap4, arrayMap2.values());
|
|
if (arrayMap2.isEmpty()) {
|
|
arrayList7.clear();
|
|
arrayList8.clear();
|
|
arrayMap = arrayMap2;
|
|
arrayList3 = arrayList8;
|
|
rect = rect2;
|
|
view3 = view6;
|
|
fragmentTransitionImpl = fragmentTransitionImpl2;
|
|
view7 = view8;
|
|
obj3 = null;
|
|
operation4 = operation2;
|
|
hashMap2 = hashMap3;
|
|
operation5 = operation;
|
|
DefaultSpecialEffectsController defaultSpecialEffectsController4 = defaultSpecialEffectsController2;
|
|
arrayList4 = arrayList7;
|
|
defaultSpecialEffectsController = defaultSpecialEffectsController4;
|
|
} else {
|
|
FragmentTransition.callSharedElementStartEnd(operation2.getFragment(), operation.getFragment(), z2, arrayMap3, true);
|
|
HashMap hashMap4 = hashMap3;
|
|
arrayMap = arrayMap2;
|
|
View view11 = view6;
|
|
ArrayList<View> arrayList10 = arrayList8;
|
|
arrayList4 = arrayList7;
|
|
OneShotPreDrawListener.add(getContainer(), new Runnable() { // from class: androidx.fragment.app.DefaultSpecialEffectsController.6
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
FragmentTransition.callSharedElementStartEnd(operation2.getFragment(), operation.getFragment(), z, arrayMap4, false);
|
|
}
|
|
});
|
|
arrayList4.addAll(arrayMap3.values());
|
|
if (arrayList5.isEmpty()) {
|
|
i = 0;
|
|
view7 = view8;
|
|
} else {
|
|
i = 0;
|
|
View view12 = arrayMap3.get(arrayList5.get(0));
|
|
fragmentTransitionImpl2.setEpicenter(wrapTransitionInSet, view12);
|
|
view7 = view12;
|
|
}
|
|
arrayList10.addAll(arrayMap4.values());
|
|
if (sharedElementTargetNames2.isEmpty() || (view5 = arrayMap4.get(sharedElementTargetNames2.get(i))) == null) {
|
|
defaultSpecialEffectsController = this;
|
|
view4 = view11;
|
|
} else {
|
|
defaultSpecialEffectsController = this;
|
|
OneShotPreDrawListener.add(getContainer(), new Runnable() { // from class: androidx.fragment.app.DefaultSpecialEffectsController.7
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
fragmentTransitionImpl2.getBoundsOnScreen(view5, rect2);
|
|
}
|
|
});
|
|
view4 = view11;
|
|
z3 = true;
|
|
}
|
|
fragmentTransitionImpl2.setSharedElementTargets(wrapTransitionInSet, view4, arrayList4);
|
|
rect = rect2;
|
|
view3 = view4;
|
|
arrayList3 = arrayList10;
|
|
fragmentTransitionImpl = fragmentTransitionImpl2;
|
|
fragmentTransitionImpl2.scheduleRemoveTargets(wrapTransitionInSet, null, null, null, null, wrapTransitionInSet, arrayList3);
|
|
operation5 = operation;
|
|
hashMap2 = hashMap4;
|
|
hashMap2.put(operation5, true);
|
|
operation4 = operation2;
|
|
hashMap2.put(operation4, true);
|
|
obj3 = wrapTransitionInSet;
|
|
}
|
|
}
|
|
z2 = z;
|
|
rect2 = rect;
|
|
view6 = view3;
|
|
arrayList8 = arrayList3;
|
|
operation6 = operation5;
|
|
hashMap3 = hashMap2;
|
|
operation7 = operation4;
|
|
fragmentTransitionImpl2 = fragmentTransitionImpl;
|
|
arrayMap2 = arrayMap;
|
|
ArrayList<View> arrayList11 = arrayList4;
|
|
defaultSpecialEffectsController2 = defaultSpecialEffectsController;
|
|
arrayList7 = arrayList11;
|
|
}
|
|
View view13 = view7;
|
|
ArrayMap arrayMap5 = arrayMap2;
|
|
SpecialEffectsController.Operation operation8 = operation7;
|
|
FragmentTransitionImpl fragmentTransitionImpl3 = fragmentTransitionImpl2;
|
|
boolean z4 = false;
|
|
ArrayList<View> arrayList12 = arrayList8;
|
|
HashMap hashMap5 = hashMap3;
|
|
Rect rect3 = rect2;
|
|
SpecialEffectsController.Operation operation9 = operation6;
|
|
View view14 = view6;
|
|
DefaultSpecialEffectsController defaultSpecialEffectsController5 = defaultSpecialEffectsController2;
|
|
ArrayList<View> arrayList13 = arrayList7;
|
|
ArrayList arrayList14 = new ArrayList();
|
|
Iterator<TransitionInfo> it2 = list.iterator();
|
|
Object obj4 = null;
|
|
Object obj5 = null;
|
|
while (it2.hasNext()) {
|
|
TransitionInfo next = it2.next();
|
|
if (next.isVisibilityUnchanged()) {
|
|
it = it2;
|
|
hashMap5.put(next.getOperation(), Boolean.valueOf(z4));
|
|
next.completeSpecialEffect();
|
|
} else {
|
|
it = it2;
|
|
Object cloneTransition = fragmentTransitionImpl3.cloneTransition(next.getTransition());
|
|
SpecialEffectsController.Operation operation10 = next.getOperation();
|
|
boolean z5 = obj3 != null && (operation10 == operation9 || operation10 == operation8);
|
|
if (cloneTransition == null) {
|
|
if (!z5) {
|
|
hashMap5.put(operation10, Boolean.valueOf(z4));
|
|
next.completeSpecialEffect();
|
|
}
|
|
arrayList = arrayList13;
|
|
view = view14;
|
|
arrayList2 = arrayList12;
|
|
mergeTransitionsTogether = obj4;
|
|
obj2 = obj5;
|
|
hashMap = hashMap5;
|
|
view2 = view13;
|
|
} else {
|
|
final ArrayList<View> arrayList15 = new ArrayList<>();
|
|
Object obj6 = obj4;
|
|
defaultSpecialEffectsController5.captureTransitioningViews(arrayList15, operation10.getFragment().mView);
|
|
if (z5) {
|
|
if (operation10 == operation9) {
|
|
arrayList15.removeAll(arrayList13);
|
|
} else {
|
|
arrayList15.removeAll(arrayList12);
|
|
}
|
|
}
|
|
if (arrayList15.isEmpty()) {
|
|
fragmentTransitionImpl3.addTarget(cloneTransition, view14);
|
|
arrayList = arrayList13;
|
|
view = view14;
|
|
arrayList2 = arrayList12;
|
|
operation3 = operation10;
|
|
obj2 = obj5;
|
|
hashMap = hashMap5;
|
|
obj = obj6;
|
|
} else {
|
|
fragmentTransitionImpl3.addTargets(cloneTransition, arrayList15);
|
|
view = view14;
|
|
obj = obj6;
|
|
arrayList = arrayList13;
|
|
obj2 = obj5;
|
|
arrayList2 = arrayList12;
|
|
hashMap = hashMap5;
|
|
fragmentTransitionImpl3.scheduleRemoveTargets(cloneTransition, cloneTransition, arrayList15, null, null, null, null);
|
|
if (operation10.getFinalState() == SpecialEffectsController.Operation.State.GONE) {
|
|
operation3 = operation10;
|
|
list2.remove(operation3);
|
|
ArrayList<View> arrayList16 = new ArrayList<>(arrayList15);
|
|
arrayList16.remove(operation3.getFragment().mView);
|
|
fragmentTransitionImpl3.scheduleHideFragmentView(cloneTransition, operation3.getFragment().mView, arrayList16);
|
|
OneShotPreDrawListener.add(getContainer(), new Runnable() { // from class: androidx.fragment.app.DefaultSpecialEffectsController.8
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
FragmentTransition.setViewVisibility(arrayList15, 4);
|
|
}
|
|
});
|
|
} else {
|
|
operation3 = operation10;
|
|
}
|
|
}
|
|
if (operation3.getFinalState() == SpecialEffectsController.Operation.State.VISIBLE) {
|
|
arrayList14.addAll(arrayList15);
|
|
if (z3) {
|
|
fragmentTransitionImpl3.setEpicenter(cloneTransition, rect3);
|
|
}
|
|
view2 = view13;
|
|
} else {
|
|
view2 = view13;
|
|
fragmentTransitionImpl3.setEpicenter(cloneTransition, view2);
|
|
}
|
|
hashMap.put(operation3, true);
|
|
if (next.isOverlapAllowed()) {
|
|
obj2 = fragmentTransitionImpl3.mergeTransitionsTogether(obj2, cloneTransition, null);
|
|
mergeTransitionsTogether = obj;
|
|
} else {
|
|
mergeTransitionsTogether = fragmentTransitionImpl3.mergeTransitionsTogether(obj, cloneTransition, null);
|
|
}
|
|
}
|
|
view13 = view2;
|
|
obj5 = obj2;
|
|
obj4 = mergeTransitionsTogether;
|
|
hashMap5 = hashMap;
|
|
view14 = view;
|
|
arrayList13 = arrayList;
|
|
arrayList12 = arrayList2;
|
|
z4 = false;
|
|
}
|
|
it2 = it;
|
|
}
|
|
ArrayList<View> arrayList17 = arrayList13;
|
|
ArrayList<View> arrayList18 = arrayList12;
|
|
HashMap hashMap6 = hashMap5;
|
|
Object mergeTransitionsInSequence = fragmentTransitionImpl3.mergeTransitionsInSequence(obj5, obj4, obj3);
|
|
for (final TransitionInfo transitionInfo4 : list) {
|
|
if (!transitionInfo4.isVisibilityUnchanged()) {
|
|
Object transition = transitionInfo4.getTransition();
|
|
SpecialEffectsController.Operation operation11 = transitionInfo4.getOperation();
|
|
boolean z6 = obj3 != null && (operation11 == operation9 || operation11 == operation8);
|
|
if (transition != null || z6) {
|
|
if (!ViewCompat.isLaidOut(getContainer())) {
|
|
if (FragmentManager.isLoggingEnabled(2)) {
|
|
Log.v("FragmentManager", "SpecialEffectsController: Container " + getContainer() + " has not been laid out. Completing operation " + operation11);
|
|
}
|
|
transitionInfo4.completeSpecialEffect();
|
|
} else {
|
|
fragmentTransitionImpl3.setListenerForTransitionEnd(transitionInfo4.getOperation().getFragment(), mergeTransitionsInSequence, transitionInfo4.getSignal(), new Runnable() { // from class: androidx.fragment.app.DefaultSpecialEffectsController.9
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
transitionInfo4.completeSpecialEffect();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!ViewCompat.isLaidOut(getContainer())) {
|
|
return hashMap6;
|
|
}
|
|
FragmentTransition.setViewVisibility(arrayList14, 4);
|
|
ArrayList<String> prepareSetNameOverridesReordered = fragmentTransitionImpl3.prepareSetNameOverridesReordered(arrayList18);
|
|
fragmentTransitionImpl3.beginDelayedTransition(getContainer(), mergeTransitionsInSequence);
|
|
fragmentTransitionImpl3.setNameOverridesReordered(getContainer(), arrayList17, arrayList18, prepareSetNameOverridesReordered, arrayMap5);
|
|
FragmentTransition.setViewVisibility(arrayList14, 0);
|
|
fragmentTransitionImpl3.swapSharedElementTargets(obj3, arrayList17, arrayList18);
|
|
return hashMap6;
|
|
}
|
|
|
|
void retainMatchingViews(ArrayMap<String, View> arrayMap, Collection<String> collection) {
|
|
Iterator<Map.Entry<String, View>> it = arrayMap.entrySet().iterator();
|
|
while (it.hasNext()) {
|
|
if (!collection.contains(ViewCompat.getTransitionName(it.next().getValue()))) {
|
|
it.remove();
|
|
}
|
|
}
|
|
}
|
|
|
|
void captureTransitioningViews(ArrayList<View> arrayList, View view) {
|
|
if (view instanceof ViewGroup) {
|
|
ViewGroup viewGroup = (ViewGroup) view;
|
|
if (ViewGroupCompat.isTransitionGroup(viewGroup)) {
|
|
if (arrayList.contains(view)) {
|
|
return;
|
|
}
|
|
arrayList.add(viewGroup);
|
|
return;
|
|
}
|
|
int childCount = viewGroup.getChildCount();
|
|
for (int i = 0; i < childCount; i++) {
|
|
View childAt = viewGroup.getChildAt(i);
|
|
if (childAt.getVisibility() == 0) {
|
|
captureTransitioningViews(arrayList, childAt);
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
if (arrayList.contains(view)) {
|
|
return;
|
|
}
|
|
arrayList.add(view);
|
|
}
|
|
|
|
void findNamedViews(Map<String, View> map, View view) {
|
|
String transitionName = ViewCompat.getTransitionName(view);
|
|
if (transitionName != null) {
|
|
map.put(transitionName, view);
|
|
}
|
|
if (view instanceof ViewGroup) {
|
|
ViewGroup viewGroup = (ViewGroup) view;
|
|
int childCount = viewGroup.getChildCount();
|
|
for (int i = 0; i < childCount; i++) {
|
|
View childAt = viewGroup.getChildAt(i);
|
|
if (childAt.getVisibility() == 0) {
|
|
findNamedViews(map, childAt);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void applyContainerChanges(SpecialEffectsController.Operation operation) {
|
|
operation.getFinalState().applyState(operation.getFragment().mView);
|
|
}
|
|
|
|
private static class SpecialEffectsInfo {
|
|
private final SpecialEffectsController.Operation mOperation;
|
|
private final CancellationSignal mSignal;
|
|
|
|
SpecialEffectsController.Operation getOperation() {
|
|
return this.mOperation;
|
|
}
|
|
|
|
CancellationSignal getSignal() {
|
|
return this.mSignal;
|
|
}
|
|
|
|
SpecialEffectsInfo(SpecialEffectsController.Operation operation, CancellationSignal cancellationSignal) {
|
|
this.mOperation = operation;
|
|
this.mSignal = cancellationSignal;
|
|
}
|
|
|
|
boolean isVisibilityUnchanged() {
|
|
SpecialEffectsController.Operation.State from = SpecialEffectsController.Operation.State.from(this.mOperation.getFragment().mView);
|
|
SpecialEffectsController.Operation.State finalState = this.mOperation.getFinalState();
|
|
return from == finalState || !(from == SpecialEffectsController.Operation.State.VISIBLE || finalState == SpecialEffectsController.Operation.State.VISIBLE);
|
|
}
|
|
|
|
void completeSpecialEffect() {
|
|
this.mOperation.completeSpecialEffect(this.mSignal);
|
|
}
|
|
}
|
|
|
|
private static class AnimationInfo extends SpecialEffectsInfo {
|
|
private FragmentAnim.AnimationOrAnimator mAnimation;
|
|
private boolean mIsPop;
|
|
private boolean mLoadedAnim;
|
|
|
|
AnimationInfo(SpecialEffectsController.Operation operation, CancellationSignal cancellationSignal, boolean z) {
|
|
super(operation, cancellationSignal);
|
|
this.mLoadedAnim = false;
|
|
this.mIsPop = z;
|
|
}
|
|
|
|
FragmentAnim.AnimationOrAnimator getAnimation(Context context) {
|
|
if (this.mLoadedAnim) {
|
|
return this.mAnimation;
|
|
}
|
|
FragmentAnim.AnimationOrAnimator loadAnimation = FragmentAnim.loadAnimation(context, getOperation().getFragment(), getOperation().getFinalState() == SpecialEffectsController.Operation.State.VISIBLE, this.mIsPop);
|
|
this.mAnimation = loadAnimation;
|
|
this.mLoadedAnim = true;
|
|
return loadAnimation;
|
|
}
|
|
}
|
|
|
|
private static class TransitionInfo extends SpecialEffectsInfo {
|
|
private final boolean mOverlapAllowed;
|
|
private final Object mSharedElementTransition;
|
|
private final Object mTransition;
|
|
|
|
public Object getSharedElementTransition() {
|
|
return this.mSharedElementTransition;
|
|
}
|
|
|
|
Object getTransition() {
|
|
return this.mTransition;
|
|
}
|
|
|
|
public boolean hasSharedElementTransition() {
|
|
return this.mSharedElementTransition != null;
|
|
}
|
|
|
|
boolean isOverlapAllowed() {
|
|
return this.mOverlapAllowed;
|
|
}
|
|
|
|
TransitionInfo(SpecialEffectsController.Operation operation, CancellationSignal cancellationSignal, boolean z, boolean z2) {
|
|
super(operation, cancellationSignal);
|
|
Object exitTransition;
|
|
Object enterTransition;
|
|
boolean allowEnterTransitionOverlap;
|
|
if (operation.getFinalState() == SpecialEffectsController.Operation.State.VISIBLE) {
|
|
if (z) {
|
|
enterTransition = operation.getFragment().getReenterTransition();
|
|
} else {
|
|
enterTransition = operation.getFragment().getEnterTransition();
|
|
}
|
|
this.mTransition = enterTransition;
|
|
if (z) {
|
|
allowEnterTransitionOverlap = operation.getFragment().getAllowReturnTransitionOverlap();
|
|
} else {
|
|
allowEnterTransitionOverlap = operation.getFragment().getAllowEnterTransitionOverlap();
|
|
}
|
|
this.mOverlapAllowed = allowEnterTransitionOverlap;
|
|
} else {
|
|
if (z) {
|
|
exitTransition = operation.getFragment().getReturnTransition();
|
|
} else {
|
|
exitTransition = operation.getFragment().getExitTransition();
|
|
}
|
|
this.mTransition = exitTransition;
|
|
this.mOverlapAllowed = true;
|
|
}
|
|
if (!z2) {
|
|
this.mSharedElementTransition = null;
|
|
} else if (z) {
|
|
this.mSharedElementTransition = operation.getFragment().getSharedElementReturnTransition();
|
|
} else {
|
|
this.mSharedElementTransition = operation.getFragment().getSharedElementEnterTransition();
|
|
}
|
|
}
|
|
|
|
FragmentTransitionImpl getHandlingImpl() {
|
|
FragmentTransitionImpl handlingImpl = getHandlingImpl(this.mTransition);
|
|
FragmentTransitionImpl handlingImpl2 = getHandlingImpl(this.mSharedElementTransition);
|
|
if (handlingImpl == null || handlingImpl2 == null || handlingImpl == handlingImpl2) {
|
|
return handlingImpl != null ? handlingImpl : handlingImpl2;
|
|
}
|
|
throw new IllegalArgumentException("Mixing framework transitions and AndroidX transitions is not allowed. Fragment " + getOperation().getFragment() + " returned Transition " + this.mTransition + " which uses a different Transition type than its shared element transition " + this.mSharedElementTransition);
|
|
}
|
|
|
|
private FragmentTransitionImpl getHandlingImpl(Object obj) {
|
|
if (obj == null) {
|
|
return null;
|
|
}
|
|
if (FragmentTransition.PLATFORM_IMPL != null && FragmentTransition.PLATFORM_IMPL.canHandle(obj)) {
|
|
return FragmentTransition.PLATFORM_IMPL;
|
|
}
|
|
if (FragmentTransition.SUPPORT_IMPL != null && FragmentTransition.SUPPORT_IMPL.canHandle(obj)) {
|
|
return FragmentTransition.SUPPORT_IMPL;
|
|
}
|
|
throw new IllegalArgumentException("Transition " + obj + " for fragment " + getOperation().getFragment() + " is not a valid framework Transition or AndroidX Transition");
|
|
}
|
|
}
|
|
}
|