7

I was playing around with Lollipop's Activity Transition.

I have a button in Activity A which when clicked calls Activity B. In the Activity B, I am overriding onBackPressed() and calling finishAfterTransition()

Activity B just has two relative layout blocks with the background color. I have put a shared element transition from the Button to one of the blocks and it works perfectly. Even the return transition works.

But the problem I am having is that I am not able to cancel the shared element return transition and implement a normal exit transition.

The intent was to slide the two blocks off the screen, top one off the top and bottom one off the bottom. That's not working if I have a shared element transition enabled.

I tried setting the exit transition and setting null to sharedElementReturn transition on Activity B. Not working.

I tried setting the reenter transition on Activity A with the slide transition, but still, the shared element transition is reversed on the back press.

If I turn off the shared element transition, the desired effect is perfect on return from Activity B to A.

Any ideas?

SAurabh
  • 87
  • 17
Manu Joseph
  • 155
  • 1
  • 13
  • I played around a bit and managed to turn off the return transition by setting the SharedReturnTransition on Activity B, but I still can't get it animated on finishAfterTransition() – Manu Joseph Apr 04 '15 at 07:08
  • Do you have a video (i.e. generated using Android Studio's screen capture feature) illustrating the bug? It's hard to visualize the problem you are describing. Some code might help too. – Alex Lockwood Apr 28 '15 at 04:45
  • I'll try and get the video. Right now I am in office and don't have access to my personal laptop. Till that time, the effect I was trying to achieve can be seen in the Google Play Store app. When you click on an app, the icon is "shared element transition"-ed to the next screen. And on back press, the top and bottom part slides off screen. – Manu Joseph Apr 29 '15 at 08:09
  • 4
    If you don't want to use the return transition, you can just call `finish()` in Activity B instead of `finishAfterTransition()`. – karl Feb 08 '16 at 18:45

0 Answers0