GlassGestureDetector
class GlassGestureDetector(context: Context, onGestureListener: GlassGestureDetector.OnGestureListener)
Gesture detector for Google Glass usage purposes.
It detects one and two finger gestures like:
- TAP
- TAP_AND_HOLD
- TWO_FINGER_TAP
- SWIPE_FORWARD
- TWO_FINGER_SWIPE_FORWARD
- SWIPE_BACKWARD
- TWO_FINGER_SWIPE_BACKWARD
- SWIPE_UP
- TWO_FINGER_SWIPE_UP
- SWIPE_DOWN
- TWO_FINGER_SWIPE_DOWN
Swipe detection depends on the:
- movement tan value
- movement distance
- movement velocity
To prevent unintentional SWIPE_DOWN, TWO_FINGER_SWIPE_DOWN, SWIPE_UP and TWO_FINGER_SWIPE_UP gestures, they are detected if movement angle is only between 60 and 120 degrees to the Glass touchpad horizontal axis. Any other detected swipes, will be considered as SWIPE_FORWARD and SWIPE_BACKWARD gestures, depends on the sign of the axis x movement value.
______________________________________________________________
| \ UP / |
| \ / |
| 60 120 |
| \ / |
| \ / |
| BACKWARD <------- 0 ------------ 180 ------> FORWARD |
| / \ |
| / \ |
| 60 120 |
| / \ |
| / DOWN \ |
--------------------------------------------------------------
Content copied to clipboard
Parameters
context
is a context of the application.
onGestureListener
is a listener for the gestures.
Types
Link copied to clipboard
Currently handled gestures.
Link copied to clipboard
interface OnGestureListener
Listens for the gestures.
Functions
Link copied to clipboard
Passes the MotionEvent object from the activity to the Android [ ].