Merge "Make sure the color background is only cleared once" into sc-v2-dev am: f68d0b927f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16006492 Change-Id: Ibf24ad31c0e11b9d77f5d0cc582ad7f56331dd58
This commit is contained in:
@@ -111,6 +111,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@@ -2835,8 +2836,18 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
|
|||||||
taskDisplayArea.setBackgroundColor(backgroundColor);
|
taskDisplayArea.setBackgroundColor(backgroundColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Atomic counter to make sure the clearColor callback is only called one.
|
||||||
|
// It will be called twice in the case we cancel the animation without restart
|
||||||
|
// (in that case it will run as the cancel and finished callbacks).
|
||||||
|
final AtomicInteger callbackCounter = new AtomicInteger(0);
|
||||||
|
final Runnable clearBackgroundColorHandler = () -> {
|
||||||
|
if (callbackCounter.getAndIncrement() == 0) {
|
||||||
|
taskDisplayArea.clearBackgroundColor();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
final Runnable cleanUpCallback = isSettingBackgroundColor
|
final Runnable cleanUpCallback = isSettingBackgroundColor
|
||||||
? taskDisplayArea::clearBackgroundColor : () -> {};
|
? clearBackgroundColorHandler : () -> {};
|
||||||
|
|
||||||
startAnimation(getPendingTransaction(), adapter, !isVisible(),
|
startAnimation(getPendingTransaction(), adapter, !isVisible(),
|
||||||
ANIMATION_TYPE_APP_TRANSITION, (type, anim) -> cleanUpCallback.run(),
|
ANIMATION_TYPE_APP_TRANSITION, (type, anim) -> cleanUpCallback.run(),
|
||||||
|
|||||||
Reference in New Issue
Block a user