Reputation: 6145
I am currently using a custom shared element transition for when I launch Activity B from activity A. Everything works perfectly.
I want to use another custom Transition
that doesn't involve any shared elements for the return transition from activity B back to activity A. However, I am having trouble with several parts:
Appreciate any help I can get!
EDIT:
Further investigation revealed that my return transition's createAnimator
isn't even being called even though I'm calling setSharedElementReturnTransition
. But I know the set call is doing something because it now doesn't try to reverse the original enter animation (default behavior) and instead of just overlaps the two views.
EDIT #2:
After looking at George Mount's answer, I added
@Override
public void captureStartValues(TransitionValues transitionValues) {
transitionValues.view.setVisibility(View.VISIBLE);
}
@Override
public void captureEndValues(TransitionValues transitionValues) {
transitionValues.view.setVisibility(View.INVISIBLE);
}
This is now causing my return transition's createAnimator
to at least run albeit the animation is still weird. Why does the visibility matter?
Upvotes: 2
Views: 2497
Reputation: 6145
I actually found the culprit that was causing my return transition's createAnimator
to not run. Apparently, if the transition framework thinks that the starting and ending states for the transitioning views are the same, it won't create an animator. Therefore, adding some dummy but different values into captureStartState
and captureEndState
finally caused my return transition to run properly.
Upvotes: 3
Reputation: 20926
Return Transition: non-shared elements are removed from the scene in Activity B by changing their visibility.
Shared Element Return Transition: The shared element in Activity B starts where it is when finishAfterTransition
is called and ends where Activity A says the shared element is. This can be adjusted by SharedElementCallback
's onSharedElementStart
and onSharedElementEnd
, which are called in reverse during return.
Reenter Transition: non-shared element views from Activity A change their visibility.
Shared Element Reenter Transition: usually nothing, but the shared element can do something special after it lands in Activity A.
Upvotes: 3