diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusIconContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusIconContainer.java index 6e36c019bb284..1096a6e4d818e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusIconContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusIconContainer.java @@ -369,8 +369,18 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout { public int visibleState = STATE_ICON; public boolean justAdded = true; + // How far we are from the end of the view actually is the most relevant for animation + float distanceToViewEnd = -1; + @Override public void applyToView(View view) { + float parentWidth = 0; + if (view.getParent() instanceof View) { + parentWidth = ((View) view.getParent()).getWidth(); + } + + float currentDistanceToEnd = parentWidth - xTranslation; + if (!(view instanceof StatusIconDisplayable)) { return; } @@ -394,7 +404,7 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout { // all other transitions (to/from dot, etc) animationProperties = ANIMATE_ALL_PROPERTIES; } - } else if (visibleState != STATE_HIDDEN && xTranslation != view.getTranslationX()) { + } else if (visibleState != STATE_HIDDEN && distanceToViewEnd != currentDistanceToEnd) { // Visibility isn't changing, just animate position animationProperties = X_ANIMATION_PROPERTIES; } @@ -407,6 +417,8 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout { } justAdded = false; + distanceToViewEnd = currentDistanceToEnd; + } }