From e62e0280c528029d2060a486d32ada4285f0517d Mon Sep 17 00:00:00 2001 From: sonora Date: Thu, 29 Dec 2016 10:51:58 +0100 Subject: [PATCH] cancel aready fired gestures if multiTouch is detected (avoids false taps) --- OsmAnd/src/net/osmand/plus/views/MultiTouchSupport.java | 2 +- OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/views/MultiTouchSupport.java b/OsmAnd/src/net/osmand/plus/views/MultiTouchSupport.java index 7f267ee901..e9027c9fd9 100644 --- a/OsmAnd/src/net/osmand/plus/views/MultiTouchSupport.java +++ b/OsmAnd/src/net/osmand/plus/views/MultiTouchSupport.java @@ -86,7 +86,7 @@ public class MultiTouchSupport { Integer pointCount = (Integer) getPointerCount.invoke(event); if(pointCount < 2){ if(inZoomMode){ - //listener.onZoomOrRotationEnded(zoomRelative, angleRelative); + listener.onZoomOrRotationEnded(zoomRelative, angleRelative); inZoomMode = false; return true; } diff --git a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java index 20d20e652e..a214ad1281 100644 --- a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java +++ b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java @@ -862,6 +862,12 @@ public class OsmandMapTileView implements IMapDownloaderCallback { layers.get(i).onTouchEvent(event, getCurrentRotatedTileBox()); } gestureDetector.onTouchEvent(event); + } else { + MotionEvent cancelEvent == MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis() + 100, MotionEvent.ACTION_CANCEL, 0.0f, 0.0f, 0); + for (int i = layers.size() - 1; i >= 0; i--) { + layers.get(i).onTouchEvent(cancelEvent, getCurrentRotatedTileBox()); + } + gestureDetector.onTouchEvent(cancelEvent); } return true; }