967 lines
34 KiB
Java
967 lines
34 KiB
Java
package androidx.transition;
|
|
|
|
import android.animation.Animator;
|
|
import android.animation.AnimatorListenerAdapter;
|
|
import android.animation.TimeInterpolator;
|
|
import android.graphics.Path;
|
|
import android.util.SparseArray;
|
|
import android.util.SparseIntArray;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.ListView;
|
|
import androidx.collection.ArrayMap;
|
|
import androidx.collection.LongSparseArray;
|
|
import androidx.core.view.ViewCompat;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes.dex */
|
|
public abstract class Transition implements Cloneable {
|
|
private static final int[] H = {2, 1, 3, 4};
|
|
private static final PathMotion I = new PathMotion() { // from class: androidx.transition.Transition.1
|
|
@Override // androidx.transition.PathMotion
|
|
public Path a(float f, float f2, float f3, float f4) {
|
|
Path path = new Path();
|
|
path.moveTo(f, f2);
|
|
path.lineTo(f3, f4);
|
|
return path;
|
|
}
|
|
};
|
|
private static ThreadLocal<ArrayMap<Animator, AnimationInfo>> J = new ThreadLocal<>();
|
|
TransitionPropagation D;
|
|
private EpicenterCallback E;
|
|
private ArrayMap<String, String> F;
|
|
private ArrayList<TransitionValues> t;
|
|
private ArrayList<TransitionValues> u;
|
|
private String a = getClass().getName();
|
|
private long b = -1;
|
|
long c = -1;
|
|
private TimeInterpolator d = null;
|
|
ArrayList<Integer> e = new ArrayList<>();
|
|
ArrayList<View> f = new ArrayList<>();
|
|
private ArrayList<String> g = null;
|
|
private ArrayList<Class> h = null;
|
|
private ArrayList<Integer> i = null;
|
|
private ArrayList<View> j = null;
|
|
private ArrayList<Class> k = null;
|
|
private ArrayList<String> l = null;
|
|
private ArrayList<Integer> m = null;
|
|
private ArrayList<View> n = null;
|
|
private ArrayList<Class> o = null;
|
|
private TransitionValuesMaps p = new TransitionValuesMaps();
|
|
private TransitionValuesMaps q = new TransitionValuesMaps();
|
|
TransitionSet r = null;
|
|
private int[] s = H;
|
|
boolean v = false;
|
|
ArrayList<Animator> x = new ArrayList<>();
|
|
private int y = 0;
|
|
private boolean z = false;
|
|
private boolean A = false;
|
|
private ArrayList<TransitionListener> B = null;
|
|
private ArrayList<Animator> C = new ArrayList<>();
|
|
private PathMotion G = I;
|
|
|
|
private static class AnimationInfo {
|
|
View a;
|
|
String b;
|
|
TransitionValues c;
|
|
WindowIdImpl d;
|
|
Transition e;
|
|
|
|
AnimationInfo(View view, String str, Transition transition, WindowIdImpl windowIdImpl, TransitionValues transitionValues) {
|
|
this.a = view;
|
|
this.b = str;
|
|
this.c = transitionValues;
|
|
this.d = windowIdImpl;
|
|
this.e = transition;
|
|
}
|
|
}
|
|
|
|
public static abstract class EpicenterCallback {
|
|
}
|
|
|
|
public interface TransitionListener {
|
|
void a(Transition transition);
|
|
|
|
void b(Transition transition);
|
|
|
|
void c(Transition transition);
|
|
|
|
void d(Transition transition);
|
|
}
|
|
|
|
private void c(View view, boolean z) {
|
|
if (view == null) {
|
|
return;
|
|
}
|
|
int id = view.getId();
|
|
ArrayList<Integer> arrayList = this.i;
|
|
if (arrayList == null || !arrayList.contains(Integer.valueOf(id))) {
|
|
ArrayList<View> arrayList2 = this.j;
|
|
if (arrayList2 == null || !arrayList2.contains(view)) {
|
|
ArrayList<Class> arrayList3 = this.k;
|
|
if (arrayList3 != null) {
|
|
int size = arrayList3.size();
|
|
for (int i = 0; i < size; i++) {
|
|
if (this.k.get(i).isInstance(view)) {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
if (view.getParent() instanceof ViewGroup) {
|
|
TransitionValues transitionValues = new TransitionValues();
|
|
transitionValues.b = view;
|
|
if (z) {
|
|
c(transitionValues);
|
|
} else {
|
|
a(transitionValues);
|
|
}
|
|
transitionValues.c.add(this);
|
|
b(transitionValues);
|
|
if (z) {
|
|
a(this.p, view, transitionValues);
|
|
} else {
|
|
a(this.q, view, transitionValues);
|
|
}
|
|
}
|
|
if (view instanceof ViewGroup) {
|
|
ArrayList<Integer> arrayList4 = this.m;
|
|
if (arrayList4 == null || !arrayList4.contains(Integer.valueOf(id))) {
|
|
ArrayList<View> arrayList5 = this.n;
|
|
if (arrayList5 == null || !arrayList5.contains(view)) {
|
|
ArrayList<Class> arrayList6 = this.o;
|
|
if (arrayList6 != null) {
|
|
int size2 = arrayList6.size();
|
|
for (int i2 = 0; i2 < size2; i2++) {
|
|
if (this.o.get(i2).isInstance(view)) {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
ViewGroup viewGroup = (ViewGroup) view;
|
|
for (int i3 = 0; i3 < viewGroup.getChildCount(); i3++) {
|
|
c(viewGroup.getChildAt(i3), z);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static ArrayMap<Animator, AnimationInfo> u() {
|
|
ArrayMap<Animator, AnimationInfo> arrayMap = J.get();
|
|
if (arrayMap != null) {
|
|
return arrayMap;
|
|
}
|
|
ArrayMap<Animator, AnimationInfo> arrayMap2 = new ArrayMap<>();
|
|
J.set(arrayMap2);
|
|
return arrayMap2;
|
|
}
|
|
|
|
public Animator a(ViewGroup viewGroup, TransitionValues transitionValues, TransitionValues transitionValues2) {
|
|
return null;
|
|
}
|
|
|
|
public Transition a(long j) {
|
|
this.c = j;
|
|
return this;
|
|
}
|
|
|
|
public abstract void a(TransitionValues transitionValues);
|
|
|
|
public long b() {
|
|
return this.c;
|
|
}
|
|
|
|
public abstract void c(TransitionValues transitionValues);
|
|
|
|
public Transition d(View view) {
|
|
this.f.remove(view);
|
|
return this;
|
|
}
|
|
|
|
public void e(View view) {
|
|
if (this.z) {
|
|
if (!this.A) {
|
|
ArrayMap<Animator, AnimationInfo> u = u();
|
|
int size = u.size();
|
|
WindowIdImpl d = ViewUtils.d(view);
|
|
for (int i = size - 1; i >= 0; i--) {
|
|
AnimationInfo d2 = u.d(i);
|
|
if (d2.a != null && d.equals(d2.d)) {
|
|
AnimatorUtils.b(u.b(i));
|
|
}
|
|
}
|
|
ArrayList<TransitionListener> arrayList = this.B;
|
|
if (arrayList != null && arrayList.size() > 0) {
|
|
ArrayList arrayList2 = (ArrayList) this.B.clone();
|
|
int size2 = arrayList2.size();
|
|
for (int i2 = 0; i2 < size2; i2++) {
|
|
((TransitionListener) arrayList2.get(i2)).d(this);
|
|
}
|
|
}
|
|
}
|
|
this.z = false;
|
|
}
|
|
}
|
|
|
|
public EpicenterCallback h() {
|
|
return this.E;
|
|
}
|
|
|
|
public TimeInterpolator i() {
|
|
return this.d;
|
|
}
|
|
|
|
public String j() {
|
|
return this.a;
|
|
}
|
|
|
|
public PathMotion k() {
|
|
return this.G;
|
|
}
|
|
|
|
public TransitionPropagation l() {
|
|
return this.D;
|
|
}
|
|
|
|
public long m() {
|
|
return this.b;
|
|
}
|
|
|
|
public List<Integer> n() {
|
|
return this.e;
|
|
}
|
|
|
|
public List<String> o() {
|
|
return this.g;
|
|
}
|
|
|
|
public List<Class> p() {
|
|
return this.h;
|
|
}
|
|
|
|
public List<View> q() {
|
|
return this.f;
|
|
}
|
|
|
|
public String[] r() {
|
|
return null;
|
|
}
|
|
|
|
protected void s() {
|
|
t();
|
|
ArrayMap<Animator, AnimationInfo> u = u();
|
|
Iterator<Animator> it = this.C.iterator();
|
|
while (it.hasNext()) {
|
|
Animator next = it.next();
|
|
if (u.containsKey(next)) {
|
|
t();
|
|
a(next, u);
|
|
}
|
|
}
|
|
this.C.clear();
|
|
a();
|
|
}
|
|
|
|
protected void t() {
|
|
if (this.y == 0) {
|
|
ArrayList<TransitionListener> arrayList = this.B;
|
|
if (arrayList != null && arrayList.size() > 0) {
|
|
ArrayList arrayList2 = (ArrayList) this.B.clone();
|
|
int size = arrayList2.size();
|
|
for (int i = 0; i < size; i++) {
|
|
((TransitionListener) arrayList2.get(i)).a(this);
|
|
}
|
|
}
|
|
this.A = false;
|
|
}
|
|
this.y++;
|
|
}
|
|
|
|
public String toString() {
|
|
return a("");
|
|
}
|
|
|
|
public Transition a(TimeInterpolator timeInterpolator) {
|
|
this.d = timeInterpolator;
|
|
return this;
|
|
}
|
|
|
|
public Transition b(long j) {
|
|
this.b = j;
|
|
return this;
|
|
}
|
|
|
|
@Override //
|
|
/* renamed from: clone, reason: merged with bridge method [inline-methods] */
|
|
public Transition mo3clone() {
|
|
try {
|
|
Transition transition = (Transition) super.clone();
|
|
transition.C = new ArrayList<>();
|
|
transition.p = new TransitionValuesMaps();
|
|
transition.q = new TransitionValuesMaps();
|
|
transition.t = null;
|
|
transition.u = null;
|
|
return transition;
|
|
} catch (CloneNotSupportedException unused) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private void a(ArrayMap<View, TransitionValues> arrayMap, ArrayMap<View, TransitionValues> arrayMap2, LongSparseArray<View> longSparseArray, LongSparseArray<View> longSparseArray2) {
|
|
View b;
|
|
int b2 = longSparseArray.b();
|
|
for (int i = 0; i < b2; i++) {
|
|
View c = longSparseArray.c(i);
|
|
if (c != null && b(c) && (b = longSparseArray2.b(longSparseArray.a(i))) != null && b(b)) {
|
|
TransitionValues transitionValues = arrayMap.get(c);
|
|
TransitionValues transitionValues2 = arrayMap2.get(b);
|
|
if (transitionValues != null && transitionValues2 != null) {
|
|
this.t.add(transitionValues);
|
|
this.u.add(transitionValues2);
|
|
arrayMap.remove(c);
|
|
arrayMap2.remove(b);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void b(ArrayMap<View, TransitionValues> arrayMap, ArrayMap<View, TransitionValues> arrayMap2) {
|
|
TransitionValues remove;
|
|
View view;
|
|
for (int size = arrayMap.size() - 1; size >= 0; size--) {
|
|
View b = arrayMap.b(size);
|
|
if (b != null && b(b) && (remove = arrayMap2.remove(b)) != null && (view = remove.b) != null && b(view)) {
|
|
this.t.add(arrayMap.c(size));
|
|
this.u.add(remove);
|
|
}
|
|
}
|
|
}
|
|
|
|
boolean b(View view) {
|
|
ArrayList<Class> arrayList;
|
|
ArrayList<String> arrayList2;
|
|
int id = view.getId();
|
|
ArrayList<Integer> arrayList3 = this.i;
|
|
if (arrayList3 != null && arrayList3.contains(Integer.valueOf(id))) {
|
|
return false;
|
|
}
|
|
ArrayList<View> arrayList4 = this.j;
|
|
if (arrayList4 != null && arrayList4.contains(view)) {
|
|
return false;
|
|
}
|
|
ArrayList<Class> arrayList5 = this.k;
|
|
if (arrayList5 != null) {
|
|
int size = arrayList5.size();
|
|
for (int i = 0; i < size; i++) {
|
|
if (this.k.get(i).isInstance(view)) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
if (this.l != null && ViewCompat.p(view) != null && this.l.contains(ViewCompat.p(view))) {
|
|
return false;
|
|
}
|
|
if ((this.e.size() == 0 && this.f.size() == 0 && (((arrayList = this.h) == null || arrayList.isEmpty()) && ((arrayList2 = this.g) == null || arrayList2.isEmpty()))) || this.e.contains(Integer.valueOf(id)) || this.f.contains(view)) {
|
|
return true;
|
|
}
|
|
ArrayList<String> arrayList6 = this.g;
|
|
if (arrayList6 != null && arrayList6.contains(ViewCompat.p(view))) {
|
|
return true;
|
|
}
|
|
if (this.h != null) {
|
|
for (int i2 = 0; i2 < this.h.size(); i2++) {
|
|
if (this.h.get(i2).isInstance(view)) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private void a(ArrayMap<View, TransitionValues> arrayMap, ArrayMap<View, TransitionValues> arrayMap2, SparseArray<View> sparseArray, SparseArray<View> sparseArray2) {
|
|
View view;
|
|
int size = sparseArray.size();
|
|
for (int i = 0; i < size; i++) {
|
|
View valueAt = sparseArray.valueAt(i);
|
|
if (valueAt != null && b(valueAt) && (view = sparseArray2.get(sparseArray.keyAt(i))) != null && b(view)) {
|
|
TransitionValues transitionValues = arrayMap.get(valueAt);
|
|
TransitionValues transitionValues2 = arrayMap2.get(view);
|
|
if (transitionValues != null && transitionValues2 != null) {
|
|
this.t.add(transitionValues);
|
|
this.u.add(transitionValues2);
|
|
arrayMap.remove(valueAt);
|
|
arrayMap2.remove(view);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void a(ArrayMap<View, TransitionValues> arrayMap, ArrayMap<View, TransitionValues> arrayMap2, ArrayMap<String, View> arrayMap3, ArrayMap<String, View> arrayMap4) {
|
|
View view;
|
|
int size = arrayMap3.size();
|
|
for (int i = 0; i < size; i++) {
|
|
View d = arrayMap3.d(i);
|
|
if (d != null && b(d) && (view = arrayMap4.get(arrayMap3.b(i))) != null && b(view)) {
|
|
TransitionValues transitionValues = arrayMap.get(d);
|
|
TransitionValues transitionValues2 = arrayMap2.get(view);
|
|
if (transitionValues != null && transitionValues2 != null) {
|
|
this.t.add(transitionValues);
|
|
this.u.add(transitionValues2);
|
|
arrayMap.remove(d);
|
|
arrayMap2.remove(view);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public void c(View view) {
|
|
if (this.A) {
|
|
return;
|
|
}
|
|
ArrayMap<Animator, AnimationInfo> u = u();
|
|
int size = u.size();
|
|
WindowIdImpl d = ViewUtils.d(view);
|
|
for (int i = size - 1; i >= 0; i--) {
|
|
AnimationInfo d2 = u.d(i);
|
|
if (d2.a != null && d.equals(d2.d)) {
|
|
AnimatorUtils.a(u.b(i));
|
|
}
|
|
}
|
|
ArrayList<TransitionListener> arrayList = this.B;
|
|
if (arrayList != null && arrayList.size() > 0) {
|
|
ArrayList arrayList2 = (ArrayList) this.B.clone();
|
|
int size2 = arrayList2.size();
|
|
for (int i2 = 0; i2 < size2; i2++) {
|
|
((TransitionListener) arrayList2.get(i2)).b(this);
|
|
}
|
|
}
|
|
this.z = true;
|
|
}
|
|
|
|
public TransitionValues b(View view, boolean z) {
|
|
TransitionSet transitionSet = this.r;
|
|
if (transitionSet != null) {
|
|
return transitionSet.b(view, z);
|
|
}
|
|
return (z ? this.p : this.q).a.get(view);
|
|
}
|
|
|
|
public Transition b(TransitionListener transitionListener) {
|
|
ArrayList<TransitionListener> arrayList = this.B;
|
|
if (arrayList == null) {
|
|
return this;
|
|
}
|
|
arrayList.remove(transitionListener);
|
|
if (this.B.size() == 0) {
|
|
this.B = null;
|
|
}
|
|
return this;
|
|
}
|
|
|
|
private void a(ArrayMap<View, TransitionValues> arrayMap, ArrayMap<View, TransitionValues> arrayMap2) {
|
|
for (int i = 0; i < arrayMap.size(); i++) {
|
|
TransitionValues d = arrayMap.d(i);
|
|
if (b(d.b)) {
|
|
this.t.add(d);
|
|
this.u.add(null);
|
|
}
|
|
}
|
|
for (int i2 = 0; i2 < arrayMap2.size(); i2++) {
|
|
TransitionValues d2 = arrayMap2.d(i2);
|
|
if (b(d2.b)) {
|
|
this.u.add(d2);
|
|
this.t.add(null);
|
|
}
|
|
}
|
|
}
|
|
|
|
void b(TransitionValues transitionValues) {
|
|
String[] a;
|
|
if (this.D == null || transitionValues.a.isEmpty() || (a = this.D.a()) == null) {
|
|
return;
|
|
}
|
|
boolean z = false;
|
|
int i = 0;
|
|
while (true) {
|
|
if (i >= a.length) {
|
|
z = true;
|
|
break;
|
|
} else if (!transitionValues.a.containsKey(a[i])) {
|
|
break;
|
|
} else {
|
|
i++;
|
|
}
|
|
}
|
|
if (z) {
|
|
return;
|
|
}
|
|
this.D.a(transitionValues);
|
|
}
|
|
|
|
private void a(TransitionValuesMaps transitionValuesMaps, TransitionValuesMaps transitionValuesMaps2) {
|
|
ArrayMap<View, TransitionValues> arrayMap = new ArrayMap<>(transitionValuesMaps.a);
|
|
ArrayMap<View, TransitionValues> arrayMap2 = new ArrayMap<>(transitionValuesMaps2.a);
|
|
int i = 0;
|
|
while (true) {
|
|
int[] iArr = this.s;
|
|
if (i < iArr.length) {
|
|
int i2 = iArr[i];
|
|
if (i2 == 1) {
|
|
b(arrayMap, arrayMap2);
|
|
} else if (i2 == 2) {
|
|
a(arrayMap, arrayMap2, transitionValuesMaps.d, transitionValuesMaps2.d);
|
|
} else if (i2 == 3) {
|
|
a(arrayMap, arrayMap2, transitionValuesMaps.b, transitionValuesMaps2.b);
|
|
} else if (i2 == 4) {
|
|
a(arrayMap, arrayMap2, transitionValuesMaps.c, transitionValuesMaps2.c);
|
|
}
|
|
i++;
|
|
} else {
|
|
a(arrayMap, arrayMap2);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
protected void a(ViewGroup viewGroup, TransitionValuesMaps transitionValuesMaps, TransitionValuesMaps transitionValuesMaps2, ArrayList<TransitionValues> arrayList, ArrayList<TransitionValues> arrayList2) {
|
|
Animator a;
|
|
int i;
|
|
int i2;
|
|
View view;
|
|
Animator animator;
|
|
TransitionValues transitionValues;
|
|
Animator animator2;
|
|
TransitionValues transitionValues2;
|
|
ArrayMap<Animator, AnimationInfo> u = u();
|
|
SparseIntArray sparseIntArray = new SparseIntArray();
|
|
int size = arrayList.size();
|
|
long j = Long.MAX_VALUE;
|
|
int i3 = 0;
|
|
while (i3 < size) {
|
|
TransitionValues transitionValues3 = arrayList.get(i3);
|
|
TransitionValues transitionValues4 = arrayList2.get(i3);
|
|
if (transitionValues3 != null && !transitionValues3.c.contains(this)) {
|
|
transitionValues3 = null;
|
|
}
|
|
if (transitionValues4 != null && !transitionValues4.c.contains(this)) {
|
|
transitionValues4 = null;
|
|
}
|
|
if (transitionValues3 != null || transitionValues4 != null) {
|
|
if ((transitionValues3 == null || transitionValues4 == null || a(transitionValues3, transitionValues4)) && (a = a(viewGroup, transitionValues3, transitionValues4)) != null) {
|
|
if (transitionValues4 != null) {
|
|
view = transitionValues4.b;
|
|
String[] r = r();
|
|
if (view == null || r == null || r.length <= 0) {
|
|
i = size;
|
|
i2 = i3;
|
|
animator2 = a;
|
|
transitionValues2 = null;
|
|
} else {
|
|
transitionValues2 = new TransitionValues();
|
|
transitionValues2.b = view;
|
|
i = size;
|
|
TransitionValues transitionValues5 = transitionValuesMaps2.a.get(view);
|
|
if (transitionValues5 != null) {
|
|
int i4 = 0;
|
|
while (i4 < r.length) {
|
|
transitionValues2.a.put(r[i4], transitionValues5.a.get(r[i4]));
|
|
i4++;
|
|
i3 = i3;
|
|
transitionValues5 = transitionValues5;
|
|
}
|
|
}
|
|
i2 = i3;
|
|
int size2 = u.size();
|
|
int i5 = 0;
|
|
while (true) {
|
|
if (i5 >= size2) {
|
|
animator2 = a;
|
|
break;
|
|
}
|
|
AnimationInfo animationInfo = u.get(u.b(i5));
|
|
if (animationInfo.c != null && animationInfo.a == view && animationInfo.b.equals(j()) && animationInfo.c.equals(transitionValues2)) {
|
|
animator2 = null;
|
|
break;
|
|
}
|
|
i5++;
|
|
}
|
|
}
|
|
animator = animator2;
|
|
transitionValues = transitionValues2;
|
|
} else {
|
|
i = size;
|
|
i2 = i3;
|
|
view = transitionValues3.b;
|
|
animator = a;
|
|
transitionValues = null;
|
|
}
|
|
if (animator != null) {
|
|
TransitionPropagation transitionPropagation = this.D;
|
|
if (transitionPropagation != null) {
|
|
long a2 = transitionPropagation.a(viewGroup, this, transitionValues3, transitionValues4);
|
|
sparseIntArray.put(this.C.size(), (int) a2);
|
|
j = Math.min(a2, j);
|
|
}
|
|
u.put(animator, new AnimationInfo(view, j(), this, ViewUtils.d(viewGroup), transitionValues));
|
|
this.C.add(animator);
|
|
j = j;
|
|
}
|
|
i3 = i2 + 1;
|
|
size = i;
|
|
}
|
|
}
|
|
i = size;
|
|
i2 = i3;
|
|
i3 = i2 + 1;
|
|
size = i;
|
|
}
|
|
if (j != 0) {
|
|
for (int i6 = 0; i6 < sparseIntArray.size(); i6++) {
|
|
Animator animator3 = this.C.get(sparseIntArray.keyAt(i6));
|
|
animator3.setStartDelay((sparseIntArray.valueAt(i6) - j) + animator3.getStartDelay());
|
|
}
|
|
}
|
|
}
|
|
|
|
private void a(Animator animator, final ArrayMap<Animator, AnimationInfo> arrayMap) {
|
|
if (animator != null) {
|
|
animator.addListener(new AnimatorListenerAdapter() { // from class: androidx.transition.Transition.2
|
|
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
|
public void onAnimationEnd(Animator animator2) {
|
|
arrayMap.remove(animator2);
|
|
Transition.this.x.remove(animator2);
|
|
}
|
|
|
|
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
|
public void onAnimationStart(Animator animator2) {
|
|
Transition.this.x.add(animator2);
|
|
}
|
|
});
|
|
a(animator);
|
|
}
|
|
}
|
|
|
|
public Transition a(View view) {
|
|
this.f.add(view);
|
|
return this;
|
|
}
|
|
|
|
void a(ViewGroup viewGroup, boolean z) {
|
|
ArrayList<String> arrayList;
|
|
ArrayList<Class> arrayList2;
|
|
ArrayMap<String, String> arrayMap;
|
|
a(z);
|
|
if ((this.e.size() <= 0 && this.f.size() <= 0) || (((arrayList = this.g) != null && !arrayList.isEmpty()) || ((arrayList2 = this.h) != null && !arrayList2.isEmpty()))) {
|
|
c(viewGroup, z);
|
|
} else {
|
|
for (int i = 0; i < this.e.size(); i++) {
|
|
View findViewById = viewGroup.findViewById(this.e.get(i).intValue());
|
|
if (findViewById != null) {
|
|
TransitionValues transitionValues = new TransitionValues();
|
|
transitionValues.b = findViewById;
|
|
if (z) {
|
|
c(transitionValues);
|
|
} else {
|
|
a(transitionValues);
|
|
}
|
|
transitionValues.c.add(this);
|
|
b(transitionValues);
|
|
if (z) {
|
|
a(this.p, findViewById, transitionValues);
|
|
} else {
|
|
a(this.q, findViewById, transitionValues);
|
|
}
|
|
}
|
|
}
|
|
for (int i2 = 0; i2 < this.f.size(); i2++) {
|
|
View view = this.f.get(i2);
|
|
TransitionValues transitionValues2 = new TransitionValues();
|
|
transitionValues2.b = view;
|
|
if (z) {
|
|
c(transitionValues2);
|
|
} else {
|
|
a(transitionValues2);
|
|
}
|
|
transitionValues2.c.add(this);
|
|
b(transitionValues2);
|
|
if (z) {
|
|
a(this.p, view, transitionValues2);
|
|
} else {
|
|
a(this.q, view, transitionValues2);
|
|
}
|
|
}
|
|
}
|
|
if (z || (arrayMap = this.F) == null) {
|
|
return;
|
|
}
|
|
int size = arrayMap.size();
|
|
ArrayList arrayList3 = new ArrayList(size);
|
|
for (int i3 = 0; i3 < size; i3++) {
|
|
arrayList3.add(this.p.d.remove(this.F.b(i3)));
|
|
}
|
|
for (int i4 = 0; i4 < size; i4++) {
|
|
View view2 = (View) arrayList3.get(i4);
|
|
if (view2 != null) {
|
|
this.p.d.put(this.F.d(i4), view2);
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void a(TransitionValuesMaps transitionValuesMaps, View view, TransitionValues transitionValues) {
|
|
transitionValuesMaps.a.put(view, transitionValues);
|
|
int id = view.getId();
|
|
if (id >= 0) {
|
|
if (transitionValuesMaps.b.indexOfKey(id) >= 0) {
|
|
transitionValuesMaps.b.put(id, null);
|
|
} else {
|
|
transitionValuesMaps.b.put(id, view);
|
|
}
|
|
}
|
|
String p = ViewCompat.p(view);
|
|
if (p != null) {
|
|
if (transitionValuesMaps.d.containsKey(p)) {
|
|
transitionValuesMaps.d.put(p, null);
|
|
} else {
|
|
transitionValuesMaps.d.put(p, view);
|
|
}
|
|
}
|
|
if (view.getParent() instanceof ListView) {
|
|
ListView listView = (ListView) view.getParent();
|
|
if (listView.getAdapter().hasStableIds()) {
|
|
long itemIdAtPosition = listView.getItemIdAtPosition(listView.getPositionForView(view));
|
|
if (transitionValuesMaps.c.c(itemIdAtPosition) >= 0) {
|
|
View b = transitionValuesMaps.c.b(itemIdAtPosition);
|
|
if (b != null) {
|
|
ViewCompat.b(b, false);
|
|
transitionValuesMaps.c.c(itemIdAtPosition, null);
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
ViewCompat.b(view, true);
|
|
transitionValuesMaps.c.c(itemIdAtPosition, view);
|
|
}
|
|
}
|
|
}
|
|
|
|
void a(boolean z) {
|
|
if (z) {
|
|
this.p.a.clear();
|
|
this.p.b.clear();
|
|
this.p.c.a();
|
|
} else {
|
|
this.q.a.clear();
|
|
this.q.b.clear();
|
|
this.q.c.a();
|
|
}
|
|
}
|
|
|
|
TransitionValues a(View view, boolean z) {
|
|
TransitionSet transitionSet = this.r;
|
|
if (transitionSet != null) {
|
|
return transitionSet.a(view, z);
|
|
}
|
|
ArrayList<TransitionValues> arrayList = z ? this.t : this.u;
|
|
if (arrayList == null) {
|
|
return null;
|
|
}
|
|
int size = arrayList.size();
|
|
int i = -1;
|
|
int i2 = 0;
|
|
while (true) {
|
|
if (i2 >= size) {
|
|
break;
|
|
}
|
|
TransitionValues transitionValues = arrayList.get(i2);
|
|
if (transitionValues == null) {
|
|
return null;
|
|
}
|
|
if (transitionValues.b == view) {
|
|
i = i2;
|
|
break;
|
|
}
|
|
i2++;
|
|
}
|
|
if (i >= 0) {
|
|
return (z ? this.u : this.t).get(i);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
void a(ViewGroup viewGroup) {
|
|
AnimationInfo animationInfo;
|
|
this.t = new ArrayList<>();
|
|
this.u = new ArrayList<>();
|
|
a(this.p, this.q);
|
|
ArrayMap<Animator, AnimationInfo> u = u();
|
|
int size = u.size();
|
|
WindowIdImpl d = ViewUtils.d(viewGroup);
|
|
for (int i = size - 1; i >= 0; i--) {
|
|
Animator b = u.b(i);
|
|
if (b != null && (animationInfo = u.get(b)) != null && animationInfo.a != null && d.equals(animationInfo.d)) {
|
|
TransitionValues transitionValues = animationInfo.c;
|
|
View view = animationInfo.a;
|
|
TransitionValues b2 = b(view, true);
|
|
TransitionValues a = a(view, true);
|
|
if (!(b2 == null && a == null) && animationInfo.e.a(transitionValues, a)) {
|
|
if (!b.isRunning() && !b.isStarted()) {
|
|
u.remove(b);
|
|
} else {
|
|
b.cancel();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
a(viewGroup, this.p, this.q, this.t, this.u);
|
|
s();
|
|
}
|
|
|
|
public boolean a(TransitionValues transitionValues, TransitionValues transitionValues2) {
|
|
if (transitionValues == null || transitionValues2 == null) {
|
|
return false;
|
|
}
|
|
String[] r = r();
|
|
if (r != null) {
|
|
for (String str : r) {
|
|
if (!a(transitionValues, transitionValues2, str)) {
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
Iterator<String> it = transitionValues.a.keySet().iterator();
|
|
while (it.hasNext()) {
|
|
if (a(transitionValues, transitionValues2, it.next())) {
|
|
}
|
|
}
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
private static boolean a(TransitionValues transitionValues, TransitionValues transitionValues2, String str) {
|
|
Object obj = transitionValues.a.get(str);
|
|
Object obj2 = transitionValues2.a.get(str);
|
|
if (obj == null && obj2 == null) {
|
|
return false;
|
|
}
|
|
if (obj == null || obj2 == null) {
|
|
return true;
|
|
}
|
|
return true ^ obj.equals(obj2);
|
|
}
|
|
|
|
protected void a(Animator animator) {
|
|
if (animator == null) {
|
|
a();
|
|
return;
|
|
}
|
|
if (b() >= 0) {
|
|
animator.setDuration(b());
|
|
}
|
|
if (m() >= 0) {
|
|
animator.setStartDelay(m());
|
|
}
|
|
if (i() != null) {
|
|
animator.setInterpolator(i());
|
|
}
|
|
animator.addListener(new AnimatorListenerAdapter() { // from class: androidx.transition.Transition.3
|
|
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
|
public void onAnimationEnd(Animator animator2) {
|
|
Transition.this.a();
|
|
animator2.removeListener(this);
|
|
}
|
|
});
|
|
animator.start();
|
|
}
|
|
|
|
protected void a() {
|
|
this.y--;
|
|
if (this.y == 0) {
|
|
ArrayList<TransitionListener> arrayList = this.B;
|
|
if (arrayList != null && arrayList.size() > 0) {
|
|
ArrayList arrayList2 = (ArrayList) this.B.clone();
|
|
int size = arrayList2.size();
|
|
for (int i = 0; i < size; i++) {
|
|
((TransitionListener) arrayList2.get(i)).c(this);
|
|
}
|
|
}
|
|
for (int i2 = 0; i2 < this.p.c.b(); i2++) {
|
|
View c = this.p.c.c(i2);
|
|
if (c != null) {
|
|
ViewCompat.b(c, false);
|
|
}
|
|
}
|
|
for (int i3 = 0; i3 < this.q.c.b(); i3++) {
|
|
View c2 = this.q.c.c(i3);
|
|
if (c2 != null) {
|
|
ViewCompat.b(c2, false);
|
|
}
|
|
}
|
|
this.A = true;
|
|
}
|
|
}
|
|
|
|
public Transition a(TransitionListener transitionListener) {
|
|
if (this.B == null) {
|
|
this.B = new ArrayList<>();
|
|
}
|
|
this.B.add(transitionListener);
|
|
return this;
|
|
}
|
|
|
|
public void a(PathMotion pathMotion) {
|
|
if (pathMotion == null) {
|
|
this.G = I;
|
|
} else {
|
|
this.G = pathMotion;
|
|
}
|
|
}
|
|
|
|
public void a(EpicenterCallback epicenterCallback) {
|
|
this.E = epicenterCallback;
|
|
}
|
|
|
|
public void a(TransitionPropagation transitionPropagation) {
|
|
this.D = transitionPropagation;
|
|
}
|
|
|
|
String a(String str) {
|
|
String str2 = str + getClass().getSimpleName() + "@" + Integer.toHexString(hashCode()) + ": ";
|
|
if (this.c != -1) {
|
|
str2 = str2 + "dur(" + this.c + ") ";
|
|
}
|
|
if (this.b != -1) {
|
|
str2 = str2 + "dly(" + this.b + ") ";
|
|
}
|
|
if (this.d != null) {
|
|
str2 = str2 + "interp(" + this.d + ") ";
|
|
}
|
|
if (this.e.size() <= 0 && this.f.size() <= 0) {
|
|
return str2;
|
|
}
|
|
String str3 = str2 + "tgts(";
|
|
if (this.e.size() > 0) {
|
|
String str4 = str3;
|
|
for (int i = 0; i < this.e.size(); i++) {
|
|
if (i > 0) {
|
|
str4 = str4 + ", ";
|
|
}
|
|
str4 = str4 + this.e.get(i);
|
|
}
|
|
str3 = str4;
|
|
}
|
|
if (this.f.size() > 0) {
|
|
for (int i2 = 0; i2 < this.f.size(); i2++) {
|
|
if (i2 > 0) {
|
|
str3 = str3 + ", ";
|
|
}
|
|
str3 = str3 + this.f.get(i2);
|
|
}
|
|
}
|
|
return str3 + ")";
|
|
}
|
|
}
|