Java 类com.facebook.samples.gestures.TransformGestureDetector 实例源码

项目:GitHub    文件:DefaultZoomableController.java   
/**
 * Calculates the zoom transformation based on the current gesture.
 *
 * @param outTransform the matrix to store the result to
 * @param limitTypes whether to limit translation and/or scale.
 * @return whether or not the transform has been corrected due to limitation
 */
protected boolean calculateGestureTransform(
    Matrix outTransform,
    @LimitFlag int limitTypes) {
  TransformGestureDetector detector = mGestureDetector;
  boolean transformCorrected = false;
  outTransform.set(mPreviousTransform);
  if (mIsRotationEnabled) {
    float angle = detector.getRotation() * (float) (180 / Math.PI);
    outTransform.postRotate(angle, detector.getPivotX(), detector.getPivotY());
  }
  if (mIsScaleEnabled) {
    float scale = detector.getScale();
    outTransform.postScale(scale, scale, detector.getPivotX(), detector.getPivotY());
  }
  transformCorrected |=
      limitScale(outTransform, detector.getPivotX(), detector.getPivotY(), limitTypes);
  if (mIsTranslationEnabled) {
    outTransform.postTranslate(detector.getTranslationX(), detector.getTranslationY());
  }
  transformCorrected |= limitTranslation(outTransform, limitTypes);
  return transformCorrected;
}
项目:ZoomableDraweeView-sample    文件:DefaultZoomableController.java   
@Override
public void onGestureUpdate(TransformGestureDetector detector) {
  mActiveTransform.set(mPreviousTransform);
  if (mIsRotationEnabled) {
    float angle = detector.getRotation() * (float) (180 / Math.PI);
    mActiveTransform.postRotate(angle, detector.getPivotX(), detector.getPivotY());
  }
  if (mIsScaleEnabled) {
    float scale = detector.getScale();
    mActiveTransform.postScale(scale, scale, detector.getPivotX(), detector.getPivotY());
  }
  limitScale(detector.getPivotX(), detector.getPivotY());
  if (mIsTranslationEnabled) {
    mActiveTransform.postTranslate(detector.getTranslationX(), detector.getTranslationY());
  }
  limitTranslation();
  if (mListener != null) {
    mListener.onTransformChanged(mActiveTransform);
  }
}
项目:fresco    文件:DefaultZoomableController.java   
/**
 * Calculates the zoom transformation based on the current gesture.
 *
 * @param outTransform the matrix to store the result to
 * @param limitTypes whether to limit translation and/or scale.
 * @return whether or not the transform has been corrected due to limitation
 */
protected boolean calculateGestureTransform(
    Matrix outTransform,
    @LimitFlag int limitTypes) {
  TransformGestureDetector detector = mGestureDetector;
  boolean transformCorrected = false;
  outTransform.set(mPreviousTransform);
  if (mIsRotationEnabled) {
    float angle = detector.getRotation() * (float) (180 / Math.PI);
    outTransform.postRotate(angle, detector.getPivotX(), detector.getPivotY());
  }
  if (mIsScaleEnabled) {
    float scale = detector.getScale();
    outTransform.postScale(scale, scale, detector.getPivotX(), detector.getPivotY());
  }
  transformCorrected |=
      limitScale(outTransform, detector.getPivotX(), detector.getPivotY(), limitTypes);
  if (mIsTranslationEnabled) {
    outTransform.postTranslate(detector.getTranslationX(), detector.getTranslationY());
  }
  transformCorrected |= limitTranslation(outTransform, limitTypes);
  return transformCorrected;
}
项目:ZoomableFrescoExample    文件:DefaultZoomableController.java   
@Override
public void onGestureUpdate(TransformGestureDetector detector) {
  mActiveTransform.set(mPreviousTransform);
  if (mIsRotationEnabled) {
    float angle = detector.getRotation() * (float) (180 / Math.PI);
    mActiveTransform.postRotate(angle, detector.getPivotX(), detector.getPivotY());
  }
  if (mIsScaleEnabled) {
    float scale = detector.getScale();
    mActiveTransform.postScale(scale, scale, detector.getPivotX(), detector.getPivotY());
  }
  limitScale(detector.getPivotX(), detector.getPivotY());
  if (mIsTranslationEnabled) {
    mActiveTransform.postTranslate(detector.getTranslationX(), detector.getTranslationY());
  }
  limitTranslation();
  if (mListener != null) {
    mListener.onTransformChanged(mActiveTransform);
  }
}
项目:apps-android-wikipedia    文件:DefaultZoomableController.java   
/**
 * Calculates the zoom transformation based on the current gesture.
 *
 * @param outTransform the matrix to store the result to
 * @param limitTypes whether to limit translation and/or scale.
 * @return whether or not the transform has been corrected due to limitation
 */
