summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2011-08-25 14:41:07 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-08-25 14:41:07 -0700
commit6f7588850b2b1dd4a96584bad889bd4b51112c98 (patch)
tree266bc25a18c7f5fc86608f1fd2025d2c6dd4adeb /packages/SystemUI
parent9ebcfcaf963a80548d893b11a65e2738be451108 (diff)
parentdc940eaa67db0108f8a8629826dbb3c5c7d779e9 (diff)
downloadframeworks_base-6f7588850b2b1dd4a96584bad889bd4b51112c98.zip
frameworks_base-6f7588850b2b1dd4a96584bad889bd4b51112c98.tar.gz
frameworks_base-6f7588850b2b1dd4a96584bad889bd4b51112c98.tar.bz2
Merge "Scale windowshade gesture parameters for screen density."
Diffstat (limited to 'packages/SystemUI')
-rw-r--r--packages/SystemUI/res/values/dimens.xml24
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java63
2 files changed, 73 insertions, 14 deletions
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 6db5fc4..f633825 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -63,4 +63,28 @@
<!-- thickness (height) of dividers between each notification row -->
<dimen name="notification_divider_height">1dp</dimen>
+
+ <!-- Notification drawer tuning parameters (phone UI) -->
+ <!-- Initial velocity of the shade when expanding on its own -->
+ <dimen name="self_expand_velocity">2000dp</dimen>
+ <!-- Initial velocity of the shade when collapsing on its own -->
+ <dimen name="self_collapse_velocity">2000dp</dimen>
+ <!-- Minimum final velocity of gestures interpreted as expand requests -->
+ <dimen name="fling_expand_min_velocity">200dp</dimen>
+ <!-- Minimum final velocity of gestures interpreted as collapse requests -->
+ <dimen name="fling_collapse_min_velocity">200dp</dimen>
+ <!-- Cap on contribution of x dimension of gesture to overall velocity -->
+ <dimen name="fling_gesture_max_x_velocity">200dp</dimen>
+
+ <!-- Minimum fraction of the display a gesture must travel, at any velocity, to qualify as a
+ collapse request -->
+ <item type="dimen" name="collapse_min_display_fraction">10%</item>
+ <!-- Minimum fraction of the display a gesture must travel to qualify as an expand request -->
+ <item type="dimen" name="expand_min_display_fraction">50%</item>
+
+ <!-- Initial acceleration of an expand animation after fling -->
+ <dimen name="expand_accel">2000dp</dimen>
+ <!-- Initial acceleration of an collapse animation after fling -->
+ <dimen name="collapse_accel">2000dp</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 dd8e3e8..6e6567b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -112,6 +112,18 @@ public class PhoneStatusBar extends StatusBar {
// will likely move to a resource or other tunable param at some point
private static final int INTRUDER_ALERT_DECAY_MS = 10000;
+ // fling gesture tuning parameters, scaled to display density
+ private float mSelfExpandVelocityPx; // classic value: 2000px/s
+ private float mSelfCollapseVelocityPx; // classic value: 2000px/s (will be negated to collapse "up")
+ private float mFlingExpandMinVelocityPx; // classic value: 200px/s
+ private float mFlingCollapseMinVelocityPx; // classic value: 200px/s
+ private float mCollapseMinDisplayFraction; // classic value: 0.08 (25px/min(320px,480px) on G1)
+ private float mExpandMinDisplayFraction; // classic value: 0.5 (drag open halfway to expand)
+ private float mFlingGestureMaxXVelocityPx; // classic value: 150px/s
+
+ private float mExpandAccelPx; // classic value: 2000px/s/s
+ private float mCollapseAccelPx; // classic value: 2000px/s/s (will be negated to collapse "up")
+
PhoneStatusBarPolicy mIconPolicy;
// These are no longer handled by the policy, because we need custom strategies for them
@@ -1179,7 +1191,7 @@ public class PhoneStatusBar extends StatusBar {
}
prepareTracking(0, true);
- performFling(0, 2000.0f, true);
+ performFling(0, mSelfExpandVelocityPx, true);
}
public void animateCollapse() {
@@ -1215,7 +1227,7 @@ public class PhoneStatusBar extends StatusBar {
// and doesn't try to re-open the windowshade.
mExpanded = true;
prepareTracking(y, false);
- performFling(y, -2000.0f, true);
+ performFling(y, -mSelfCollapseVelocityPx, true);
}
void performExpand() {
@@ -1331,8 +1343,8 @@ public class PhoneStatusBar extends StatusBar {
mTracking = true;
mVelocityTracker = VelocityTracker.obtain();
if (opening) {
- mAnimAccel = 2000.0f;
- mAnimVel = 200;
+ mAnimAccel = mExpandAccelPx;
+ mAnimVel = mFlingExpandMinVelocityPx;
mAnimY = mStatusBarView.getHeight();
updateExpandedViewPos((int)mAnimY);
mAnimating = true;
@@ -1370,29 +1382,31 @@ public class PhoneStatusBar extends StatusBar {
if (mExpanded) {
if (!always && (
- vel > 200.0f
- || (y > (mDisplayMetrics.heightPixels-25) && vel > -200.0f))) {
+ vel > mFlingCollapseMinVelocityPx
+ || (y > (mDisplayMetrics.heightPixels*(1f-mCollapseMinDisplayFraction)) &&
+ vel > -mFlingExpandMinVelocityPx))) {
// We are expanded, but they didn't move sufficiently to cause
// us to retract. Animate back to the expanded position.
- mAnimAccel = 2000.0f;
+ mAnimAccel = mExpandAccelPx;
if (vel < 0) {
mAnimVel = 0;
}
}
else {
// We are expanded and are now going to animate away.
- mAnimAccel = -2000.0f;
+ mAnimAccel = -mCollapseAccelPx;
if (vel > 0) {
mAnimVel = 0;
}
}
} else {
if (always || (
- vel > 200.0f
- || (y > (mDisplayMetrics.heightPixels/2) && vel > -200.0f))) {
+ vel > mFlingExpandMinVelocityPx
+ || (y > (mDisplayMetrics.heightPixels*(1f-mExpandMinDisplayFraction)) &&
+ vel > -mFlingCollapseMinVelocityPx))) {
// We are collapsed, and they moved enough to allow us to
// expand. Animate in the notifications.
- mAnimAccel = 2000.0f;
+ mAnimAccel = mExpandAccelPx;
if (vel < 0) {
mAnimVel = 0;
}
@@ -1400,7 +1414,7 @@ public class PhoneStatusBar extends StatusBar {
else {
// We are collapsed, but they didn't move sufficiently to cause
// us to retract. Animate back to the collapsed position.
- mAnimAccel = -2000.0f;
+ mAnimAccel = -mCollapseAccelPx;
if (vel > 0) {
mAnimVel = 0;
}
@@ -1480,8 +1494,8 @@ public class PhoneStatusBar extends StatusBar {
if (xVel < 0) {
xVel = -xVel;
}
- if (xVel > 150.0f) {
- xVel = 150.0f; // limit how much we care about the x axis
+ if (xVel > mFlingGestureMaxXVelocityPx) {
+ xVel = mFlingGestureMaxXVelocityPx; // limit how much we care about the x axis
}
float vel = (float)Math.hypot(yVel, xVel);
@@ -1489,6 +1503,14 @@ public class PhoneStatusBar extends StatusBar {
vel = -vel;
}
+ if (CHATTY) {
+ Slog.d(TAG, String.format("gesture: vraw=(%f,%f) vnorm=(%f,%f) vlinear=%f",
+ mVelocityTracker.getXVelocity(),
+ mVelocityTracker.getYVelocity(),
+ xVel, yVel,
+ vel));
+ }
+
performFling((int)event.getRawY(), vel, false);
}
@@ -2133,6 +2155,19 @@ public class PhoneStatusBar extends StatusBar {
mEdgeBorder = res.getDimensionPixelSize(R.dimen.status_bar_edge_ignore);
+ mSelfExpandVelocityPx = res.getDimension(R.dimen.self_expand_velocity);
+ mSelfCollapseVelocityPx = res.getDimension(R.dimen.self_collapse_velocity);
+ mFlingExpandMinVelocityPx = res.getDimension(R.dimen.fling_expand_min_velocity);
+ mFlingCollapseMinVelocityPx = res.getDimension(R.dimen.fling_collapse_min_velocity);
+
+ mCollapseMinDisplayFraction = res.getFraction(R.dimen.collapse_min_display_fraction, 1, 1);
+ mExpandMinDisplayFraction = res.getFraction(R.dimen.expand_min_display_fraction, 1, 1);
+
+ mExpandAccelPx = res.getDimension(R.dimen.expand_accel);
+ mCollapseAccelPx = res.getDimension(R.dimen.collapse_accel);
+
+ mFlingGestureMaxXVelocityPx = res.getDimension(R.dimen.fling_gesture_max_x_velocity);
+
if (false) Slog.v(TAG, "updateResources");
}