what-the-bank/sources/o/WEM.java

672 lines
26 KiB
Java

package o;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.view.View;
import android.view.ViewPropertyAnimator;
import androidx.core.view.ViewCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.airbnb.deeplinkdispatch.UrlTreeKt;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/* loaded from: classes.dex */
public class WEM extends AbstractC17051tZJ {
private static final boolean DEBUG = false;
private static TimeInterpolator sDefaultInterpolator;
private ArrayList<RecyclerView.zJl> mPendingRemovals = new ArrayList<>();
private ArrayList<RecyclerView.zJl> mPendingAdditions = new ArrayList<>();
private ArrayList<Sts> mPendingMoves = new ArrayList<>();
private ArrayList<HBt> mPendingChanges = new ArrayList<>();
ArrayList<ArrayList<RecyclerView.zJl>> mAdditionsList = new ArrayList<>();
ArrayList<ArrayList<Sts>> mMovesList = new ArrayList<>();
ArrayList<ArrayList<HBt>> mChangesList = new ArrayList<>();
ArrayList<RecyclerView.zJl> mAddAnimations = new ArrayList<>();
ArrayList<RecyclerView.zJl> mMoveAnimations = new ArrayList<>();
ArrayList<RecyclerView.zJl> mRemoveAnimations = new ArrayList<>();
ArrayList<RecyclerView.zJl> mChangeAnimations = new ArrayList<>();
/* loaded from: classes.dex */
static class Sts {
public int a;
public int b;
public int c;
public int d;
public RecyclerView.zJl e;
Sts(RecyclerView.zJl zjl, int i, int i2, int i3, int i4) {
this.e = zjl;
this.d = i;
this.c = i2;
this.b = i3;
this.a = i4;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public static class HBt {
public int a;
public int b;
public int c;
public RecyclerView.zJl d;
public RecyclerView.zJl e;
public int i;
private HBt(RecyclerView.zJl zjl, RecyclerView.zJl zjl2) {
this.d = zjl;
this.e = zjl2;
}
HBt(RecyclerView.zJl zjl, RecyclerView.zJl zjl2, int i, int i2, int i3, int i4) {
this(zjl, zjl2);
this.b = i;
this.c = i2;
this.a = i3;
this.i = i4;
}
public String toString() {
StringBuilder sb = new StringBuilder("ChangeInfo{oldHolder=");
sb.append(this.d);
sb.append(", newHolder=");
sb.append(this.e);
sb.append(", fromX=");
sb.append(this.b);
sb.append(", fromY=");
sb.append(this.c);
sb.append(", toX=");
sb.append(this.a);
sb.append(", toY=");
sb.append(this.i);
sb.append(UrlTreeKt.componentParamSuffixChar);
return sb.toString();
}
}
@Override // androidx.recyclerview.widget.RecyclerView.jbe
public void runPendingAnimations() {
boolean z = !this.mPendingRemovals.isEmpty();
boolean z2 = !this.mPendingMoves.isEmpty();
boolean z3 = !this.mPendingChanges.isEmpty();
boolean z4 = !this.mPendingAdditions.isEmpty();
if (z || z2 || z4 || z3) {
Iterator<RecyclerView.zJl> it = this.mPendingRemovals.iterator();
while (it.hasNext()) {
animateRemoveImpl(it.next());
}
this.mPendingRemovals.clear();
if (z2) {
ArrayList<Sts> arrayList = new ArrayList<>();
arrayList.addAll(this.mPendingMoves);
this.mMovesList.add(arrayList);
this.mPendingMoves.clear();
Runnable runnable = new Runnable(this, arrayList) { // from class: o.WEM.4
final ArrayList b;
final WEM d;
{
this.d = this;
this.b = arrayList;
}
@Override // java.lang.Runnable
public final void run() {
Iterator it2 = this.b.iterator();
while (it2.hasNext()) {
Sts sts = (Sts) it2.next();
this.d.animateMoveImpl(sts.e, sts.d, sts.c, sts.b, sts.a);
}
this.b.clear();
this.d.mMovesList.remove(this.b);
}
};
if (z) {
ViewCompat.b(arrayList.get(0).e.itemView, runnable, getRemoveDuration());
} else {
runnable.run();
}
}
if (z3) {
ArrayList<HBt> arrayList2 = new ArrayList<>();
arrayList2.addAll(this.mPendingChanges);
this.mChangesList.add(arrayList2);
this.mPendingChanges.clear();
Runnable runnable2 = new Runnable(this, arrayList2) { // from class: o.WEM.1
final WEM a;
final ArrayList e;
{
this.a = this;
this.e = arrayList2;
}
@Override // java.lang.Runnable
public final void run() {
Iterator it2 = this.e.iterator();
while (it2.hasNext()) {
this.a.animateChangeImpl((HBt) it2.next());
}
this.e.clear();
this.a.mChangesList.remove(this.e);
}
};
if (z) {
ViewCompat.b(arrayList2.get(0).d.itemView, runnable2, getRemoveDuration());
} else {
runnable2.run();
}
}
if (z4) {
ArrayList<RecyclerView.zJl> arrayList3 = new ArrayList<>();
arrayList3.addAll(this.mPendingAdditions);
this.mAdditionsList.add(arrayList3);
this.mPendingAdditions.clear();
Runnable runnable3 = new Runnable(this, arrayList3) { // from class: o.WEM.3
final ArrayList a;
final WEM b;
{
this.b = this;
this.a = arrayList3;
}
@Override // java.lang.Runnable
public final void run() {
Iterator it2 = this.a.iterator();
while (it2.hasNext()) {
this.b.animateAddImpl((RecyclerView.zJl) it2.next());
}
this.a.clear();
this.b.mAdditionsList.remove(this.a);
}
};
if (z || z2 || z3) {
ViewCompat.b(arrayList3.get(0).itemView, runnable3, (z ? getRemoveDuration() : 0L) + Math.max(z2 ? getMoveDuration() : 0L, z3 ? getChangeDuration() : 0L));
} else {
runnable3.run();
}
}
}
}
@Override // o.AbstractC17051tZJ
public boolean animateRemove(RecyclerView.zJl zjl) {
resetAnimation(zjl);
this.mPendingRemovals.add(zjl);
return true;
}
private void animateRemoveImpl(RecyclerView.zJl zjl) {
View view = zjl.itemView;
ViewPropertyAnimator animate = view.animate();
this.mRemoveAnimations.add(zjl);
animate.setDuration(getRemoveDuration()).alpha(BitmapDescriptorFactory.HUE_RED).setListener(new AnimatorListenerAdapter(this, zjl, animate, view) { // from class: o.WEM.5
final RecyclerView.zJl a;
final ViewPropertyAnimator b;
final WEM d;
final View e;
{
this.d = this;
this.a = zjl;
this.b = animate;
this.e = view;
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationStart(Animator animator) {
this.d.dispatchRemoveStarting(this.a);
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationEnd(Animator animator) {
this.b.setListener(null);
this.e.setAlpha(1.0f);
this.d.dispatchRemoveFinished(this.a);
this.d.mRemoveAnimations.remove(this.a);
this.d.dispatchFinishedWhenDone();
}
}).start();
}
@Override // o.AbstractC17051tZJ
public boolean animateAdd(RecyclerView.zJl zjl) {
resetAnimation(zjl);
zjl.itemView.setAlpha(BitmapDescriptorFactory.HUE_RED);
this.mPendingAdditions.add(zjl);
return true;
}
void animateAddImpl(RecyclerView.zJl zjl) {
View view = zjl.itemView;
ViewPropertyAnimator animate = view.animate();
this.mAddAnimations.add(zjl);
animate.alpha(1.0f).setDuration(getAddDuration()).setListener(new AnimatorListenerAdapter(this, zjl, view, animate) { // from class: o.WEM.2
final WEM a;
final ViewPropertyAnimator b;
final RecyclerView.zJl c;
final View e;
{
this.a = this;
this.c = zjl;
this.e = view;
this.b = animate;
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationStart(Animator animator) {
this.a.dispatchAddStarting(this.c);
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationCancel(Animator animator) {
this.e.setAlpha(1.0f);
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationEnd(Animator animator) {
this.b.setListener(null);
this.a.dispatchAddFinished(this.c);
this.a.mAddAnimations.remove(this.c);
this.a.dispatchFinishedWhenDone();
}
}).start();
}
@Override // o.AbstractC17051tZJ
public boolean animateMove(RecyclerView.zJl zjl, int i, int i2, int i3, int i4) {
View view = zjl.itemView;
int translationX = i + ((int) zjl.itemView.getTranslationX());
int translationY = i2 + ((int) zjl.itemView.getTranslationY());
resetAnimation(zjl);
int i5 = i3 - translationX;
int i6 = i4 - translationY;
if (i5 == 0 && i6 == 0) {
dispatchMoveFinished(zjl);
return false;
}
if (i5 != 0) {
view.setTranslationX(-i5);
}
if (i6 != 0) {
view.setTranslationY(-i6);
}
this.mPendingMoves.add(new Sts(zjl, translationX, translationY, i3, i4));
return true;
}
void animateMoveImpl(RecyclerView.zJl zjl, int i, int i2, int i3, int i4) {
View view = zjl.itemView;
int i5 = i3 - i;
int i6 = i4 - i2;
if (i5 != 0) {
view.animate().translationX(BitmapDescriptorFactory.HUE_RED);
}
if (i6 != 0) {
view.animate().translationY(BitmapDescriptorFactory.HUE_RED);
}
ViewPropertyAnimator animate = view.animate();
this.mMoveAnimations.add(zjl);
animate.setDuration(getMoveDuration()).setListener(new AnimatorListenerAdapter(this, zjl, i5, view, i6, animate) { // from class: o.WEM.8
final int a;
final RecyclerView.zJl b;
final WEM c;
final int d;
final ViewPropertyAnimator e;
final View i;
{
this.c = this;
this.b = zjl;
this.d = i5;
this.i = view;
this.a = i6;
this.e = animate;
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationStart(Animator animator) {
this.c.dispatchMoveStarting(this.b);
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationCancel(Animator animator) {
if (this.d != 0) {
this.i.setTranslationX(BitmapDescriptorFactory.HUE_RED);
}
if (this.a != 0) {
this.i.setTranslationY(BitmapDescriptorFactory.HUE_RED);
}
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationEnd(Animator animator) {
this.e.setListener(null);
this.c.dispatchMoveFinished(this.b);
this.c.mMoveAnimations.remove(this.b);
this.c.dispatchFinishedWhenDone();
}
}).start();
}
@Override // o.AbstractC17051tZJ
public boolean animateChange(RecyclerView.zJl zjl, RecyclerView.zJl zjl2, int i, int i2, int i3, int i4) {
if (zjl == zjl2) {
return animateMove(zjl, i, i2, i3, i4);
}
float translationX = zjl.itemView.getTranslationX();
float translationY = zjl.itemView.getTranslationY();
float alpha = zjl.itemView.getAlpha();
resetAnimation(zjl);
int i5 = (int) ((i3 - i) - translationX);
int i6 = (int) ((i4 - i2) - translationY);
zjl.itemView.setTranslationX(translationX);
zjl.itemView.setTranslationY(translationY);
zjl.itemView.setAlpha(alpha);
if (zjl2 != null) {
resetAnimation(zjl2);
zjl2.itemView.setTranslationX(-i5);
zjl2.itemView.setTranslationY(-i6);
zjl2.itemView.setAlpha(BitmapDescriptorFactory.HUE_RED);
}
this.mPendingChanges.add(new HBt(zjl, zjl2, i, i2, i3, i4));
return true;
}
void animateChangeImpl(HBt hBt) {
RecyclerView.zJl zjl = hBt.d;
View view = zjl == null ? null : zjl.itemView;
RecyclerView.zJl zjl2 = hBt.e;
View view2 = zjl2 != null ? zjl2.itemView : null;
if (view != null) {
ViewPropertyAnimator duration = view.animate().setDuration(getChangeDuration());
this.mChangeAnimations.add(hBt.d);
duration.translationX(hBt.a - hBt.b);
duration.translationY(hBt.i - hBt.c);
duration.alpha(BitmapDescriptorFactory.HUE_RED).setListener(new AnimatorListenerAdapter(this, hBt, duration, view) { // from class: o.WEM.9
final View a;
final WEM b;
final HBt c;
final ViewPropertyAnimator e;
{
this.b = this;
this.c = hBt;
this.e = duration;
this.a = view;
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationStart(Animator animator) {
this.b.dispatchChangeStarting(this.c.d, true);
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationEnd(Animator animator) {
this.e.setListener(null);
this.a.setAlpha(1.0f);
this.a.setTranslationX(BitmapDescriptorFactory.HUE_RED);
this.a.setTranslationY(BitmapDescriptorFactory.HUE_RED);
this.b.dispatchChangeFinished(this.c.d, true);
this.b.mChangeAnimations.remove(this.c.d);
this.b.dispatchFinishedWhenDone();
}
}).start();
}
if (view2 != null) {
ViewPropertyAnimator animate = view2.animate();
this.mChangeAnimations.add(hBt.e);
animate.translationX(BitmapDescriptorFactory.HUE_RED).translationY(BitmapDescriptorFactory.HUE_RED).setDuration(getChangeDuration()).alpha(1.0f).setListener(new AnimatorListenerAdapter(this, hBt, animate, view2) { // from class: o.WEM.7
final WEM b;
final View c;
final ViewPropertyAnimator d;
final HBt e;
{
this.b = this;
this.e = hBt;
this.d = animate;
this.c = view2;
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationStart(Animator animator) {
this.b.dispatchChangeStarting(this.e.e, false);
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationEnd(Animator animator) {
this.d.setListener(null);
this.c.setAlpha(1.0f);
this.c.setTranslationX(BitmapDescriptorFactory.HUE_RED);
this.c.setTranslationY(BitmapDescriptorFactory.HUE_RED);
this.b.dispatchChangeFinished(this.e.e, false);
this.b.mChangeAnimations.remove(this.e.e);
this.b.dispatchFinishedWhenDone();
}
}).start();
}
}
private void endChangeAnimation(List<HBt> list, RecyclerView.zJl zjl) {
for (int size = list.size() - 1; size >= 0; size--) {
HBt hBt = list.get(size);
if (endChangeAnimationIfNecessary(hBt, zjl) && hBt.d == null && hBt.e == null) {
list.remove(hBt);
}
}
}
private void endChangeAnimationIfNecessary(HBt hBt) {
if (hBt.d != null) {
endChangeAnimationIfNecessary(hBt, hBt.d);
}
if (hBt.e != null) {
endChangeAnimationIfNecessary(hBt, hBt.e);
}
}
private boolean endChangeAnimationIfNecessary(HBt hBt, RecyclerView.zJl zjl) {
boolean z = false;
if (hBt.e == zjl) {
hBt.e = null;
} else {
if (hBt.d != zjl) {
return false;
}
hBt.d = null;
z = true;
}
zjl.itemView.setAlpha(1.0f);
zjl.itemView.setTranslationX(BitmapDescriptorFactory.HUE_RED);
zjl.itemView.setTranslationY(BitmapDescriptorFactory.HUE_RED);
dispatchChangeFinished(zjl, z);
return true;
}
@Override // androidx.recyclerview.widget.RecyclerView.jbe
public void endAnimation(RecyclerView.zJl zjl) {
View view = zjl.itemView;
view.animate().cancel();
int size = this.mPendingMoves.size();
while (true) {
size--;
if (size < 0) {
break;
}
if (this.mPendingMoves.get(size).e == zjl) {
view.setTranslationY(BitmapDescriptorFactory.HUE_RED);
view.setTranslationX(BitmapDescriptorFactory.HUE_RED);
dispatchMoveFinished(zjl);
this.mPendingMoves.remove(size);
}
}
endChangeAnimation(this.mPendingChanges, zjl);
if (this.mPendingRemovals.remove(zjl)) {
view.setAlpha(1.0f);
dispatchRemoveFinished(zjl);
}
if (this.mPendingAdditions.remove(zjl)) {
view.setAlpha(1.0f);
dispatchAddFinished(zjl);
}
for (int size2 = this.mChangesList.size() - 1; size2 >= 0; size2--) {
ArrayList<HBt> arrayList = this.mChangesList.get(size2);
endChangeAnimation(arrayList, zjl);
if (arrayList.isEmpty()) {
this.mChangesList.remove(size2);
}
}
for (int size3 = this.mMovesList.size() - 1; size3 >= 0; size3--) {
ArrayList<Sts> arrayList2 = this.mMovesList.get(size3);
int size4 = arrayList2.size() - 1;
while (true) {
if (size4 < 0) {
break;
}
if (arrayList2.get(size4).e == zjl) {
view.setTranslationY(BitmapDescriptorFactory.HUE_RED);
view.setTranslationX(BitmapDescriptorFactory.HUE_RED);
dispatchMoveFinished(zjl);
arrayList2.remove(size4);
if (arrayList2.isEmpty()) {
this.mMovesList.remove(size3);
}
} else {
size4--;
}
}
}
for (int size5 = this.mAdditionsList.size() - 1; size5 >= 0; size5--) {
ArrayList<RecyclerView.zJl> arrayList3 = this.mAdditionsList.get(size5);
if (arrayList3.remove(zjl)) {
view.setAlpha(1.0f);
dispatchAddFinished(zjl);
if (arrayList3.isEmpty()) {
this.mAdditionsList.remove(size5);
}
}
}
this.mRemoveAnimations.remove(zjl);
this.mAddAnimations.remove(zjl);
this.mChangeAnimations.remove(zjl);
this.mMoveAnimations.remove(zjl);
dispatchFinishedWhenDone();
}
private void resetAnimation(RecyclerView.zJl zjl) {
if (sDefaultInterpolator == null) {
sDefaultInterpolator = new ValueAnimator().getInterpolator();
}
zjl.itemView.animate().setInterpolator(sDefaultInterpolator);
endAnimation(zjl);
}
@Override // androidx.recyclerview.widget.RecyclerView.jbe
public boolean isRunning() {
return (this.mPendingAdditions.isEmpty() && this.mPendingChanges.isEmpty() && this.mPendingMoves.isEmpty() && this.mPendingRemovals.isEmpty() && this.mMoveAnimations.isEmpty() && this.mRemoveAnimations.isEmpty() && this.mAddAnimations.isEmpty() && this.mChangeAnimations.isEmpty() && this.mMovesList.isEmpty() && this.mAdditionsList.isEmpty() && this.mChangesList.isEmpty()) ? false : true;
}
void dispatchFinishedWhenDone() {
if (isRunning()) {
return;
}
dispatchAnimationsFinished();
}
@Override // androidx.recyclerview.widget.RecyclerView.jbe
public void endAnimations() {
int size = this.mPendingMoves.size();
while (true) {
size--;
if (size < 0) {
break;
}
Sts sts = this.mPendingMoves.get(size);
View view = sts.e.itemView;
view.setTranslationY(BitmapDescriptorFactory.HUE_RED);
view.setTranslationX(BitmapDescriptorFactory.HUE_RED);
dispatchMoveFinished(sts.e);
this.mPendingMoves.remove(size);
}
for (int size2 = this.mPendingRemovals.size() - 1; size2 >= 0; size2--) {
dispatchRemoveFinished(this.mPendingRemovals.get(size2));
this.mPendingRemovals.remove(size2);
}
int size3 = this.mPendingAdditions.size();
while (true) {
size3--;
if (size3 < 0) {
break;
}
RecyclerView.zJl zjl = this.mPendingAdditions.get(size3);
zjl.itemView.setAlpha(1.0f);
dispatchAddFinished(zjl);
this.mPendingAdditions.remove(size3);
}
for (int size4 = this.mPendingChanges.size() - 1; size4 >= 0; size4--) {
endChangeAnimationIfNecessary(this.mPendingChanges.get(size4));
}
this.mPendingChanges.clear();
if (isRunning()) {
for (int size5 = this.mMovesList.size() - 1; size5 >= 0; size5--) {
ArrayList<Sts> arrayList = this.mMovesList.get(size5);
for (int size6 = arrayList.size() - 1; size6 >= 0; size6--) {
Sts sts2 = arrayList.get(size6);
View view2 = sts2.e.itemView;
view2.setTranslationY(BitmapDescriptorFactory.HUE_RED);
view2.setTranslationX(BitmapDescriptorFactory.HUE_RED);
dispatchMoveFinished(sts2.e);
arrayList.remove(size6);
if (arrayList.isEmpty()) {
this.mMovesList.remove(arrayList);
}
}
}
for (int size7 = this.mAdditionsList.size() - 1; size7 >= 0; size7--) {
ArrayList<RecyclerView.zJl> arrayList2 = this.mAdditionsList.get(size7);
for (int size8 = arrayList2.size() - 1; size8 >= 0; size8--) {
RecyclerView.zJl zjl2 = arrayList2.get(size8);
zjl2.itemView.setAlpha(1.0f);
dispatchAddFinished(zjl2);
arrayList2.remove(size8);
if (arrayList2.isEmpty()) {
this.mAdditionsList.remove(arrayList2);
}
}
}
for (int size9 = this.mChangesList.size() - 1; size9 >= 0; size9--) {
ArrayList<HBt> arrayList3 = this.mChangesList.get(size9);
for (int size10 = arrayList3.size() - 1; size10 >= 0; size10--) {
endChangeAnimationIfNecessary(arrayList3.get(size10));
if (arrayList3.isEmpty()) {
this.mChangesList.remove(arrayList3);
}
}
}
cancelAll(this.mRemoveAnimations);
cancelAll(this.mMoveAnimations);
cancelAll(this.mAddAnimations);
cancelAll(this.mChangeAnimations);
dispatchAnimationsFinished();
}
}
void cancelAll(List<RecyclerView.zJl> list) {
for (int size = list.size() - 1; size >= 0; size--) {
list.get(size).itemView.animate().cancel();
}
}
@Override // androidx.recyclerview.widget.RecyclerView.jbe
public boolean canReuseUpdatedViewHolder(RecyclerView.zJl zjl, List<Object> list) {
return !list.isEmpty() || super.canReuseUpdatedViewHolder(zjl, list);
}
}