I'm animating between scenes using the TransitionManager
and constraint sets using the following code.
val transition = AutoTransition()
transition.addListener(object : Transition.TransitionListener {
override fun onTransitionEnd(transition: Transition) {
// do something
}
})
val constraintSet = ConstraintSet()
constraintSet.clone(this, R.layout.frame_loading)
TransitionManager.beginDelayedTransition(rootLayout, transition)
constraintSet.applyTo(rootLayout)
There's something I want to do when the transition ends, hence the callback. However there are situations when there are views to change and when there are no views to change. When there is nothing to change there is no transition and the callback is not called (as explained here), which is a problem because the action that's supposed to run on transition end is not run. Is there good way of solving this that's not some hack like moving an invisible view or other ways to force a predraw event (which triggers the transition)? Or is there a way to check if the transition is required or not?