Fix the "missing touch events" problem.

- Bias the slop regions so that it's more likely to think that you're scrolling
  than zooming.
- If it could be a scroll or a zoom, pick the scroll.
This commit is contained in:
Joe Onorato committed 2009-10-01 14:09:15 -07:00
1 parent 2bc6b7c2b8
commit f7b0e01880
2 files changed
+17 -13

No files matched your search

@@ -40,7 +40,8 @@ public class SwipeController {
private static final float SPRING_CONSTANT = 0.0009f;
// configuration
private int mSlop;
private int mSlopX;
private int mSlopY;
private float mSwipeDistance;
private AllAppsView mAllAppsView;
@@ -59,7 +60,8 @@ public class SwipeController {
public SwipeController(Context context) {
ViewConfiguration config = ViewConfiguration.get(context);
mSlop = config.getScaledTouchSlop();
mSlopX = config.getScaledTouchSlop();
mSlopY = 3 * mSlopX / 2; // make it 50% more biased towards horizontal swiping.
DisplayMetrics display = context.getResources().getDisplayMetrics();
mSwipeDistance = display.heightPixels / 2; // one half of the screen
@@ -130,12 +132,11 @@ public class SwipeController {
case MotionEvent.ACTION_MOVE:
if (!mCanceled && !mTracking) {
if (Math.abs(deltaX) > mSlop) {
if (Math.abs(deltaX) > mSlopX) {
mCanceled = true;
mTracking = false;
mAllAppsView.setZoomSwipeInProgress(false, true);
}
if (Math.abs(deltaY) > mSlop) {
} else if (Math.abs(deltaY) > mSlopY) {
mTracking = true;
}
}