package androidx.transition; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.PointF; import android.graphics.Rect; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.util.Property; import android.view.View; import android.view.ViewGroup; import androidx.core.view.ViewCompat; import com.ubt.jimu.course.view.fragment.JimuMissionListFragment; import java.util.Map; /* loaded from: classes.dex */ public class ChangeBounds extends Transition { private static final Property P; private static final Property Q; private static final Property R; private static final Property S; private int[] K = new int[2]; private boolean L = false; private boolean M = false; private static final String[] N = {"android:changeBounds:bounds", "android:changeBounds:clip", "android:changeBounds:parent", "android:changeBounds:windowX", "android:changeBounds:windowY"}; private static final Property O = new Property(PointF.class, "boundsOrigin") { // from class: androidx.transition.ChangeBounds.1 private Rect a = new Rect(); @Override // android.util.Property /* renamed from: a, reason: merged with bridge method [inline-methods] */ public void set(Drawable drawable, PointF pointF) { drawable.copyBounds(this.a); this.a.offsetTo(Math.round(pointF.x), Math.round(pointF.y)); drawable.setBounds(this.a); } @Override // android.util.Property /* renamed from: a, reason: merged with bridge method [inline-methods] */ public PointF get(Drawable drawable) { drawable.copyBounds(this.a); Rect rect = this.a; return new PointF(rect.left, rect.top); } }; private static final Property T = new Property(PointF.class, JimuMissionListFragment.POSITION) { // from class: androidx.transition.ChangeBounds.6 @Override // android.util.Property /* renamed from: a, reason: merged with bridge method [inline-methods] */ public PointF get(View view) { return null; } @Override // android.util.Property /* renamed from: a, reason: merged with bridge method [inline-methods] */ public void set(View view, PointF pointF) { int round = Math.round(pointF.x); int round2 = Math.round(pointF.y); ViewUtils.a(view, round, round2, view.getWidth() + round, view.getHeight() + round2); } }; private static RectEvaluator U = new RectEvaluator(); static { String str = "topLeft"; P = new Property(PointF.class, str) { // from class: androidx.transition.ChangeBounds.2 @Override // android.util.Property /* renamed from: a, reason: merged with bridge method [inline-methods] */ public PointF get(ViewBounds viewBounds) { return null; } @Override // android.util.Property /* renamed from: a, reason: merged with bridge method [inline-methods] */ public void set(ViewBounds viewBounds, PointF pointF) { viewBounds.b(pointF); } }; String str2 = "bottomRight"; Q = new Property(PointF.class, str2) { // from class: androidx.transition.ChangeBounds.3 @Override // android.util.Property /* renamed from: a, reason: merged with bridge method [inline-methods] */ public PointF get(ViewBounds viewBounds) { return null; } @Override // android.util.Property /* renamed from: a, reason: merged with bridge method [inline-methods] */ public void set(ViewBounds viewBounds, PointF pointF) { viewBounds.a(pointF); } }; R = new Property(PointF.class, str2) { // from class: androidx.transition.ChangeBounds.4 @Override // android.util.Property /* renamed from: a, reason: merged with bridge method [inline-methods] */ public PointF get(View view) { return null; } @Override // android.util.Property /* renamed from: a, reason: merged with bridge method [inline-methods] */ public void set(View view, PointF pointF) { ViewUtils.a(view, view.getLeft(), view.getTop(), Math.round(pointF.x), Math.round(pointF.y)); } }; S = new Property(PointF.class, str) { // from class: androidx.transition.ChangeBounds.5 @Override // android.util.Property /* renamed from: a, reason: merged with bridge method [inline-methods] */ public PointF get(View view) { return null; } @Override // android.util.Property /* renamed from: a, reason: merged with bridge method [inline-methods] */ public void set(View view, PointF pointF) { ViewUtils.a(view, Math.round(pointF.x), Math.round(pointF.y), view.getRight(), view.getBottom()); } }; } private void d(TransitionValues transitionValues) { View view = transitionValues.b; if (!ViewCompat.x(view) && view.getWidth() == 0 && view.getHeight() == 0) { return; } transitionValues.a.put("android:changeBounds:bounds", new Rect(view.getLeft(), view.getTop(), view.getRight(), view.getBottom())); transitionValues.a.put("android:changeBounds:parent", transitionValues.b.getParent()); if (this.M) { transitionValues.b.getLocationInWindow(this.K); transitionValues.a.put("android:changeBounds:windowX", Integer.valueOf(this.K[0])); transitionValues.a.put("android:changeBounds:windowY", Integer.valueOf(this.K[1])); } if (this.L) { transitionValues.a.put("android:changeBounds:clip", ViewCompat.e(view)); } } @Override // androidx.transition.Transition public void a(TransitionValues transitionValues) { d(transitionValues); } @Override // androidx.transition.Transition public void c(TransitionValues transitionValues) { d(transitionValues); } @Override // androidx.transition.Transition public String[] r() { return N; } private boolean a(View view, View view2) { if (!this.M) { return true; } TransitionValues a = a(view, true); if (a == null) { if (view == view2) { return true; } } else if (view2 == a.b) { return true; } return false; } private static class ViewBounds { private int a; private int b; private int c; private int d; private View e; private int f; private int g; ViewBounds(View view) { this.e = view; } void a(PointF pointF) { this.c = Math.round(pointF.x); this.d = Math.round(pointF.y); this.g++; if (this.f == this.g) { a(); } } void b(PointF pointF) { this.a = Math.round(pointF.x); this.b = Math.round(pointF.y); this.f++; if (this.f == this.g) { a(); } } private void a() { ViewUtils.a(this.e, this.a, this.b, this.c, this.d); this.f = 0; this.g = 0; } } @Override // androidx.transition.Transition public Animator a(final ViewGroup viewGroup, TransitionValues transitionValues, TransitionValues transitionValues2) { int i; final View view; int i2; Rect rect; ObjectAnimator objectAnimator; Animator a; if (transitionValues == null || transitionValues2 == null) { return null; } Map map = transitionValues.a; Map map2 = transitionValues2.a; ViewGroup viewGroup2 = (ViewGroup) map.get("android:changeBounds:parent"); ViewGroup viewGroup3 = (ViewGroup) map2.get("android:changeBounds:parent"); if (viewGroup2 == null || viewGroup3 == null) { return null; } final View view2 = transitionValues2.b; if (a(viewGroup2, viewGroup3)) { Rect rect2 = (Rect) transitionValues.a.get("android:changeBounds:bounds"); Rect rect3 = (Rect) transitionValues2.a.get("android:changeBounds:bounds"); int i3 = rect2.left; final int i4 = rect3.left; int i5 = rect2.top; final int i6 = rect3.top; int i7 = rect2.right; final int i8 = rect3.right; int i9 = rect2.bottom; final int i10 = rect3.bottom; int i11 = i7 - i3; int i12 = i9 - i5; int i13 = i8 - i4; int i14 = i10 - i6; Rect rect4 = (Rect) transitionValues.a.get("android:changeBounds:clip"); final Rect rect5 = (Rect) transitionValues2.a.get("android:changeBounds:clip"); if ((i11 == 0 || i12 == 0) && (i13 == 0 || i14 == 0)) { i = 0; } else { i = (i3 == i4 && i5 == i6) ? 0 : 1; if (i7 != i8 || i9 != i10) { i++; } } if ((rect4 != null && !rect4.equals(rect5)) || (rect4 == null && rect5 != null)) { i++; } if (i <= 0) { return null; } if (!this.L) { view = view2; ViewUtils.a(view, i3, i5, i7, i9); if (i == 2) { if (i11 == i13 && i12 == i14) { a = ObjectAnimatorUtils.a(view, T, k().a(i3, i5, i4, i6)); } else { final ViewBounds viewBounds = new ViewBounds(view); ObjectAnimator a2 = ObjectAnimatorUtils.a(viewBounds, P, k().a(i3, i5, i4, i6)); ObjectAnimator a3 = ObjectAnimatorUtils.a(viewBounds, Q, k().a(i7, i9, i8, i10)); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(a2, a3); animatorSet.addListener(new AnimatorListenerAdapter(this) { // from class: androidx.transition.ChangeBounds.7 private ViewBounds mViewBounds; { this.mViewBounds = viewBounds; } }); a = animatorSet; } } else if (i3 == i4 && i5 == i6) { a = ObjectAnimatorUtils.a(view, R, k().a(i7, i9, i8, i10)); } else { a = ObjectAnimatorUtils.a(view, S, k().a(i3, i5, i4, i6)); } } else { view = view2; ViewUtils.a(view, i3, i5, Math.max(i11, i13) + i3, Math.max(i12, i14) + i5); ObjectAnimator a4 = (i3 == i4 && i5 == i6) ? null : ObjectAnimatorUtils.a(view, T, k().a(i3, i5, i4, i6)); if (rect4 == null) { i2 = 0; rect = new Rect(0, 0, i11, i12); } else { i2 = 0; rect = rect4; } Rect rect6 = rect5 == null ? new Rect(i2, i2, i13, i14) : rect5; if (rect.equals(rect6)) { objectAnimator = null; } else { ViewCompat.a(view, rect); RectEvaluator rectEvaluator = U; Object[] objArr = new Object[2]; objArr[i2] = rect; objArr[1] = rect6; objectAnimator = ObjectAnimator.ofObject(view, "clipBounds", rectEvaluator, objArr); objectAnimator.addListener(new AnimatorListenerAdapter(this) { // from class: androidx.transition.ChangeBounds.8 private boolean a; @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener public void onAnimationCancel(Animator animator) { this.a = true; } @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener public void onAnimationEnd(Animator animator) { if (this.a) { return; } ViewCompat.a(view, rect5); ViewUtils.a(view, i4, i6, i8, i10); } }); } a = TransitionUtils.a(a4, objectAnimator); } if (view.getParent() instanceof ViewGroup) { final ViewGroup viewGroup4 = (ViewGroup) view.getParent(); ViewGroupUtils.a(viewGroup4, true); a(new TransitionListenerAdapter(this) { // from class: androidx.transition.ChangeBounds.9 boolean a = false; @Override // androidx.transition.TransitionListenerAdapter, androidx.transition.Transition.TransitionListener public void b(Transition transition) { ViewGroupUtils.a(viewGroup4, false); } @Override // androidx.transition.Transition.TransitionListener public void c(Transition transition) { if (!this.a) { ViewGroupUtils.a(viewGroup4, false); } transition.b(this); } @Override // androidx.transition.TransitionListenerAdapter, androidx.transition.Transition.TransitionListener public void d(Transition transition) { ViewGroupUtils.a(viewGroup4, true); } }); } return a; } int intValue = ((Integer) transitionValues.a.get("android:changeBounds:windowX")).intValue(); int intValue2 = ((Integer) transitionValues.a.get("android:changeBounds:windowY")).intValue(); int intValue3 = ((Integer) transitionValues2.a.get("android:changeBounds:windowX")).intValue(); int intValue4 = ((Integer) transitionValues2.a.get("android:changeBounds:windowY")).intValue(); if (intValue == intValue3 && intValue2 == intValue4) { return null; } viewGroup.getLocationInWindow(this.K); Bitmap createBitmap = Bitmap.createBitmap(view2.getWidth(), view2.getHeight(), Bitmap.Config.ARGB_8888); view2.draw(new Canvas(createBitmap)); final BitmapDrawable bitmapDrawable = new BitmapDrawable(createBitmap); final float c = ViewUtils.c(view2); ViewUtils.a(view2, 0.0f); ViewUtils.b(viewGroup).a(bitmapDrawable); PathMotion k = k(); int[] iArr = this.K; ObjectAnimator ofPropertyValuesHolder = ObjectAnimator.ofPropertyValuesHolder(bitmapDrawable, PropertyValuesHolderUtils.a(O, k.a(intValue - iArr[0], intValue2 - iArr[1], intValue3 - iArr[0], intValue4 - iArr[1]))); ofPropertyValuesHolder.addListener(new AnimatorListenerAdapter(this) { // from class: androidx.transition.ChangeBounds.10 @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener public void onAnimationEnd(Animator animator) { ViewUtils.b(viewGroup).b(bitmapDrawable); ViewUtils.a(view2, c); } }); return ofPropertyValuesHolder; } }