congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
com.oginotihiro.cropview.gestures
Code IndexAdd Tabnine to your IDE (free)

How to use com.oginotihiro.cropview.gestures

Best Java code snippets using com.oginotihiro.cropview.gestures (Showing top 16 results out of 315)

origin: wangyisll/TessTwoDemo

  public static GestureDetector newInstance(Context context, OnGestureListener listener) {
    final int sdkVersion = Build.VERSION.SDK_INT;
    GestureDetector detector;

    if (sdkVersion < Build.VERSION_CODES.ECLAIR) {
      detector = new CupcakeGestureDetector(context);
    } else if (sdkVersion < Build.VERSION_CODES.FROYO) {
      detector = new EclairGestureDetector(context);
    } else {
      detector = new FroyoGestureDetector(context);
    }

    detector.setOnGestureListener(listener);

    return detector;
  }
}
origin: oginotihiro/cropview

  @Override
  public boolean onTouchEvent(MotionEvent ev) {
    mDetector.onTouchEvent(ev);
    return super.onTouchEvent(ev);
  }
}
origin: oginotihiro/cropview

@Override
public void onDrag(float dx, float dy) {
  if (mDragScaleDetector.isScaling()) {
    return;
  }
  mSuppMatrix.postTranslate(dx, dy);
  checkAndDisplayMatrix();
}
origin: oginotihiro/cropview

mLastTouchX = getActiveX(ev);
mLastTouchY = getActiveY(ev);
mIsDragging = false;
break;
final float x = getActiveX(ev);
final float y = getActiveY(ev);
final float dx = x - mLastTouchX, dy = y - mLastTouchY;
  mListener.onDrag(dx, dy);
  mLastTouchX = x;
  mLastTouchY = y;
if (mIsDragging) {
  if (null != mVelocityTracker) {
    mLastTouchX = getActiveX(ev);
    mLastTouchY = getActiveY(ev);
      mListener.onFling(mLastTouchX, mLastTouchY, -vX, -vY);
origin: oginotihiro/cropview

@Override
public boolean onScale(ScaleGestureDetector detector) {
  float scaleFactor = detector.getScaleFactor();
  if (Float.isNaN(scaleFactor) || Float.isInfinite(scaleFactor)) {
    return false;
  }
  mListener.onScale(scaleFactor, detector.getFocusX(), detector.getFocusY());
  return true;
}
origin: wangyisll/TessTwoDemo

@Override
public boolean onTouchEvent(MotionEvent ev) {
  final int action = ev.getAction();
  switch (action & MotionEvent.ACTION_MASK) {
    case MotionEvent.ACTION_DOWN:
      mActivePointerId = ev.getPointerId(0);
      break;
    case MotionEvent.ACTION_CANCEL:
    case MotionEvent.ACTION_UP:
      mActivePointerId = INVALID_POINTER_ID;
      break;
    case MotionEvent.ACTION_POINTER_UP:
      // Ignore deprecation, ACTION_POINTER_ID_MASK and
      // ACTION_POINTER_ID_SHIFT has same value and are deprecated
      // You can have either deprecation or lint target api warning
      final int pointerIndex = Compat.getPointerIndex(ev.getAction());
      final int pointerId = ev.getPointerId(pointerIndex);
      if (pointerId == mActivePointerId) {
        // This was our active pointer going up. Choose a new
        // active pointer and adjust accordingly.
        final int newPointerIndex = pointerIndex == 0 ? 1 : 0;
        mActivePointerId = ev.getPointerId(newPointerIndex);
        mLastTouchX = ev.getX(newPointerIndex);
        mLastTouchY = ev.getY(newPointerIndex);
      }
      break;
  }
  mActivePointerIndex = ev.findPointerIndex(mActivePointerId != INVALID_POINTER_ID ? mActivePointerId : 0);
  return super.onTouchEvent(ev);
}
origin: wangyisll/TessTwoDemo

@Override
public boolean onTouchEvent(MotionEvent ev) {
  boolean handled = false;
  if (getDrawable() != null && mCropRect != null) {
    switch (ev.getAction()) {
      case ACTION_DOWN:
        cancelFling();
        break;
      case ACTION_CANCEL:
      case ACTION_UP:
        break;
    }
    if (null != mDragScaleDetector) {
      handled = mDragScaleDetector.onTouchEvent(ev);
    }
    if (null != mGestureDetector && mGestureDetector.onTouchEvent(ev)) {
      handled = true;
    }
  }
  return true;
}
origin: wangyisll/TessTwoDemo

public CropView(Context context, AttributeSet attrs, int defStyleAttr) {
  super(context, attrs, defStyleAttr);
  setScaleType(ScaleType.MATRIX);
  mDragScaleDetector = VersionedGestureDetector.newInstance(context, this);
  mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener());
  mGestureDetector.setOnDoubleTapListener(new DefaultOnDoubleTapListener());
  outlinePaint.setAntiAlias(true);
  outlinePaint.setColor(highlightColor);
  outlinePaint.setStyle(Paint.Style.STROKE);
  outlinePaint.setStrokeWidth(dpToPx(OUTLINE_DP));
  outsidePaint.setARGB(125, 50, 50, 50);
  ViewTreeObserver observer = getViewTreeObserver();
  if (null != observer) {
    observer.addOnGlobalLayoutListener(this);
  }
}
origin: oginotihiro/cropview

  public static GestureDetector newInstance(Context context, OnGestureListener listener) {
    final int sdkVersion = Build.VERSION.SDK_INT;
    GestureDetector detector;

    if (sdkVersion < Build.VERSION_CODES.ECLAIR) {
      detector = new CupcakeGestureDetector(context);
    } else if (sdkVersion < Build.VERSION_CODES.FROYO) {
      detector = new EclairGestureDetector(context);
    } else {
      detector = new FroyoGestureDetector(context);
    }

    detector.setOnGestureListener(listener);

    return detector;
  }
}
origin: wangyisll/TessTwoDemo

mLastTouchX = getActiveX(ev);
mLastTouchY = getActiveY(ev);
mIsDragging = false;
break;
final float x = getActiveX(ev);
final float y = getActiveY(ev);
final float dx = x - mLastTouchX, dy = y - mLastTouchY;
  mListener.onDrag(dx, dy);
  mLastTouchX = x;
  mLastTouchY = y;
if (mIsDragging) {
  if (null != mVelocityTracker) {
    mLastTouchX = getActiveX(ev);
    mLastTouchY = getActiveY(ev);
      mListener.onFling(mLastTouchX, mLastTouchY, -vX, -vY);
origin: wangyisll/TessTwoDemo

  @Override
  public boolean onTouchEvent(MotionEvent ev) {
    mDetector.onTouchEvent(ev);
    return super.onTouchEvent(ev);
  }
}
origin: wangyisll/TessTwoDemo

@Override
public void onDrag(float dx, float dy) {
  if (mDragScaleDetector.isScaling()) {
    return;
  }
  mSuppMatrix.postTranslate(dx, dy);
  checkAndDisplayMatrix();
}
origin: wangyisll/TessTwoDemo

@Override
public boolean onScale(ScaleGestureDetector detector) {
  float scaleFactor = detector.getScaleFactor();
  if (Float.isNaN(scaleFactor) || Float.isInfinite(scaleFactor)) {
    return false;
  }
  mListener.onScale(scaleFactor, detector.getFocusX(), detector.getFocusY());
  return true;
}
origin: oginotihiro/cropview

@Override
public boolean onTouchEvent(MotionEvent ev) {
  final int action = ev.getAction();
  switch (action & MotionEvent.ACTION_MASK) {
    case MotionEvent.ACTION_DOWN:
      mActivePointerId = ev.getPointerId(0);
      break;
    case MotionEvent.ACTION_CANCEL:
    case MotionEvent.ACTION_UP:
      mActivePointerId = INVALID_POINTER_ID;
      break;
    case MotionEvent.ACTION_POINTER_UP:
      // Ignore deprecation, ACTION_POINTER_ID_MASK and
      // ACTION_POINTER_ID_SHIFT has same value and are deprecated
      // You can have either deprecation or lint target api warning
      final int pointerIndex = Compat.getPointerIndex(ev.getAction());
      final int pointerId = ev.getPointerId(pointerIndex);
      if (pointerId == mActivePointerId) {
        // This was our active pointer going up. Choose a new
        // active pointer and adjust accordingly.
        final int newPointerIndex = pointerIndex == 0 ? 1 : 0;
        mActivePointerId = ev.getPointerId(newPointerIndex);
        mLastTouchX = ev.getX(newPointerIndex);
        mLastTouchY = ev.getY(newPointerIndex);
      }
      break;
  }
  mActivePointerIndex = ev.findPointerIndex(mActivePointerId != INVALID_POINTER_ID ? mActivePointerId : 0);
  return super.onTouchEvent(ev);
}
origin: oginotihiro/cropview

@Override
public boolean onTouchEvent(MotionEvent ev) {
  boolean handled = false;
  if (getDrawable() != null && mCropRect != null) {
    switch (ev.getAction()) {
      case ACTION_DOWN:
        cancelFling();
        break;
      case ACTION_CANCEL:
      case ACTION_UP:
        break;
    }
    if (null != mDragScaleDetector) {
      handled = mDragScaleDetector.onTouchEvent(ev);
    }
    if (null != mGestureDetector && mGestureDetector.onTouchEvent(ev)) {
      handled = true;
    }
  }
  return handled;
}
origin: oginotihiro/cropview

public CropView(Context context, AttributeSet attrs, int defStyleAttr) {
  super(context, attrs, defStyleAttr);
  setScaleType(ScaleType.MATRIX);
  mDragScaleDetector = VersionedGestureDetector.newInstance(context, this);
  mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener());
  mGestureDetector.setOnDoubleTapListener(new DefaultOnDoubleTapListener());
  outlinePaint.setAntiAlias(true);
  outlinePaint.setColor(highlightColor);
  outlinePaint.setStyle(Paint.Style.STROKE);
  outlinePaint.setStrokeWidth(dpToPx(OUTLINE_DP));
  outsidePaint.setARGB(125, 50, 50, 50);
  ViewTreeObserver observer = getViewTreeObserver();
  if (null != observer) {
    observer.addOnGlobalLayoutListener(this);
  }
}
com.oginotihiro.cropview.gestures

Most used classes

  • CupcakeGestureDetector
  • EclairGestureDetector
  • FroyoGestureDetector
  • GestureDetector
  • OnGestureListener
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now