summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2012-04-30 12:07:30 -0400
committerDaniel Sandler <dsandler@android.com>2012-04-30 12:13:37 -0400
commit1fac1fdd7917d7cb6e1cafc17c71bba12b53fc34 (patch)
treeca45f38edcfc7eef0b335eefddbccd36b6367431 /packages/SystemUI
parenta310af88beeae02c7eeec99b93d5168443c59ac4 (diff)
downloadframeworks_base-1fac1fdd7917d7cb6e1cafc17c71bba12b53fc34.zip
frameworks_base-1fac1fdd7917d7cb6e1cafc17c71bba12b53fc34.tar.gz
frameworks_base-1fac1fdd7917d7cb6e1cafc17c71bba12b53fc34.tar.bz2
Fix a longstanding bug in the shade pulldown trajectory.
Two parts to this: 1. We were looking at the measured height of the close view for a lot of our computations, which---particularly with recent changes that dispense with the old 3-window implementation---is increasingly unreliable 2. We were overestimating the minY that the panel must be pulled down before animation starts. It was enforced jankiness! Bug: 5359178 Change-Id: Ie09b62226b7b0977527348b5527478665ece1df8
Diffstat (limited to 'packages/SystemUI')
-rw-r--r--packages/SystemUI/res/layout/status_bar_expanded.xml2
-rw-r--r--packages/SystemUI/res/values/dimens.xml2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java21
3 files changed, 19 insertions, 6 deletions
diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml
index c64aabe..eb1e1c0 100644
--- a/packages/SystemUI/res/layout/status_bar_expanded.xml
+++ b/packages/SystemUI/res/layout/status_bar_expanded.xml
@@ -121,7 +121,7 @@
<com.android.systemui.statusbar.phone.CloseDragHandle android:id="@+id/close"
android:layout_width="match_parent"
- android:layout_height="34dp"
+ android:layout_height="@dimen/close_handle_height"
android:layout_gravity="bottom"
android:orientation="vertical"
>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 6c29c6e..f7b8cc9 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -118,4 +118,6 @@
<!-- Diameter of outer shape drawable shown in navbar search-->
<dimen name="navbar_search_outerring_diameter">300dip</dimen>
+ <!-- Height of the draggable handle at the bottom of the phone notification panel -->
+ <dimen name="close_handle_height">34dp</dimen>
</resources>
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 e9001e8..340e10e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -164,6 +164,7 @@ public class PhoneStatusBar extends BaseStatusBar {
// drag bar
CloseDragHandle mCloseView;
+ private int mCloseViewHeight;
// all notifications
NotificationData mNotificationData = new NotificationData();
@@ -333,6 +334,7 @@ public class PhoneStatusBar extends BaseStatusBar {
mCloseView = (CloseDragHandle)mStatusBarWindow.findViewById(R.id.close);
mCloseView.mService = this;
+ mCloseViewHeight = res.getDimensionPixelSize(R.dimen.close_handle_height);
mEdgeBorder = res.getDimensionPixelSize(R.dimen.status_bar_edge_ignore);
@@ -466,6 +468,10 @@ public class PhoneStatusBar extends BaseStatusBar {
return mNaturalBarHeight;
}
+ private int getCloseViewHeight() {
+ return mCloseViewHeight;
+ }
+
private View.OnClickListener mRecentsClickListener = new View.OnClickListener() {
public void onClick(View v) {
toggleRecentApps();
@@ -1259,7 +1265,7 @@ public class PhoneStatusBar extends BaseStatusBar {
}
void doRevealAnimation() {
- final int h = mCloseView.getHeight() + getStatusBarHeight();
+ final int h = getCloseViewHeight() + getStatusBarHeight();
if (mAnimatingReveal && mAnimating && mAnimY < h) {
incrementAnim();
if (mAnimY >= h) {
@@ -1420,9 +1426,9 @@ public class PhoneStatusBar extends BaseStatusBar {
}
} else if (mTracking) {
trackMovement(event);
- final int minY = statusBarSize + mCloseView.getHeight();
+ final int minY = statusBarSize + getCloseViewHeight();
if (action == MotionEvent.ACTION_MOVE) {
- if (mAnimatingReveal && y < minY) {
+ if (mAnimatingReveal && (y + mViewDelta) < minY) {
// nothing
} else {
mAnimatingReveal = false;
@@ -1855,6 +1861,10 @@ public class PhoneStatusBar extends BaseStatusBar {
mTrackingPosition = -mDisplayMetrics.heightPixels;
}
+ static final float saturate(float a) {
+ return a < 0f ? 0f : (a > 1f ? 1f : a);
+ }
+
void updateExpandedViewPos(int expandedPosition) {
if (SPEW) {
Slog.d(TAG, "updateExpandedViewPos before expandedPosition=" + expandedPosition
@@ -1905,8 +1915,9 @@ public class PhoneStatusBar extends BaseStatusBar {
}
cropView.setLayoutParams(lp);
// woo, special effects
- final float frac = (float)panelh / disph;
- final int color = ((int)(0xB0 * Math.pow(frac, 0.5))) << 24;
+ final int barh = getCloseViewHeight() + getStatusBarHeight();
+ final float frac = saturate((float)(panelh - barh) / (disph - barh));
+ final int color = ((int)(0xB0 * Math.sin(frac * 1.57f))) << 24;
mStatusBarWindow.setBackgroundColor(color);
// Slog.d(TAG, String.format("updateExpanded: pos=%d frac=%.2f col=0x%08x", pos, frac, color));