Skip to content

Commit 55c9bd7

Browse files
committed
Clear transition after animation end. Also adjust transition duration as a function of the distance the from / to views need to travel.
1 parent 8fac1c6 commit 55c9bd7

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

magellan-library/src/main/java/com/wealthfront/magellan/navigation/NavigationDelegate.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public open class NavigationDelegate(
6565
override fun onHide(context: Context) {
6666
containerView = null
6767
templatedViewMap.clear()
68+
activeTransition = null
6869
}
6970

7071
override fun onDestroy(context: Context) {
@@ -149,6 +150,7 @@ public open class NavigationDelegate(
149150
currentNavigable!!.transitionFinished()
150151
navigationPropagator.afterNavigation()
151152
containerView!!.setInterceptTouchEvents(false)
153+
activeTransition = null
152154
}
153155
}
154156
}

magellan-library/src/main/java/com/wealthfront/magellan/transitions/DefaultTransition.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public class DefaultTransition : MagellanTransition {
5454
val fromTranslation = sign * -from.width
5555
val fromAnimation = ObjectAnimator.ofFloat(from, axis, from.translationX, fromTranslation.toFloat())
5656
set.play(fromAnimation)
57+
set.duration = (300 * (1.0f - (from.translationX / from.width))).toLong()
5758
}
5859

5960
val toAnimation = ObjectAnimator.ofFloat(to, axis, toTranslation, 0f)

magellan-sample/src/main/java/com/wealthfront/magellan/sample/IntroStep.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ internal class IntroStep(
1111
override fun onShow(context: Context, binding: IntroBinding) {
1212
binding.root.tag = "IntroStep"
1313
binding.learnMore.setOnClickListener {
14-
println("viewBinding: $viewBinding")
15-
viewBinding!!
1614
goToLearnMore()
1715
}
1816
}

0 commit comments

Comments
 (0)