Merge "StatusBar: Respond properly to global expand message" into jb-dev

This commit is contained in:
John Spurlock
2012-06-12 13:29:09 -07:00
committed by Android (Google) Code Review

View File

@@ -168,6 +168,7 @@ public class PhoneStatusBar extends BaseStatusBar {
ScrollView mScrollView; ScrollView mScrollView;
View mExpandedContents; View mExpandedContents;
int mNotificationPanelMarginBottomPx, mNotificationPanelMarginLeftPx; int mNotificationPanelMarginBottomPx, mNotificationPanelMarginLeftPx;
final Rect mNotificationPanelBackgroundPadding = new Rect();
int mNotificationPanelGravity; int mNotificationPanelGravity;
int mNotificationPanelMinHeight; int mNotificationPanelMinHeight;
@@ -270,6 +271,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() { private final Runnable mPerformFling = new Runnable() {
@Override @Override
public void run() { public void run() {
@@ -1213,7 +1221,7 @@ public class PhoneStatusBar extends BaseStatusBar {
} }
prepareTracking(0, true); prepareTracking(0, true);
performFling(0, mSelfExpandVelocityPx, true); mHandler.post(mPerformSelfExpandFling);
} }
public void animateCollapse() { public void animateCollapse() {
@@ -1529,12 +1537,15 @@ public class PhoneStatusBar extends BaseStatusBar {
mViewDelta = statusBarSize - y; mViewDelta = statusBarSize - y;
} else { } else {
mCloseView.getLocationOnScreen(mAbsPos); 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) || if ((!mExpanded && y < hitSize) ||
// @@ add taps outside the panel if it's not full-screen // @@ add taps outside the panel if it's not full-screen
(mExpanded && y > (getExpandedViewMaxHeight()-hitSize))) { (mExpanded && y > (getExpandedViewMaxHeight()-hitSize))) {
// We drop events at the edge of the screen to make the windowshade come // 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 // down by accident less, especially when pushing open a device with a keyboard
// that rotates (like g1 and droid) // that rotates (like g1 and droid)
@@ -2287,10 +2298,12 @@ public class PhoneStatusBar extends BaseStatusBar {
if (mNotificationPanelGravity <= 0) { if (mNotificationPanelGravity <= 0) {
mNotificationPanelGravity = Gravity.CENTER_VERTICAL | Gravity.TOP; mNotificationPanelGravity = Gravity.CENTER_VERTICAL | Gravity.TOP;
} }
getNinePatchPadding(res.getDrawable(R.drawable.notification_panel_bg), mNotificationPanelBackgroundPadding);
final int notificationPanelDecorationHeight = final int notificationPanelDecorationHeight =
res.getDimensionPixelSize(R.dimen.notification_panel_padding_top) res.getDimensionPixelSize(R.dimen.notification_panel_padding_top)
+ res.getDimensionPixelSize(R.dimen.notification_panel_header_height) + res.getDimensionPixelSize(R.dimen.notification_panel_header_height)
+ getNinePatchPadding(res.getDrawable(R.drawable.notification_panel_bg)).bottom; + mNotificationPanelBackgroundPadding.top
+ mNotificationPanelBackgroundPadding.bottom;
mNotificationPanelMinHeight = mNotificationPanelMinHeight =
notificationPanelDecorationHeight notificationPanelDecorationHeight
+ res.getDimensionPixelSize(R.dimen.close_handle_underlap); + res.getDimensionPixelSize(R.dimen.close_handle_underlap);
@@ -2300,13 +2313,11 @@ public class PhoneStatusBar extends BaseStatusBar {
if (false) Slog.v(TAG, "updateResources"); if (false) Slog.v(TAG, "updateResources");
} }
private static Rect getNinePatchPadding(Drawable d) { private static void getNinePatchPadding(Drawable d, Rect outPadding) {
Rect padding = new Rect();
if (d instanceof NinePatchDrawable) { if (d instanceof NinePatchDrawable) {
NinePatchDrawable ninePatch = (NinePatchDrawable) d; NinePatchDrawable ninePatch = (NinePatchDrawable) d;
ninePatch.getPadding(padding); ninePatch.getPadding(outPadding);
} }
return padding;
} }
// //