Code example for MotionEvent

Methods: getDownTimegetEventTime

0
     * @param yUp     The y-offset of the up event. 
     * @return true if it's a click, false otherwise 
     */ 
    private boolean isClick(MotionEvent upEvent, float xDown, float yDown, float xUp, float yUp) {
        if (upEvent == null) return false;
        long time = upEvent.getEventTime() - upEvent.getDownTime();
        float distance = PointF.length( //
                xDown - xUp, //
                yDown - yUp);
        return time < MAX_CLICK_TIME && distance < MAX_CLICK_DISTANCE;
    } 
 
    public void setOnDragListener(OnDragListener onDragListener) {
        this.onDragListener = onDragListener;
    } 
 
    public void setOnPinchListener(OnPinchListener onPinchListener) {
        this.onPinchListener = onPinchListener;
    } 
 
    public void setOnDoubleTapListener(OnDoubleTapListener onDoubleTapListener) {