Skip to content
This repository has been archived by the owner on Dec 26, 2018. It is now read-only.

ejeinc/RotateGestureDetector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RotateGestureDetector

(and helper class CompositeGestureDetector.)

RotateGestureDetector can detect two fingure rotation. You can implement rotation function such as Google Map.

Install

Download jar and add to libs directory.

Code sample

You can use RotateGestureDetector as same as GestureDetector.

private RotateGestureDetector mRotateGestureDetector;

...

// onCreate etc.
OnRotateGestureListener listener = new OnRotateGestureListener() {
  @Override
  public boolean onRotate(float degrees, float focusX, float focusY) {
    // implement your behavior here
    return true;
  }
};
mRotateGestureDetector = new RotateGestureDetector(context, listener);

...

@Override
public void onTouchEvent(MotionEvent e){
  mRotateGestureDetector.onTouchEvent(e);  
}

How to use

Simply copy directories in src to your source tree.

CompositeGestureDetector

If you want to use GestureDetector, ScaleGestureDetector and RotateGestureDetector together, it's time to use CompositeGestureDetector.

NOTE : CompositeGestureDetector needs android-support-v4.jar.

private CompositeGestureDetector gd;

...

// onCreate etc.
SimpleOnCompositeGestureListener listener = new SimpleOnCompositeGestureListener() {
  @Override
  public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
    // put your code
    return true;
  }
  
  @Override
  public boolean onScale(ScaleGestureDetector detector) {
    // put your code
    return true;
  }
  
  @Override
  public boolean onRotate(float degrees, float focusX, float focusY) {
    // put your code
    return true;
  }
  
  // ... and other methods
};
gd = new CompositeGestureDetector(context, listener);

...

@Override
public void onTouchEvent(MotionEvent e){
  gd.onTouchEvent(e);  
}

License

MIT License. See the LICENSE file for more info.

About

RotateGestureDetector for Android.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages