Animate the heads up notification into the shade.
Bug: 10001874
Change-Id: I14ece05dbc29a93a551381c6ddc3cbbb8a331430
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index fc6e74e..87fcd79 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -165,6 +165,8 @@
int mIconHPadding = -1;
Display mDisplay;
Point mCurrentDisplaySize = new Point();
+ private float mHeadsUpVerticalOffset;
+ private int[] mPilePosition = new int[2];
StatusBarWindowView mStatusBarWindow;
PhoneStatusBarView mStatusBarView;
@@ -839,7 +841,7 @@
private void addHeadsUpView() {
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT,
- WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL, // below the status bar!
+ WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL, // above the status bar!
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
@@ -2365,6 +2367,8 @@
if (ENABLE_HEADS_UP && mHeadsUpNotificationView != null) {
mHeadsUpNotificationView.setMargin(mNotificationPanelMarginPx);
+ mPile.getLocationOnScreen(mPilePosition);
+ mHeadsUpVerticalOffset = mPilePosition[1] - mNaturalBarHeight;
}
updateCarrierLabelVisibility(false);
@@ -2554,6 +2558,17 @@
mHeadsUpNotificationView.setVisibility(vis ? View.VISIBLE : View.GONE);
}
+ public void animateHeadsUp(boolean animateInto, float frac) {
+ if (!ENABLE_HEADS_UP || mHeadsUpNotificationView == null) return;
+ frac = frac / 0.4f;
+ frac = frac < 1.0f ? frac : 1.0f;
+ float alpha = 1.0f - frac;
+ float offset = mHeadsUpVerticalOffset * frac;
+ offset = animateInto ? offset : 0f;
+ mHeadsUpNotificationView.setAlpha(alpha);
+ mHeadsUpNotificationView.setY(offset);
+ }
+
public void onHeadsUpDismissed() {
if (mInterruptingNotificationEntry == null) return;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
index 247d8aa..1554e2c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
@@ -236,6 +236,8 @@
panel.setAlpha(alpha);
}
+ mBar.animateHeadsUp(mNotificationPanel == panel, mPanelExpandedFractionSum);
+
mBar.updateCarrierLabelVisibility(false);
}
}