Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@Override
public boolean onTouchEvent(MotionEvent event) {
if (mEnabled) {
this.getParent().requestDisallowInterceptTouchEvent(true);
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
if (mOnSwagPointsChangeListener != null)
mOnSwagPointsChangeListener.onStartTrackingTouch(this);
updateOnTouch(event);
break;
case MotionEvent.ACTION_MOVE:
updateOnTouch(event);
break;
case MotionEvent.ACTION_UP:
if (mOnSwagPointsChangeListener != null)
mOnSwagPointsChangeListener.onStopTrackingTouch(this);
setPressed(false);
this.getParent().requestDisallowInterceptTouchEvent(false);
break;
case MotionEvent.ACTION_CANCEL:
if (mOnSwagPointsChangeListener != null)
mOnSwagPointsChangeListener.onStopTrackingTouch(this);
setPressed(false);
this.getParent().requestDisallowInterceptTouchEvent(false);
break;
}
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.