Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public open class NavigationDelegate(

public var currentNavigableSetup: ((NavigableCompat) -> Unit)? = null

private var activeTransition: MagellanTransition? = null
private var templatedViewMap = HashMap<NavigableCompat, View>()

protected var containerView: ScreenContainer? = null
Expand Down Expand Up @@ -65,7 +64,6 @@ public open class NavigationDelegate(
override fun onHide(context: Context) {
containerView = null
templatedViewMap.clear()
activeTransition = null
}

override fun onDestroy(context: Context) {
Expand All @@ -77,7 +75,6 @@ public open class NavigationDelegate(
direction: Direction,
backStackOperation: (Deque<NavigationEvent>) -> MagellanTransition
) {
activeTransition?.interrupt()
containerView?.setInterceptTouchEvents(true)
navigationPropagator.beforeNavigation()
val oldBackStack = backStack.map { it.navigable }
Expand Down Expand Up @@ -143,14 +140,12 @@ public open class NavigationDelegate(
} else {
NoAnimationTransition()
}
activeTransition = transition
transition.animate(from, to, direction) {
if (context != null && containerView != null) {
containerView!!.removeView(from)
currentNavigable!!.transitionFinished()
navigationPropagator.afterNavigation()
containerView!!.setInterceptTouchEvents(false)
activeTransition = null
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class DefaultTransition : MagellanTransition {
private var animator: Animator? = null

override fun interrupt() {
animator?.cancel()
animator?.end()
}

override fun animate(
Expand All @@ -48,16 +48,15 @@ public class DefaultTransition : MagellanTransition {
): AnimatorSet {
val sign = direction.sign()
val axis: Property<View, Float> = View.TRANSLATION_X
val toTranslation = sign * to.width + (from?.translationX ?: 0f)
val toTranslation = sign * to.width
val set = AnimatorSet()
if (from != null) {
val fromTranslation = sign * -from.width
val fromAnimation = ObjectAnimator.ofFloat(from, axis, from.translationX, fromTranslation.toFloat())
val fromAnimation = ObjectAnimator.ofFloat(from, axis, 0f, fromTranslation.toFloat())
set.play(fromAnimation)
set.duration = (300 * (1.0f - (from.translationX / from.width))).toLong()
}

val toAnimation = ObjectAnimator.ofFloat(to, axis, toTranslation, 0f)
val toAnimation = ObjectAnimator.ofFloat(to, axis, toTranslation.toFloat(), 0f)
set.play(toAnimation)
set.interpolator = FastOutSlowInInterpolator()
return set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ internal class IntroStep(
) : Step<IntroBinding>(IntroBinding::inflate) {

override fun onShow(context: Context, binding: IntroBinding) {
binding.root.tag = "IntroStep"
binding.learnMore.setOnClickListener {
goToLearnMore()
}
Expand Down
1 change: 0 additions & 1 deletion magellan-sample/src/main/res/layout/learn_more.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
android:layout_height="match_parent"
android:background="@color/colorCyan"
android:orientation="vertical"
android:tag="LearnMore"
tools:ignore="Overdraw"
>

Expand Down
Loading