From a59c51040443c544ed6698b25d09cda29d073c69 Mon Sep 17 00:00:00 2001 From: Sean Amos Date: Sun, 1 Mar 2026 20:50:00 -0500 Subject: [PATCH 1/2] When determining the y translation distance for the default animation, if the target view isn't measured yet, use the parent's width --- .../wealthfront/magellan/transitions/DefaultTransition.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/magellan-library/src/main/java/com/wealthfront/magellan/transitions/DefaultTransition.kt b/magellan-library/src/main/java/com/wealthfront/magellan/transitions/DefaultTransition.kt index 7e2ca88b..2e8ef081 100644 --- a/magellan-library/src/main/java/com/wealthfront/magellan/transitions/DefaultTransition.kt +++ b/magellan-library/src/main/java/com/wealthfront/magellan/transitions/DefaultTransition.kt @@ -48,7 +48,11 @@ public class DefaultTransition : MagellanTransition { ): AnimatorSet { val sign = direction.sign() val axis: Property = View.TRANSLATION_X - val toTranslation = sign * to.width + val toTranslation = if (to.width > 0) { + sign * to.width + } else { + sign * (to.parent as View).width + } val set = AnimatorSet() if (from != null) { val fromTranslation = sign * -from.width From 4b7f79cac762550b4f522125ed4025eb17803f17 Mon Sep 17 00:00:00 2001 From: Sean Amos Date: Fri, 6 Mar 2026 15:55:55 -0500 Subject: [PATCH 2/2] Fix unit test --- .../magellan/transitions/DefaultTransitionTest.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/magellan-library/src/test/java/com/wealthfront/magellan/transitions/DefaultTransitionTest.kt b/magellan-library/src/test/java/com/wealthfront/magellan/transitions/DefaultTransitionTest.kt index ea7d8b11..96453b26 100644 --- a/magellan-library/src/test/java/com/wealthfront/magellan/transitions/DefaultTransitionTest.kt +++ b/magellan-library/src/test/java/com/wealthfront/magellan/transitions/DefaultTransitionTest.kt @@ -2,6 +2,7 @@ package com.wealthfront.magellan.transitions import android.os.Looper.getMainLooper import android.view.View +import android.widget.FrameLayout import androidx.test.core.app.ApplicationProvider.getApplicationContext import com.google.common.truth.Truth.assertThat import com.wealthfront.magellan.Direction @@ -47,6 +48,10 @@ class DefaultTransitionTest { private fun animate(direction: Direction): MagellanTransition { val from = View(getApplicationContext()) val to = View(getApplicationContext()) + FrameLayout(getApplicationContext()).apply { + addView(from) + addView(to) + } return DefaultTransition().apply { animate(from, to, direction) { onAnimationEndCalled = true