I have set my activity's exitTransition to be something like
window.exitTransition = object : Visibility() {
override fun onDisappear(
sceneRoot: ViewGroup?,
startValues: TransitionValues?,
startVisibility: Int,
endValues: TransitionValues?,
endVisibility: Int
): Animator {
return ValueAnimator.ofFloat(0f, 1f).apply {
addUpdateListener { animator ->
// do something with animator.animatedFraction
}
setDuration(1000)
}
}
}
The enterTransition is similar using onAppear.
When transitioning between activities after setting the transitions:
val intent = Intent(activity, HomeActivity::class.java)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK)
val options = ActivityOptions.makeSceneTransitionAnimation(activity).toBundle()
activity.startActivity(intent, options)
On my Android 11 device, my enter animation gets all of its updates, but the exit animation is played only briefly before being cut off. E.g., the update listener will be called for 0.0 -> 0.3 and then skip straight to 1.0. And the duration I set in the transition object doesn't seem to be respected at all either.
Is there something I'm missing here or is Android's activity transition animation interpolator busted?