Created
August 16, 2014 02:50
-
-
Save terrytowne/5ae2c27331ffe1b402b9 to your computer and use it in GitHub Desktop.
Android ScaleGestureDetector work with GestureDetector.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public boolean onTouchEvent(MotionEvent event) | |
{ | |
boolean result = mScaleGestureDetector.onTouchEvent(event); | |
// result is always true here, so I need another way to check for a detected scaling gesture | |
boolean isScaling = result = mScaleGestureDetector.isInProgress(); | |
if (!isScaling) | |
{ | |
// if no scaling is performed check for other gestures (fling, long tab, etc.) | |
result = mCommonGestureDetector.onTouchEvent(event); | |
} | |
// some irrelevant checks... | |
return result ? result : super.onTouchEvent(event); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment