summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src
diff options
context:
space:
mode:
authorChris Wren <cwren@android.com>2012-10-10 21:02:56 -0400
committerChris Wren <cwren@android.com>2012-10-10 21:06:11 -0400
commitcea520747f344204a78db9d3f7f1abe3f695f49f (patch)
tree8a8d08663e131a26916b9f77e92330a408d17bdc /packages/SystemUI/src
parentb2d552259ebe254fe3fc830e71caadef9d72a778 (diff)
downloadframeworks_base-cea520747f344204a78db9d3f7f1abe3f695f49f.zip
frameworks_base-cea520747f344204a78db9d3f7f1abe3f695f49f.tar.gz
frameworks_base-cea520747f344204a78db9d3f7f1abe3f695f49f.tar.bz2
resolve conflicting assumptions from the merge.
Bug: 7300843 Change-Id: I5894fba34550d1b98f6cbe5ca808820b70e19819
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r--packages/SystemUI/src/com/android/systemui/ExpandHelper.java48
1 files changed, 32 insertions, 16 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
index dcfd0b3..4e9013f 100644
--- a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
@@ -86,6 +86,8 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
private float mInitialTouchFocusY;
private float mInitialTouchY;
private float mInitialTouchSpan;
+ private float mLastFocusY;
+ private float mLastSpanY;
private int mTouchSlop;
private int mLastMotionY;
private float mPopLimit;
@@ -207,11 +209,6 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
float focusX = detector.getFocusX();
float focusY = detector.getFocusY();
- // your fingers have to be somewhat close to the bounds of the view in question
- mInitialTouchFocusY = focusY;
- mInitialTouchSpan = Math.abs(detector.getCurrentSpan());
- if (DEBUG_SCALE) Slog.d(TAG, "got mInitialTouchSpan: (" + mInitialTouchSpan + ")");
-
final View underFocus = findView(focusX, focusY);
if (underFocus != null) {
startExpanding(underFocus, STRETCH);
@@ -222,24 +219,19 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
@Override
public boolean onScale(ScaleGestureDetector detector) {
if (DEBUG_SCALE) Slog.v(TAG, "onscale() on " + mCurrView);
- updateExpansion();
return true;
}
@Override
public void onScaleEnd(ScaleGestureDetector detector) {
- if (DEBUG_SCALE) Slog.v(TAG, "onscaleend()");
- // I guess we're alone now
- if (DEBUG_SCALE) Slog.d(TAG, "scale end");
- finishExpanding(false);
- clearView();
}
});
}
private void updateExpansion() {
+ if (DEBUG_SCALE) Slog.v(TAG, "updateExpansion()");
// are we scaling or dragging?
- float span = Math.abs(mSGD.getCurrentSpan()) - mInitialTouchSpan;
+ float span = mSGD.getCurrentSpan() - mInitialTouchSpan;
span *= USE_SPAN ? 1f : 0f;
float drag = mSGD.getFocusY() - mInitialTouchFocusY;
drag *= USE_DRAG ? 1f : 0f;
@@ -251,6 +243,8 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
mScaler.setHeight(newHeight);
setGlow(calculateGlow(target, newHeight));
+ mLastFocusY = mSGD.getFocusY();
+ mLastSpanY = mSGD.getCurrentSpan();
}
private float clamp(float target) {
@@ -362,6 +356,13 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
mSGD.onTouchEvent(ev);
final int x = (int) mSGD.getFocusX();
final int y = (int) mSGD.getFocusY();
+
+ mInitialTouchFocusY = y;
+ mInitialTouchSpan = mSGD.getCurrentSpan();
+ mLastFocusY = mInitialTouchFocusY;
+ mLastSpanY = mInitialTouchSpan;
+ if (DEBUG_SCALE) Slog.d(TAG, "set initial span: " + mInitialTouchSpan);
+
if (mExpanding) {
return true;
} else {
@@ -376,8 +377,6 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
// detect a vertical pulling gesture with fingers somewhat separated
if (DEBUG_SCALE) Slog.v(TAG, "got pull gesture (xspan=" + xspan + "px)");
- mInitialTouchFocusY = y;
-
final View underFocus = findView(x, y);
if (underFocus != null) {
startExpanding(underFocus, PULL);
@@ -424,7 +423,7 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
@Override
public boolean onTouchEvent(MotionEvent ev) {
- final int action = ev.getAction();
+ final int action = ev.getActionMasked();
if (DEBUG_SCALE) Slog.d(TAG, "touch: act=" + MotionEvent.actionToString(action) +
" expanding=" + mExpanding +
(0 != (mExpansionStyle & BLINDS) ? " (blinds)" : "") +
@@ -481,6 +480,14 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
break;
}
+
+ case MotionEvent.ACTION_POINTER_UP:
+ case MotionEvent.ACTION_POINTER_DOWN:
+ if (DEBUG) Slog.d(TAG, "pointer change");
+ mInitialTouchY += mSGD.getFocusY() - mLastFocusY;
+ mInitialTouchSpan += mSGD.getCurrentSpan() - mLastSpanY;
+ break;
+
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
if (DEBUG) Slog.d(TAG, "up/cancel");
@@ -492,8 +499,11 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
}
private void startExpanding(View v, int expandType) {
+ mExpansionStyle = expandType;
+ if (mExpanding && v == mCurrView) {
+ return;
+ }
mExpanding = true;
- mExpansionStyle = expandType;
if (DEBUG) Slog.d(TAG, "scale type " + expandType + " beginning on view: " + v);
mCallback.setUserLockedChild(v, true);
setView(v);
@@ -515,6 +525,8 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
private void finishExpanding(boolean force) {
if (!mExpanding) return;
+ if (DEBUG) Slog.d(TAG, "scale in finishing on view: " + mCurrView);
+
float currentHeight = mScaler.getHeight();
float targetHeight = mSmallSize;
float h = mScaler.getHeight();
@@ -539,6 +551,10 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
mExpanding = false;
mExpansionStyle = NONE;
+ if (DEBUG) Slog.d(TAG, "wasClosed is: " + wasClosed);
+ if (DEBUG) Slog.d(TAG, "currentHeight is: " + currentHeight);
+ if (DEBUG) Slog.d(TAG, "mSmallSize is: " + mSmallSize);
+ if (DEBUG) Slog.d(TAG, "targetHeight is: " + targetHeight);
if (DEBUG) Slog.d(TAG, "scale was finished on view: " + mCurrView);
}