/** Gets the Y component of the translation */ public float getTranslationY() { return calcAverage(mDetector.getCurrentY(), mDetector.getPointerCount()) - calcAverage(mDetector.getStartY(), mDetector.getPointerCount()); }
/** Gets the X component of the translation */ public float getTranslationX() { return calcAverage(mDetector.getCurrentX(), mDetector.getPointerCount()) - calcAverage(mDetector.getStartX(), mDetector.getPointerCount()); }
/** Factory method that creates a new instance of TransformGestureDetector */ public static TransformGestureDetector newInstance() { return new TransformGestureDetector(MultiPointerGestureDetector.newInstance()); }
/** Gets the X coordinate of the pivot point */ public float getPivotX() { return calcAverage(mDetector.getStartX(), mDetector.getPointerCount()); }
/** Gets the Y coordinate of the pivot point */ public float getPivotY() { return calcAverage(mDetector.getStartY(), mDetector.getPointerCount()); }
@Override public void onGestureEnd(MultiPointerGestureDetector detector) { if (mListener != null) { mListener.onGestureEnd(this); } }
@Override public void onGestureUpdate(MultiPointerGestureDetector detector) { if (mListener != null) { mListener.onGestureUpdate(this); } }
@Override public void onGestureBegin(MultiPointerGestureDetector detector) { if (mListener != null) { mListener.onGestureBegin(this); } }
/** * Resets the component to the initial state. */ public void reset() { mDetector.reset(); }
/** * Handles the given motion event. * @param event event to handle * @return whether or not the event was handled */ public boolean onTouchEvent(final MotionEvent event) { return mDetector.onTouchEvent(event); }
/** * Starts a new gesture and calls the listener just before starting it. */ private void startGesture() { if (!mGestureInProgress) { if (mListener != null) { mListener.onGestureBegin(this); } mGestureInProgress = true; } }
/** Gets the X component of the translation */ public float getTranslationX() { return calcAverage(mDetector.getCurrentX(), mDetector.getPointerCount()) - calcAverage(mDetector.getStartX(), mDetector.getPointerCount()); }
/** Gets the Y component of the translation */ public float getTranslationY() { return calcAverage(mDetector.getCurrentY(), mDetector.getPointerCount()) - calcAverage(mDetector.getStartY(), mDetector.getPointerCount()); }
/** Gets the X coordinate of the pivot point */ public float getPivotX() { return calcAverage(mDetector.getStartX(), mDetector.getPointerCount()); }
/** Gets the Y coordinate of the pivot point */ public float getPivotY() { return calcAverage(mDetector.getStartY(), mDetector.getPointerCount()); }
/** Factory method that creates a new instance of TransformGestureDetector */ public static TransformGestureDetector newInstance() { return new TransformGestureDetector(MultiPointerGestureDetector.newInstance()); }
@Override public void onGestureEnd(MultiPointerGestureDetector detector) { if (mListener != null) { mListener.onGestureEnd(this); } }
@Override public void onGestureUpdate(MultiPointerGestureDetector detector) { if (mListener != null) { mListener.onGestureUpdate(this); } }
@Override public void onGestureBegin(MultiPointerGestureDetector detector) { if (mListener != null) { mListener.onGestureBegin(this); } }
/** * Resets the component to the initial state. */ public void reset() { mDetector.reset(); }