Skip to content

Commit

Permalink
Fix TransitionChangeHandlers getting stuck when two are run simultane…
Browse files Browse the repository at this point in the history
…ously (bluelinelabs#547)

* Fix TransitionChangeHandlers getting stuck when two are run simultaneously

* Don't unnecessarily re-execute changes
  • Loading branch information
DSteve595 authored and EricKuck committed Aug 11, 2019
1 parent e40cdf2 commit 530bd55
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,19 @@ public void performChange(@NonNull final ViewGroup container, @Nullable final Vi
return;
}

final Runnable onTransitionNotStarted = new Runnable() {
@Override
public void run() {
changeListener.onChangeCompleted();
}
};

final Transition transition = getTransition(container, from, to, isPush);
transition.addListener(new TransitionListener() {
@Override
public void onTransitionStart(Transition transition) { }
public void onTransitionStart(Transition transition) {
container.removeCallbacks(onTransitionNotStarted);
}

@Override
public void onTransitionEnd(Transition transition) {
Expand All @@ -97,6 +106,7 @@ public void onPrepared() {
if (!canceled) {
TransitionManager.beginDelayedTransition(container, transition);
executePropertyChanges(container, from, to, transition, isPush);
container.post(onTransitionNotStarted);
}
}
});
Expand Down

0 comments on commit 530bd55

Please sign in to comment.