Sofia API Reference

  • Package Index
  • Class Index
  • Packages
  • sofia.app
  • sofia.content
  • sofia.data
  • sofia.graphics
  • sofia.util
  • sofia.view
    • Interfaces
    • RotateGestureDetector.OnRotateGestureListener
    • Classes
    • FlexibleContentView
    • RotateGestureDetector
    • RotateGestureDetector.SimpleOnRotateGestureListener
  • sofia.widget

public class
RotateGestureDetector

extends Object

Inheritance

  • java.lang.Object
    • sofia.view.RotateGestureDetector

Class Overview

Detects transformation gestures involving more than one pointer ("multitouch") using the supplied MotionEvents. The RotateGestureDetector.OnRotateGestureListener callback will notify users when a particular gesture event has occurred. This class should only be used with MotionEvents reported via touch. To use this class:

  • Create an instance of the RotateGestureDetector for your View
  • In the View#onTouchEvent(MotionEvent) method ensure you call onTouchEvent(MotionEvent). The methods defined in your callback will be executed when the events occur.


Summary

Nested Classes
interface RotateGestureDetector.OnRotateGestureListener The listener for receiving notifications when gestures occur. 
class RotateGestureDetector.SimpleOnRotateGestureListener A convenience class to extend when you only want to listen for a subset of rotation-related events. 
Public Constructors
RotateGestureDetector(Context context, RotateGestureDetector.OnRotateGestureListener listener)
Public Methods
float getCurrentSlope()
Return the current distance between the two pointers forming the gesture in progress.
long getEventTime()
Return the event time of the current event being processed.
float getFocusX()
Get the X coordinate of the current gesture's focal point.
float getFocusY()
Get the Y coordinate of the current gesture's focal point.
float getPreviousSlope()
Return the previous distance between the two pointers forming the gesture in progress.
float getRotation()
Return the rotation factor from the previous rotation event to the current event.
long getTimeDelta()
Return the time difference in milliseconds between the previous accepted rotation event and the current rotation event.
boolean isInProgress()
Returns true if a two-finger rotate gesture is in progress.
boolean onTouchEvent(MotionEvent event)
Methods inherited from class java.lang.Object
Object clone()
boolean equals(Object arg0)
void finalize()
final Class<?> getClass()
int hashCode()
final void notify()
final void notifyAll()
String toString()
final void wait()
final void wait(long arg0, int arg1)
final void wait(long arg0)

Public Constructors

public RotateGestureDetector (Context context, RotateGestureDetector.OnRotateGestureListener listener)


Public Methods

public float getCurrentSlope ()

Return the current distance between the two pointers forming the gesture in progress.

Returns

Distance between pointers in pixels.

public long getEventTime ()

Return the event time of the current event being processed.

Returns

Current event time in milliseconds.

public float getFocusX ()

Get the X coordinate of the current gesture's focal point. If a gesture is in progress, the focal point is directly between the two pointers forming the gesture. If a gesture is ending, the focal point is the location of the remaining pointer on the screen. If isInProgress() would return false, the result of this function is undefined.

Returns

X coordinate of the focal point in pixels.

public float getFocusY ()

Get the Y coordinate of the current gesture's focal point. If a gesture is in progress, the focal point is directly between the two pointers forming the gesture. If a gesture is ending, the focal point is the location of the remaining pointer on the screen. If isInProgress() would return false, the result of this function is undefined.

Returns

Y coordinate of the focal point in pixels.

public float getPreviousSlope ()

Return the previous distance between the two pointers forming the gesture in progress.

Returns

Previous distance between pointers in pixels.

public float getRotation ()

Return the rotation factor from the previous rotation event to the current event. This value is defined as (#getCurrentAngle() / #getPreviousAngle()).

Returns

The current rotation factor.

public long getTimeDelta ()

Return the time difference in milliseconds between the previous accepted rotation event and the current rotation event.

Returns

Time difference since the last rotation event in milliseconds.

public boolean isInProgress ()

Returns true if a two-finger rotate gesture is in progress.

Returns

true if a rotate gesture is in progress, false otherwise.

public boolean onTouchEvent (MotionEvent event)