summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2013-07-29 08:57:32 -0400
committerJohn Spurlock <jspurlock@google.com>2013-07-29 10:38:47 -0400
commit9ba21fdc9ddf1d132215d29054b55af416561367 (patch)
tree1b2995dc749cfa45dee585727dabb0988175281e
parenteb219ee190b4ceb662b81a93e6d4369bcd5e7dc0 (diff)
downloadframeworks_base-9ba21fdc9ddf1d132215d29054b55af416561367.zip
frameworks_base-9ba21fdc9ddf1d132215d29054b55af416561367.tar.gz
frameworks_base-9ba21fdc9ddf1d132215d29054b55af416561367.tar.bz2
Tweak system gesture listener.
Swipe gestures now need only travel a status bar's length to trigger. Name distance threshold variable appropriately to avoid future confusion. Bug: 10045892 Change-Id: I70fcf218e97c85e2653560bf2e2242d9c36537fd
-rw-r--r--policy/src/com/android/internal/policy/impl/SystemGesturesPointerEventListener.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/policy/src/com/android/internal/policy/impl/SystemGesturesPointerEventListener.java b/policy/src/com/android/internal/policy/impl/SystemGesturesPointerEventListener.java
index 6e8c841..4ff9315 100644
--- a/policy/src/com/android/internal/policy/impl/SystemGesturesPointerEventListener.java
+++ b/policy/src/com/android/internal/policy/impl/SystemGesturesPointerEventListener.java
@@ -38,7 +38,7 @@ public class SystemGesturesPointerEventListener implements PointerEventListener
private static final int SWIPE_FROM_RIGHT = 3;
private final int mSwipeStartThreshold;
- private final int mSwipeEndThreshold;
+ private final int mSwipeDistanceThreshold;
private final Callbacks mCallbacks;
private final int[] mDownPointerId = new int[MAX_TRACKED_POINTERS];
private final float[] mDownX = new float[MAX_TRACKED_POINTERS];
@@ -55,7 +55,9 @@ public class SystemGesturesPointerEventListener implements PointerEventListener
mCallbacks = checkNull("callbacks", callbacks);
mSwipeStartThreshold = checkNull("context", context).getResources()
.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
- mSwipeEndThreshold = mSwipeStartThreshold * 2;
+ mSwipeDistanceThreshold = mSwipeStartThreshold;
+ if (DEBUG) Slog.d(TAG, "mSwipeStartThreshold=" + mSwipeStartThreshold
+ + " mSwipeDistanceThreshold=" + mSwipeDistanceThreshold);
}
private static <T> T checkNull(String name, T arg) {
@@ -169,17 +171,17 @@ public class SystemGesturesPointerEventListener implements PointerEventListener
if (DEBUG) Slog.d(TAG, "pointer " + mDownPointerId[i]
+ " moved (" + fromX + "->" + x + "," + fromY + "->" + y + ") in " + elapsed);
if (fromY <= mSwipeStartThreshold
- && y > fromY + mSwipeEndThreshold
+ && y > fromY + mSwipeDistanceThreshold
&& elapsed < SWIPE_TIMEOUT_MS) {
return SWIPE_FROM_TOP;
}
if (fromY >= screenHeight - mSwipeStartThreshold
- && y < fromY - mSwipeEndThreshold
+ && y < fromY - mSwipeDistanceThreshold
&& elapsed < SWIPE_TIMEOUT_MS) {
return SWIPE_FROM_BOTTOM;
}
if (fromX >= screenWidth - mSwipeStartThreshold
- && x < fromX - mSwipeEndThreshold
+ && x < fromX - mSwipeDistanceThreshold
&& elapsed < SWIPE_TIMEOUT_MS) {
return SWIPE_FROM_RIGHT;
}