Created
March 5, 2017 18:09
-
-
Save ifucolo/c8746f10e2f19818285132d838a516db 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
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