I made a simple sample to prove that there is something wrong with ActivityOptions.makeSceneTransitionAnimation(activity)
.
I got 3 activities: A, B & C. Flow is simple: A -> B -> C
All activities share the same style:
<style name="TransitionsTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="android:windowEnterTransition">@transition/slide_in_from_bottom</item>
<item name="android:windowExitTransition">@transition/slide_out_to_bottom</item>
</style>
Whenever I go: A -> B -> C -> B (back button) -> A (back button)
last animation(A -> C)
is not played.
It works fine when only doing A -> B -> A (back button)
Here is how I start activities:
fun start(activity: Activity) {
val intent = Intent(activity, TransitionActivityA::class.java) //or B or C
val transitionsOptions = ActivityOptions.makeSceneTransitionAnimation(activity)
activity.startActivity(intent, transitionsOptions.toBundle())
}
App demonstrating the issue: https://github.com/jkwiecien/AndroidCaseStudies/tree/transitions
Use branch transitions
Is that an Android bug or am I doing something wrong?