summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Joshua Tsuji <tsuji@google.com> 2020-03-16 15:52:47 -0400
committer Joshua Tsuji <tsuji@google.com> 2020-03-16 17:51:59 -0400
commitd1b9cb77f6fc9f8da8440705e091a0711cd6010f (patch)
treea047f9d6e50102f823eb2fb23ffebea58c89dc15
parent259c66b8b05c45cb7558c36eba5227fbdd5758ca (diff)
Surprisingly you can translate to Float.MIN_VALUE - stackPos.y, but you should not.
Test: open/close IME with a flyout open, with bubbles both below and above the IME Fixes: 141780462 Change-Id: Ib45068a8f01d41a5e6e74bb101f7706e08619fd0
-rw-r--r--packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java24
1 files changed, 14 insertions, 10 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java b/packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java
index b63ba6fe5d14..7ee162e03dbc 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java
@@ -89,6 +89,9 @@ public class StackAnimationController extends
private static final int SPRING_AFTER_FLING_STIFFNESS = 750;
private static final float SPRING_AFTER_FLING_DAMPING_RATIO = 0.85f;
+ /** Sentinel value for unset position value. */
+ private static final float UNSET = -Float.MIN_VALUE;
+
/**
* Minimum fling velocity required to trigger moving the stack from one side of the screen to
* the other.
@@ -133,7 +136,7 @@ public class StackAnimationController extends
* The Y position of the stack before the IME became visible, or {@link Float#MIN_VALUE} if the
* IME is not visible or the user moved the stack since the IME became visible.
*/
- private float mPreImeY = Float.MIN_VALUE;
+ private float mPreImeY = UNSET;
/**
* Animations on the stack position itself, which would have been started in
@@ -263,7 +266,7 @@ public class StackAnimationController extends
// If we manually move the bubbles with the IME open, clear the return point since we don't
// want the stack to snap away from the new position.
- mPreImeY = Float.MIN_VALUE;
+ mPreImeY = UNSET;
moveFirstBubbleWithStackFollowing(DynamicAnimation.TRANSLATION_X, x);
moveFirstBubbleWithStackFollowing(DynamicAnimation.TRANSLATION_Y, y);
@@ -512,26 +515,27 @@ public class StackAnimationController extends
* Animates the stack either away from the newly visible IME, or back to its original position
* due to the IME going away.
*
- * @return The destination Y value of the stack due to the IME movement.
+ * @return The destination Y value of the stack due to the IME movement (or the current position
+ * of the stack if it's not moving).
*/
public float animateForImeVisibility(boolean imeVisible) {
final float maxBubbleY = getAllowableStackPositionRegion().bottom;
- float destinationY = Float.MIN_VALUE;
+ float destinationY = UNSET;
if (imeVisible) {
// Stack is lower than it should be and overlaps the now-visible IME.
- if (mStackPosition.y > maxBubbleY && mPreImeY == Float.MIN_VALUE) {
+ if (mStackPosition.y > maxBubbleY && mPreImeY == UNSET) {
mPreImeY = mStackPosition.y;
destinationY = maxBubbleY;
}
} else {
- if (mPreImeY > Float.MIN_VALUE) {
+ if (mPreImeY != UNSET) {
destinationY = mPreImeY;
- mPreImeY = Float.MIN_VALUE;
+ mPreImeY = UNSET;
}
}
- if (destinationY > Float.MIN_VALUE) {
+ if (destinationY != UNSET) {
springFirstBubbleWithStackFollowing(
DynamicAnimation.TRANSLATION_Y,
getSpringForce(DynamicAnimation.TRANSLATION_Y, /* view */ null)
@@ -542,7 +546,7 @@ public class StackAnimationController extends
notifyFloatingCoordinatorStackAnimatingTo(mStackPosition.x, destinationY);
}
- return destinationY;
+ return destinationY != UNSET ? destinationY : mStackPosition.y;
}
/**
@@ -595,7 +599,7 @@ public class StackAnimationController extends
mLayout.getHeight()
- mBubbleSize
- mBubblePaddingTop
- - (mImeHeight > Float.MIN_VALUE ? mImeHeight + mBubblePaddingTop : 0f)
+ - (mImeHeight != UNSET ? mImeHeight + mBubblePaddingTop : 0f)
- Math.max(
insets.getStableInsetBottom(),
insets.getDisplayCutout() != null