|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.nokia.mid.ui.gestures.GestureInteractiveZone
public class GestureInteractiveZone
The GestureInteractiveZone class is used by an application to define an area of the screen that reacts to a set of specified gestures.
The application can register for one or more gestures, without specifying them individually. Once registered, all specified gesture events received on the container will be automatically routed to the GestureListener.
The gesture API supports the following events:
GESTURE_TAP
- Simple press and release.
GESTURE_LONG_PRESS
- Press and hold for
long press interval followed by release.
GESTURE_LONG_PRESS_REPEATED
- Repeated
long presses.
GESTURE_DRAG
- Press and move.
GESTURE_DROP
- Press and move followed
by release. It is possible that a Flick gesture maybe recognised instead
of the drop gesture.
GESTURE_FLICK
- Press and move followed
by release. It is possible that a Drop gesture maybe returned if Flick
gesture cannot be recognised.
The application can either register for events for the whole canvas or
can specify one or more rectangular zones within which it wants to receive
events. To specify a rectangular zone the application must call
setRectangle(int x, int y, int width, int height)
.
Note: The application does not need to call setRectangle(int x, int y, int width, int height)
if it wants to receive gesture events for the whole canvas.
The application is limited to the number of rectangular gesture zones that the application can define per container.
The platform supports the application defining overlapping gesture zones, in this case the registered listener for each zone will receive the gesture event.
When a rectangular gesture zone has been specified the application will only receive events where the touch event originated within the defined rectangular region. This is the case for all touch event types (tap, drag, drop and flick). E.g. If the user starts the drag inside the rectangle region and finishes outside the region then an event will be received. However, if the user starts a drag action outside the rectangular region and finishes within the region no event will be received.
There are two special cases for tap only type events.
If the application has registered for only the GESTURE_TAP
type of event and a rectangular gesture zone has been specified then the tap
gesture will only be received if the initial press and the release occur
within the gesture zone. If the tap moves outside of the gesture zone at
any time the gesture event will be still received as long as the release
occurs back inside the gesture zone.
If the application has registered for only GESTURE_LONG_PRESS
or
GESTURE_LONG_PRESS_REPEATED
type events and a rectangular gesture zone
has been specified then the tap gestures will only be received if the
initial press and the release occur within the gesture zone.If the tap
moves outside of the gesture zone at any time the gesture recognition
is ended and no gesture event will be received. If the application has
registered for GESTURE_TAP
type events at the same time as these events
then the rules described in the previous paragraph still hold for the
GESTURE_TAP
event.
The application can use setRectangle(int x, int y, int width, int height)
to change the size and location
of an interactive gesture zone at any time. The API imposes the
limitation that the zone will not be updated until the current gesture
recognition has ended.
The application can modify the repeated long press interval at any time. The API imposes the limitation that the interval will not be updated until the current gesture recognition has ended.
Field Summary | |
---|---|
static int |
GESTURE_ALL
Constant for All Gesture Events. |
static int |
GESTURE_DRAG
Constant for the Drag Gesture. |
static int |
GESTURE_DROP
Constant for the Drop Gesture. |
static int |
GESTURE_FLICK
Constant for the Flick Gesture. |
static int |
GESTURE_LONG_PRESS
Constant for the Long Press Gesture. |
static int |
GESTURE_LONG_PRESS_REPEATED
Constant for the Long Press Repeated Gesture. |
static int |
GESTURE_TAP
Constant for the Tap Gesture. |
Constructor Summary | |
---|---|
GestureInteractiveZone(int gestures)
Construct a new Gesture Interactive Zone. |
|
GestureInteractiveZone(int gestures,
int timeInterval)
Construct a new Gesture Interactive Zone. |
Method Summary | |
---|---|
int |
getGestures()
Query for the gestures associated with the gesture event registration. |
int |
getHeight()
Query for the height of the gesture event rectangle in pixels. |
int |
getLongPressTimeInterval()
Query for the long press gesture time interval in milliseconds. |
int |
getWidth()
Query for the width of the gesture event rectangle in pixels. |
int |
getX()
Query for the horizontal location of the gesture event rectangle. |
int |
getY()
Query for the vertical location of the gesture event rectangle. |
static boolean |
isSupported(int gestureEventIdentity)
Query if a specific gesture is supported by the platform. |
void |
setGestures(int gestures)
Update the list of gestures that are detected for the interactive zone. |
void |
setLongPressTimeInterval(int timeInterval)
Set the long press event time interval. |
void |
setRectangle(int x,
int y,
int width,
int height)
Defines the gesture event rectangle location and dimensions. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int GESTURE_TAP
Constant for the Tap Gesture.
GESTURE_TAP has the value 0x1.
public static final int GESTURE_LONG_PRESS
Constant for the Long Press Gesture.
GESTURE_LONG_PRESS has the value 0x2.
public static final int GESTURE_DRAG
Constant for the Drag Gesture.
GESTURE_DRAG has the value 0x4.
public static final int GESTURE_DROP
Constant for the Drop Gesture.
GESTURE_DROP has the value 0x8.
public static final int GESTURE_FLICK
Constant for the Flick Gesture.
GESTURE_FLICK has the value 0x10.
public static final int GESTURE_LONG_PRESS_REPEATED
Constant for the Long Press Repeated Gesture.
GESTURE_LONG_PRESS_REPEATED has the value 0x20.
public static final int GESTURE_ALL
Constant for All Gesture Events.
Constructor Detail |
---|
public GestureInteractiveZone(int gestures)
Construct a new Gesture Interactive Zone.
The MIDlet can register for more than one gesture event at a time.
gestures
- - gesture events to receive.
java.lang.IllegalArgumentException
- - if gestures contains no defined
gestures or only contains undefined gesture events.public GestureInteractiveZone(int gestures, int timeInterval)
Construct a new Gesture Interactive Zone.
The MIDlet can register for more than one gesture event at a time.
gestures
- - gesture events to receive.timeInterval
- - time interval in milliseconds for repeated
long press events.
java.lang.IllegalArgumentException
- - if gestures contains no defined
gestures or only contains undefined gesture events.
java.lang.IllegalArgumentException
- - if time interval is less than 0.Method Detail |
---|
public void setRectangle(int x, int y, int width, int height)
Defines the gesture event rectangle location and dimensions.
The X and Y coordinate locations can be set to any values, however the rectangle will be clipped against the registered container.
x
- - the horizontal location of the gesture event rectangle
in pixels relative to the containers origin
(the corner where x is smallest).y
- - the vertical location of the gesture event rectangle
in pixels relative to the containers origin
(the corner where y is smallest).width
- - the width of the gesture event rectangle in pixels.height
- - the height of the gesture event rectangle in pixels.
java.lang.IllegalArgumentException
- - if either the width or height is zero or less.public void setLongPressTimeInterval(int timeInterval)
Set the long press event time interval.
timeInterval
- - time interval in milliseconds for repeated long press gesture.
java.lang.IllegalArgumentException
- - if time interval is less than 0.public int getGestures()
Query for the gestures associated with the gesture event registration.
public void setGestures(int gestures)
Update the list of gestures that are detected for the interactive zone.
gestures
- - gesture events to receive.public int getX()
Query for the horizontal location of the gesture event rectangle.
public int getY()
Query for the vertical location of the gesture event rectangle.
public int getWidth()
Query for the width of the gesture event rectangle in pixels.
public int getHeight()
Query for the height of the gesture event rectangle in pixels.
public int getLongPressTimeInterval()
Query for the long press gesture time interval in milliseconds.
public static boolean isSupported(int gestureEventIdentity)
Query if a specific gesture is supported by the platform.
gestureEventIdentity
- - Gesture event identity to check for platform support.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |