Skip to content

Commit 8506149

Browse files
author
John Spurlock
committed
StatusBar: Respond properly to global expand message
Fix timing issue in PhoneStatusBar#animateExpand(). Also, notification panel drag handle (when expanded) reflects movement immediately. To test animateExpand(): $ adb shell service call statusbar 1 Bug: 6629916 Change-Id: I22bb09fc4c9d97c93ba8d7aed8921b60f5ebd610
1 parent f958732 commit 8506149

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ public class PhoneStatusBar extends BaseStatusBar {
165165
ScrollView mScrollView;
166166
View mExpandedContents;
167167
int mNotificationPanelMarginBottomPx, mNotificationPanelMarginLeftPx;
168+
final Rect mNotificationPanelBackgroundPadding = new Rect();
168169
int mNotificationPanelGravity;
169170
int mNotificationPanelMinHeight;
170171

@@ -267,6 +268,13 @@ public void run() {
267268
}
268269
};
269270

271+
private final Runnable mPerformSelfExpandFling = new Runnable() {
272+
@Override
273+
public void run() {
274+
performFling(0, mSelfExpandVelocityPx, true);
275+
}
276+
};
277+
270278
private final Runnable mPerformFling = new Runnable() {
271279
@Override
272280
public void run() {
@@ -1206,7 +1214,7 @@ public void animateExpand() {
12061214
}
12071215

12081216
prepareTracking(0, true);
1209-
performFling(0, mSelfExpandVelocityPx, true);
1217+
mHandler.post(mPerformSelfExpandFling);
12101218
}
12111219

12121220
public void animateCollapse() {
@@ -1521,12 +1529,15 @@ boolean interceptTouchEvent(MotionEvent event) {
15211529
mViewDelta = statusBarSize - y;
15221530
} else {
15231531
mCloseView.getLocationOnScreen(mAbsPos);
1524-
mViewDelta = mAbsPos[1] + statusBarSize + getCloseViewHeight() - y; // XXX: not closeViewHeight, but paddingBottom from the 9patch
1532+
mViewDelta = mAbsPos[1]
1533+
+ getCloseViewHeight() // XXX: not closeViewHeight, but paddingBottom from the 9patch
1534+
+ mNotificationPanelBackgroundPadding.top
1535+
+ mNotificationPanelBackgroundPadding.bottom
1536+
- y;
15251537
}
15261538
if ((!mExpanded && y < hitSize) ||
15271539
// @@ add taps outside the panel if it's not full-screen
15281540
(mExpanded && y > (getExpandedViewMaxHeight()-hitSize))) {
1529-
15301541
// We drop events at the edge of the screen to make the windowshade come
15311542
// down by accident less, especially when pushing open a device with a keyboard
15321543
// that rotates (like g1 and droid)
@@ -2274,10 +2285,12 @@ protected void loadDimens() {
22742285
if (mNotificationPanelGravity <= 0) {
22752286
mNotificationPanelGravity = Gravity.CENTER_VERTICAL | Gravity.TOP;
22762287
}
2288+
getNinePatchPadding(res.getDrawable(R.drawable.notification_panel_bg), mNotificationPanelBackgroundPadding);
22772289
final int notificationPanelDecorationHeight =
22782290
res.getDimensionPixelSize(R.dimen.notification_panel_padding_top)
22792291
+ res.getDimensionPixelSize(R.dimen.notification_panel_header_height)
2280-
+ getNinePatchPadding(res.getDrawable(R.drawable.notification_panel_bg)).bottom;
2292+
+ mNotificationPanelBackgroundPadding.top
2293+
+ mNotificationPanelBackgroundPadding.bottom;
22812294
mNotificationPanelMinHeight =
22822295
notificationPanelDecorationHeight
22832296
+ res.getDimensionPixelSize(R.dimen.close_handle_underlap);
@@ -2287,13 +2300,11 @@ protected void loadDimens() {
22872300
if (false) Slog.v(TAG, "updateResources");
22882301
}
22892302

2290-
private static Rect getNinePatchPadding(Drawable d) {
2291-
Rect padding = new Rect();
2303+
private static void getNinePatchPadding(Drawable d, Rect outPadding) {
22922304
if (d instanceof NinePatchDrawable) {
22932305
NinePatchDrawable ninePatch = (NinePatchDrawable) d;
2294-
ninePatch.getPadding(padding);
2306+
ninePatch.getPadding(outPadding);
22952307
}
2296-
return padding;
22972308
}
22982309

22992310
//

0 commit comments

Comments
 (0)