sk.baka.ambient.views.gesturelist
Class MouseGesturesRecognizer

java.lang.Object
  extended by sk.baka.ambient.views.gesturelist.MouseGesturesRecognizer

public final class MouseGesturesRecognizer
extends Object

Responsible for processing mouse events and recognition of mouse movements. Thread unsafe, should be called from the UI thread only.

Author:
Martin Vysny

Nested Class Summary
static class MouseGesturesRecognizer.GestureEnum
          The gesture event type.
 
Field Summary
static char DOWN_MOVE
          String representation of down movement.
 int gridSize
          Grid size.
static char LEFT_MOVE
          String representation of left movement.
static char RIGHT_MOVE
          String representation of right movement.
static char UP_MOVE
          String representation of up movement.
 
Constructor Summary
MouseGesturesRecognizer()
           
 
Method Summary
 String getGesture()
          Returns string representation of mouse gesture.
 char getLastGesture()
          Returns last gesture.
 boolean isGestureRecognized()
          Indicates whether any movements were recognized.
 MouseGesturesRecognizer.GestureEnum processMouseEvent(MotionEvent mouseEvent)
          Processes mouse event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT_MOVE

public static final char LEFT_MOVE
String representation of left movement.

See Also:
Constant Field Values

RIGHT_MOVE

public static final char RIGHT_MOVE
String representation of right movement.

See Also:
Constant Field Values

UP_MOVE

public static final char UP_MOVE
String representation of up movement.

See Also:
Constant Field Values

DOWN_MOVE

public static final char DOWN_MOVE
String representation of down movement.

See Also:
Constant Field Values

gridSize

public int gridSize
Grid size. Default is 15.

Constructor Detail

MouseGesturesRecognizer

public MouseGesturesRecognizer()
Method Detail

processMouseEvent

public MouseGesturesRecognizer.GestureEnum processMouseEvent(MotionEvent mouseEvent)
Processes mouse event.

Parameters:
mouseEvent - MouseEvent
Returns:
the gesture event, may be null if no new gesture occured as a result of the event.

getGesture

public String getGesture()
Returns string representation of mouse gesture.

Returns:
String representation of mouse gesture. "L" for left, "R" for right, "U" for up, "D" for down movements. For example: "ULD".

isGestureRecognized

public boolean isGestureRecognized()
Indicates whether any movements were recognized.

Returns:
true if there are recognized movements; false otherwise

getLastGesture

public char getLastGesture()
Returns last gesture.

Returns:
last gesture or zero char if no gesture was made.


Copyright © 2007-2008. All Rights Reserved.