Skip to content

Instantly share code, notes, and snippets.

@ifucolo
Created March 5, 2017 18:09
Show Gist options
  • Save ifucolo/c8746f10e2f19818285132d838a516db to your computer and use it in GitHub Desktop.
Save ifucolo/c8746f10e2f19818285132d838a516db to your computer and use it in GitHub Desktop.
public interface FrameOnTouch {
void onFrameTouchUp();
void onScrollMovie(float x, float y);
}
public FrameTouch(Context context) {
super(context);
detector = new GestureDetectorCompat(context, new MyGestureListener());
}
public FrameTouch(Context context, AttributeSet attrs) {
super(context, attrs);
detector = new GestureDetectorCompat(context, new MyGestureListener());
scaleDetector = new ScaleGestureDetector(context, this);
}
public void setFrameOnTouch(FrameOnTouch frameOnTouch) {
this.frameOnTouch = frameOnTouch;
}
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_UP)
frameOnTouch.onFrameTouchUp();
super.dispatchTouchEvent(event);
return detector.onTouchEvent(event);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment