Created
November 20, 2015 08:49
-
-
Save HugoGresse/d7fc6b654f6998e717de to your computer and use it in GitHub Desktop.
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 onTouch(View v, MotionEvent event) { | |
switch (event.getAction() & MotionEvent.ACTION_MASK) { | |
case MotionEvent.ACTION_DOWN: | |
mStartNativeX = event.getX(); | |
mStartNativeY = event.getY(); | |
mIsNativeClick = true; | |
return true; | |
case MotionEvent.ACTION_MOVE: | |
if (mIsNativeClick && (Math.abs(mStartNativeX - event.getX()) > SCROLL_THRESHOLD | |
|| Math.abs(mStartNativeY - event.getY()) > SCROLL_THRESHOLD)) { | |
mIsNativeClick = false; | |
} | |
break; | |
case MotionEvent.ACTION_UP: | |
if (mIsNativeClick) { | |
// click listener here | |
return true; | |
} | |
break; | |
} | |
return false; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment