diff options
author | John Spurlock <jspurlock@google.com> | 2012-06-11 16:23:10 -0400 |
---|---|---|
committer | John Spurlock <jspurlock@google.com> | 2012-06-12 13:27:14 -0400 |
commit | 8506149f613f3f98bbbf6675ed9c36dd32d4ce4f (patch) | |
tree | f45dd2aa66b0469abb5c66dd5702e3ca4e6dbf26 /packages/SystemUI/src/com/android/systemui | |
parent | f958732bd3924205d9f8bda94f4f6e3bb4045b28 (diff) | |
download | frameworks_base-8506149f613f3f98bbbf6675ed9c36dd32d4ce4f.zip frameworks_base-8506149f613f3f98bbbf6675ed9c36dd32d4ce4f.tar.gz frameworks_base-8506149f613f3f98bbbf6675ed9c36dd32d4ce4f.tar.bz2 |
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
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java | 27 |
1 files changed, 19 insertions, 8 deletions
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 fc56dd1..9f9e5ca 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,7 @@ public class PhoneStatusBar extends BaseStatusBar { ScrollView mScrollView; View mExpandedContents; int mNotificationPanelMarginBottomPx, mNotificationPanelMarginLeftPx; + final Rect mNotificationPanelBackgroundPadding = new Rect(); int mNotificationPanelGravity; int mNotificationPanelMinHeight; @@ -267,6 +268,13 @@ public class PhoneStatusBar extends BaseStatusBar { } }; + private final Runnable mPerformSelfExpandFling = new Runnable() { + @Override + public void run() { + performFling(0, mSelfExpandVelocityPx, true); + } + }; + private final Runnable mPerformFling = new Runnable() { @Override public void run() { @@ -1206,7 +1214,7 @@ public class PhoneStatusBar extends BaseStatusBar { } prepareTracking(0, true); - performFling(0, mSelfExpandVelocityPx, true); + mHandler.post(mPerformSelfExpandFling); } public void animateCollapse() { @@ -1521,12 +1529,15 @@ public class PhoneStatusBar extends BaseStatusBar { mViewDelta = statusBarSize - y; } else { mCloseView.getLocationOnScreen(mAbsPos); - mViewDelta = mAbsPos[1] + statusBarSize + getCloseViewHeight() - y; // XXX: not closeViewHeight, but paddingBottom from the 9patch + mViewDelta = mAbsPos[1] + + getCloseViewHeight() // XXX: not closeViewHeight, but paddingBottom from the 9patch + + mNotificationPanelBackgroundPadding.top + + mNotificationPanelBackgroundPadding.bottom + - y; } if ((!mExpanded && y < hitSize) || // @@ add taps outside the panel if it's not full-screen (mExpanded && y > (getExpandedViewMaxHeight()-hitSize))) { - // We drop events at the edge of the screen to make the windowshade come // down by accident less, especially when pushing open a device with a keyboard // that rotates (like g1 and droid) @@ -2274,10 +2285,12 @@ public class PhoneStatusBar extends BaseStatusBar { if (mNotificationPanelGravity <= 0) { mNotificationPanelGravity = Gravity.CENTER_VERTICAL | Gravity.TOP; } + getNinePatchPadding(res.getDrawable(R.drawable.notification_panel_bg), mNotificationPanelBackgroundPadding); final int notificationPanelDecorationHeight = res.getDimensionPixelSize(R.dimen.notification_panel_padding_top) + res.getDimensionPixelSize(R.dimen.notification_panel_header_height) - + getNinePatchPadding(res.getDrawable(R.drawable.notification_panel_bg)).bottom; + + mNotificationPanelBackgroundPadding.top + + mNotificationPanelBackgroundPadding.bottom; mNotificationPanelMinHeight = notificationPanelDecorationHeight + res.getDimensionPixelSize(R.dimen.close_handle_underlap); @@ -2287,13 +2300,11 @@ public class PhoneStatusBar extends BaseStatusBar { if (false) Slog.v(TAG, "updateResources"); } - private static Rect getNinePatchPadding(Drawable d) { - Rect padding = new Rect(); + private static void getNinePatchPadding(Drawable d, Rect outPadding) { if (d instanceof NinePatchDrawable) { NinePatchDrawable ninePatch = (NinePatchDrawable) d; - ninePatch.getPadding(padding); + ninePatch.getPadding(outPadding); } - return padding; } // |