Bug 1071758 - Don't send two click events when doing a medium length tap. r=bnicholson

This commit is contained in:
Kartikaya Gupta
2014-09-29 15:32:44 -04:00
parent 6960dc46db
commit 0912ad90ad

View File

@@ -1348,13 +1348,17 @@ class JavaPanZoomController
GeckoAppShell.sendEventToGecko(e);
}
private boolean waitForDoubleTap() {
return !mMediumPress && mTarget.getZoomConstraints().getAllowDoubleTapZoom();
}
@Override
public boolean onSingleTapUp(MotionEvent motionEvent) {
// When double-tapping is allowed, we have to wait to see if this is
// going to be a double-tap.
// However, if mMediumPress is true then we know there will be no
// double-tap so we treat this as a click.
if (mMediumPress || !mTarget.getZoomConstraints().getAllowDoubleTapZoom()) {
if (!waitForDoubleTap()) {
sendPointToGecko("Gesture:SingleTap", motionEvent);
}
// return false because we still want to get the ACTION_UP event that triggers this
@@ -1363,8 +1367,8 @@ class JavaPanZoomController
@Override
public boolean onSingleTapConfirmed(MotionEvent motionEvent) {
// When zooming is disabled, we handle this in onSingleTapUp.
if (mTarget.getZoomConstraints().getAllowDoubleTapZoom()) {
// In cases where we don't wait for double-tap, we handle this in onSingleTapUp.
if (waitForDoubleTap()) {
sendPointToGecko("Gesture:SingleTap", motionEvent);
}
return true;