From 530bd551e21d6905b02ea17ca48efbf305d5b344 Mon Sep 17 00:00:00 2001 From: Steven Schoen Date: Sun, 11 Aug 2019 09:09:58 -0700 Subject: [PATCH] Fix TransitionChangeHandlers getting stuck when two are run simultaneously (#547) * Fix TransitionChangeHandlers getting stuck when two are run simultaneously * Don't unnecessarily re-execute changes --- .../changehandler/TransitionChangeHandler.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/conductor/src/main/java/com/bluelinelabs/conductor/changehandler/TransitionChangeHandler.java b/conductor/src/main/java/com/bluelinelabs/conductor/changehandler/TransitionChangeHandler.java index dbfbe0f6..9f9992cd 100644 --- a/conductor/src/main/java/com/bluelinelabs/conductor/changehandler/TransitionChangeHandler.java +++ b/conductor/src/main/java/com/bluelinelabs/conductor/changehandler/TransitionChangeHandler.java @@ -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) { @@ -97,6 +106,7 @@ public void onPrepared() { if (!canceled) { TransitionManager.beginDelayedTransition(container, transition); executePropertyChanges(container, from, to, transition, isPush); + container.post(onTransitionNotStarted); } } });