0

I have two main activities - a list view (using the RecyclerView), and a detailed page. Each item in the list has a small image, and when clicking on an item in the list, I have an animation (using a shared element transition) that makes the image larger, and it takes up the upper half of the screen.

The bottom half of the detailed activity, has many details in various layouts.

My problem is that during the shared element transition of the image, I see all the details just appearing on the overlay.
I would like for the detailed activity to wait for the shared element transition to finish, and then slide in the details from the bottom of the page.

I searched the internet for this, but all the posts I found on the subject are either too old, or don't have enough details, so I couldn't get them to work.

Things I tried already :

  • In the detailed view, in onCreate() I tried creating a TransitionSet object with a delayed slide transition, and call getContentTransitionManager().beginDelayedTransition(). This didn't seem to do anything.
  • Creating the same TransitionSet object and calling getWindow().setEnterTransition(myTransitionSet) but this also doesn't seem to work.

I have defined getWindow().requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS); in the beginning of the onCreate() method in the detailed activity.

I'm sure I'm just missing something, I just have no idea what...

Floern
  • 33,559
  • 24
  • 104
  • 119
gillyb
  • 8,760
  • 8
  • 53
  • 80
  • You can listen for events like when the transition finishes by adding a `TransitionListener` to it. However be aware the you still have to pick the correct transition from the `Window` instance of your `Activity`. – Xaver Kapeller Nov 24 '15 at 20:07
  • Ok, but the much bigger problem for me is that I can't get the slide in transition to even work... – gillyb Nov 24 '15 at 20:10
  • How come? What exactly is failing? Please edit the part of your code which animates the details into your question. – Xaver Kapeller Nov 24 '15 at 20:13
  • You are using a `TransitionSet` to animate the details? I can see where you are coming from - and this approach can indeed work if you use the correct transition - but you will be far better off by animating the details just normally with an `ObjectAnimator`. Start the animation in the callback of the shared element transition and you should be fine. – Xaver Kapeller Nov 24 '15 at 20:15
  • I'm not familiar with `ObjectAnimator`.. I'll look it up. – gillyb Nov 24 '15 at 20:18
  • What else are you using to perform animations besides `Animators`? Transitions actually use `ObjectAnimator`s to do the actual animating. The main thing that transitions do is automatically getting start and end values for animations and then automatically generating `Animator` instances which execute that animation instead of the developer having the create the `Animator`s themselves. – Xaver Kapeller Nov 24 '15 at 20:24
  • have you found the solution? – Andrey Solera Jun 01 '18 at 02:30
  • @Andrea no, I haven't, but I also changed the transition completely, so the exact answer isn't relevant to me anymore. I will leave this question here since the comments (or future answer) might hopefully help others as well. – gillyb Jun 01 '18 at 17:16

0 Answers0