Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix support for disappear transitions #743

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,32 @@ void setupTransitions(
}
}

// First, create animation bindings for the previous LayoutState in case there are any
// transitions for disappearing items that are no longer in the new LayoutState.
List<AnimationBinding> currentAnimationBindings = new ArrayList<>();
if (currentLayoutState != null) {
List<Transition> currentTransitions = currentLayoutState.getTransitions();
if (currentTransitions != null) {
for (Transition transition : currentTransitions) {
AnimationBinding binding = createAnimationsForTransition(transition);
if (binding != null) {
currentAnimationBindings.add(binding);
}
}
}
}

// Create animation bindings for the new LayoutState.
createTransitionAnimations(rootTransition);

// Merge the animation bindings from the previous LayoutState with the new one.
if (!currentAnimationBindings.isEmpty()) {
if (mRootAnimationToRun != null) {
currentAnimationBindings.add(mRootAnimationToRun);
}
mRootAnimationToRun = new ParallelBinding(0, currentAnimationBindings);
}

// If we recorded any mount content diffs that didn't result in an animation being created for
// that transition id, clean them up now.
cleanupNonAnimatingAnimationStates();
Expand Down