Skip to content

Instantly share code, notes, and snippets.

@terrytowne
Created August 16, 2014 02:50
Show Gist options
  • Save terrytowne/5ae2c27331ffe1b402b9 to your computer and use it in GitHub Desktop.
Save terrytowne/5ae2c27331ffe1b402b9 to your computer and use it in GitHub Desktop.
Android ScaleGestureDetector work with GestureDetector.
@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