protected boolean calculateGestureTransform(
    Matrix outTransform,
    @LimitFlag int limitTypes) {
  TransformGestureDetector detector = mGestureDetector;
  boolean transformCorrected = false;
  outTransform.set(mPreviousTransform);
  if (mIsRotationEnabled) {
    float angle = detector.getRotation() * (float) (180 / Math.PI);
    outTransform.postRotate(angle, detector.getPivotX(), detector.getPivotY());
  }
  if (mIsScaleEnabled) {
    float scale = detector.getScale();
    outTransform.postScale(scale, scale, detector.getPivotX(), detector.getPivotY());
  }
  transformCorrected |=
      limitScale(outTransform, detector.getPivotX(), detector.getPivotY(), limitTypes);
  if (mIsTranslationEnabled) {
    outTransform.postTranslate(detector.getTranslationX(), detector.getTranslationY());
  }
  transformCorrected |= limitTranslation(outTransform, limitTypes);
  return transformCorrected;
}
项目:GitHub    文件:DefaultZoomableController.java   
@Override
public void onGestureBegin(TransformGestureDetector detector) {
  FLog.v(TAG, "onGestureBegin");
  mPreviousTransform.set(mActiveTransform);
  // We only received a touch down event so far, and so we don't know yet in which direction a
  // future move event will follow. Therefore, if we can't scroll in all directions, we have to
  // assume the worst case where the user tries to scroll out of edge, which would cause
  // transformation to be corrected.
  mWasTransformCorrected = !canScrollInAllDirection();
}
项目:GitHub    文件:DefaultZoomableController.java   
@Override
public void onGestureUpdate(TransformGestureDetector detector) {
  FLog.v(TAG, "onGestureUpdate");
  boolean transformCorrected = calculateGestureTransform(mActiveTransform, LIMIT_ALL);
  onTransformChanged();
  if (transformCorrected) {
    mGestureDetector.restartGesture();
  }
  // A transformation happened, but was it without correction?
  mWasTransformCorrected = transformCorrected;
}
项目:GitHub    文件:AbstractAnimatedZoomableController.java   
@Override
public void onGestureUpdate(TransformGestureDetector detector) {
  FLog.v(getLogTag(), "onGestureUpdate %s", isAnimating() ? "(ignored)" : "");
  if (isAnimating()) {
    return;
  }
  super.onGestureUpdate(detector);
}
项目:fresco    文件:DefaultZoomableController.java   
@Override
public void onGestureBegin(TransformGestureDetector detector) {
  FLog.v(TAG, "onGestureBegin");
  mPreviousTransform.set(mActiveTransform);
  // We only received a touch down event so far, and so we don't know yet in which direction a
  // future move event will follow. Therefore, if we can't scroll in all directions, we have to
  // assume the worst case where the user tries to scroll out of edge, which would cause
  // transformation to be corrected.
  mWasTransformCorrected = !canScrollInAllDirection();
}
项目:fresco    文件:DefaultZoomableController.java   
@Override
public void onGestureUpdate(TransformGestureDetector detector) {
  FLog.v(TAG, "onGestureUpdate");
  boolean transformCorrected = calculateGestureTransform(mActiveTransform, LIMIT_ALL);
  onTransformChanged();
  if (transformCorrected) {
    mGestureDetector.restartGesture();
  }
  // A transformation happened, but was it without correction?
  mWasTransformCorrected = transformCorrected;
}
项目:fresco    文件:AbstractAnimatedZoomableController.java   
@Override
public void onGestureUpdate(TransformGestureDetector detector) {
  FLog.v(getLogTag(), "onGestureUpdate %s", isAnimating() ? "(ignored)" : "");
  if (isAnimating()) {
    return;
  }
  super.onGestureUpdate(detector);
}
项目:apps-android-wikipedia    文件:DefaultZoomableController.java   
@Override
public void onGestureBegin(TransformGestureDetector detector) {
  FLog.v(TAG, "onGestureBegin");
  mPreviousTransform.set(mActiveTransform);
  // We only received a touch down event so far, and so we don't know yet in which direction a
  // future move event will follow. Therefore, if we can't scroll in all directions, we have to
  // assume the worst case where the user tries to scroll out of edge, which would cause
  // transformation to be corrected.
  mWasTransformCorrected = !canScrollInAllDirection();
}
项目:apps-android-wikipedia    文件:DefaultZoomableController.java   
@Override
public void onGestureUpdate(TransformGestureDetector detector) {
  FLog.v(TAG, "onGestureUpdate");
  boolean transformCorrected = calculateGestureTransform(mActiveTransform, LIMIT_ALL);
  onTransformChanged();
  if (transformCorrected) {
    mGestureDetector.restartGesture();
  }
  // A transformation happened, but was it without correction?
  mWasTransformCorrected = transformCorrected;
}
项目:apps-android-wikipedia    文件:AbstractAnimatedZoomableController.java   
@Override
public void onGestureUpdate(TransformGestureDetector detector) {
  FLog.v(getLogTag(), "onGestureUpdate %s", isAnimating() ? "(ignored)" : "");
  if (isAnimating()) {
    return;
  }
  super.onGestureUpdate(detector);
}
项目:GitHub    文件:AnimatedZoomableControllerSupport.java   
public static AnimatedZoomableControllerSupport newInstance() {
  return new AnimatedZoomableControllerSupport(TransformGestureDetector.newInstance());
}
项目:GitHub    文件:AnimatedZoomableControllerSupport.java   
public AnimatedZoomableControllerSupport(TransformGestureDetector transformGestureDetector) {
  super(transformGestureDetector);
  mValueAnimator = ValueAnimator.ofFloat(0, 1);
  mValueAnimator.setInterpolator(new DecelerateInterpolator());
}
项目:GitHub    文件:DefaultZoomableController.java   
public static DefaultZoomableController newInstance() {
  return new DefaultZoomableController(TransformGestureDetector.newInstance());
}
项目:GitHub    文件:DefaultZoomableController.java   
public DefaultZoomableController(TransformGestureDetector gestureDetector) {
  mGestureDetector = gestureDetector;
  mGestureDetector.setListener(this);
}
项目:GitHub    文件:DefaultZoomableController.java   
/** Gets the gesture detector. */
protected TransformGestureDetector getDetector() {
  return mGestureDetector;
}
项目:GitHub    文件:DefaultZoomableController.java   
@Override
public void onGestureEnd(TransformGestureDetector detector) {
  FLog.v(TAG, "onGestureEnd");
}
项目:GitHub    文件:AbstractAnimatedZoomableController.java   
public AbstractAnimatedZoomableController(TransformGestureDetector transformGestureDetector) {
  super(transformGestureDetector);
}
项目:GitHub    文件:AbstractAnimatedZoomableController.java   
@Override
public void onGestureBegin(TransformGestureDetector detector) {
  FLog.v(getLogTag(), "onGestureBegin");
  stopAnimation();
  super.onGestureBegin(detector);
}
项目:GitHub    文件:AnimatedZoomableController.java   
public static AnimatedZoomableController newInstance() {
  return new AnimatedZoomableController(TransformGestureDetector.newInstance());
}
项目:GitHub    文件:AnimatedZoomableController.java   
@SuppressLint("NewApi")
public AnimatedZoomableController(TransformGestureDetector transformGestureDetector) {
  super(transformGestureDetector);
  mValueAnimator = ValueAnimator.ofFloat(0, 1);
  mValueAnimator.setInterpolator(new DecelerateInterpolator());
}
项目:ZoomableDraweeView-sample    文件:DefaultZoomableController.java   
public DefaultZoomableController(TransformGestureDetector gestureDetector) {
  mGestureDetector = gestureDetector;
  mGestureDetector.setListener(this);
}
项目:ZoomableDraweeView-sample    文件:DefaultZoomableController.java   
public static DefaultZoomableController newInstance() {
  return new DefaultZoomableController(TransformGestureDetector.newInstance());
}
项目:ZoomableDraweeView-sample    文件:DefaultZoomableController.java   
@Override
public void onGestureBegin(TransformGestureDetector detector) {
}
项目:ZoomableDraweeView-sample    文件:DefaultZoomableController.java   
@Override
public void onGestureEnd(TransformGestureDetector detector) {
  mPreviousTransform.set(mActiveTransform);
}
项目:fresco    文件:AnimatedZoomableControllerSupport.java   
public static AnimatedZoomableControllerSupport newInstance() {
  return new AnimatedZoomableControllerSupport(TransformGestureDetector.newInstance());
}
项目:fresco    文件:AnimatedZoomableControllerSupport.java   
public AnimatedZoomableControllerSupport(TransformGestureDetector transformGestureDetector) {
  super(transformGestureDetector);
  mValueAnimator = ValueAnimator.ofFloat(0, 1);
  mValueAnimator.setInterpolator(new DecelerateInterpolator());
}
项目:fresco    文件:DefaultZoomableController.java   
public static DefaultZoomableController newInstance() {
  return new DefaultZoomableController(TransformGestureDetector.newInstance());
}
项目:fresco    文件:DefaultZoomableController.java   
public DefaultZoomableController(TransformGestureDetector gestureDetector) {
  mGestureDetector = gestureDetector;
  mGestureDetector.setListener(this);
}
项目:fresco    文件:DefaultZoomableController.java   
/** Gets the gesture detector. */
protected TransformGestureDetector getDetector() {
  return mGestureDetector;
}
项目:fresco    文件:DefaultZoomableController.java   
@Override
public void onGestureEnd(TransformGestureDetector detector) {
  FLog.v(TAG, "onGestureEnd");
}
项目:fresco    文件:AbstractAnimatedZoomableController.java   
public AbstractAnimatedZoomableController(TransformGestureDetector transformGestureDetector) {
  super(transformGestureDetector);
}
项目:fresco    文件:AbstractAnimatedZoomableController.java   
@Override
public void onGestureBegin(TransformGestureDetector detector) {
  FLog.v(getLogTag(), "onGestureBegin");
  stopAnimation();
  super.onGestureBegin(detector);
}
项目:fresco    文件:AnimatedZoomableController.java   
public static AnimatedZoomableController newInstance() {
  return new AnimatedZoomableController(TransformGestureDetector.newInstance());
}
项目:fresco    文件:AnimatedZoomableController.java   
@SuppressLint("NewApi")
public AnimatedZoomableController(TransformGestureDetector transformGestureDetector) {
  super(transformGestureDetector);
  mValueAnimator = ValueAnimator.ofFloat(0, 1);
  mValueAnimator.setInterpolator(new DecelerateInterpolator());
}
项目:ZoomableFrescoExample    文件:DefaultZoomableController.java   
public DefaultZoomableController(TransformGestureDetector gestureDetector) {
  mGestureDetector = gestureDetector;
  mGestureDetector.setListener(this);
}
项目:ZoomableFrescoExample    文件:DefaultZoomableController.java   
public static DefaultZoomableController newInstance() {
  return new DefaultZoomableController(TransformGestureDetector.newInstance());
}