I have two actions with one common object, ImageView . Both actions are subclasses of AppCompatActivity , and they have the same theme:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name="android:windowActionBar">false</item> <item name="android:windowContentTransitions">true</item> <item name="android:windowTranslucentStatus">false</item> <item name="android:windowExitTransition">@transition/transition_slide</item> <item name="android:windowEnterTransition">@transition/transition_slide</item> <item name="android:windowSharedElementEnterTransition"> @transition/obj_transition</item> <item name="android:windowSharedElementExitTransition"> @transition/obj_transition</item> </style>
Activity A causes activity B as follows:
Intent intent = new Intent(ActivityA.this, ActivityB.class); ActivityOptionsCompat options = ActivityOptionsCompat .makeSceneTransitionAnimation(ActivityA.this, view, "common_tag"); ActivityCompat .startActivityForResult(ActivityA.this, intent, ACT_B_TAG, options.toBundle());
In step B, I want to start a simple wobble animation in the same general ImageView. If I run the animation using the onCreate method, the result will be pretty ugly because it starts before the transition to activity is complete. Therefore, I am rewriting the onEnterAnimationComplete() method in Activity B:
@Override public void onEnterAnimationComplete() { Log.d(TAG, "ANIMATION COMPLETE"); Animation anim = AnimationUtils.loadAnimation(this, R.anim.wobble); findViewById(R.id.SharedView).startAnimation(anim); }
The problem is that nothing is happening. Transitions of activity and common elements are reproduced, but when they end, another animation does not start. Checking the output of logcat, I see that the method is not even being called. Any thoughts?
source share