public class GesturePlanner extends Object
T-Plan Robot Enterprise, (C) 2009-2022 T-Plan Limited. All rights reserved.
Modifier and Type | Class and Description |
---|---|
static interface |
GesturePlanner.GesturePlannerListener
Gesture event consumer.
|
Constructor and Description |
---|
GesturePlanner(int finger)
Create a new gesture planner for a specific finger and a press location.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsDrags()
Find out if the gesture is a tap or long press (false) or if it contains
at least one drag.
|
Point2D |
getEnd()
Get the end (release) point.
|
int |
getFinger()
Get the finger Id.
|
double |
getLength()
Calculate length of the gesture from the start point to the last move
position (release point).
|
List<Point2D> |
getMoves()
Get the list of move points.
|
Point2D |
getStart()
Get the start (press) point.
|
int |
getWait() |
static Map<Integer,GesturePlanner> |
initWithGestureCapable(List<Map> params,
Dimension screenSize,
int maxFingers,
int duration,
int wait)
Prepare a map of gesture planners from the list of parameters created by
the automation framework for use with a
GestureCapable . |
boolean |
isLongPress()
Find out if the start press is a long one.
|
void |
moveTo(int x,
int y)
Add a location to drag to from the last position.
|
void |
moveTo(Point p)
Add a location to drag to from the last position.
|
Point |
next() |
void |
plan(GesturePlanner.GesturePlannerListener consumer)
Send the gesture events to the specified consumer.
|
void |
setStart(int x,
int y,
boolean longPress)
Set the gesture start (press) point.
|
void |
setTiming(int duration,
int wait)
Set the gesture duration and individual step delays.
|
String |
toString() |
public GesturePlanner(int finger)
finger
- a finger Id.public void setStart(int x, int y, boolean longPress)
x
- the press (start) X-coordinate.y
- the press (start) Y-coordinate.longPress
- true/false for a long/short press.public Point2D getStart()
public boolean containsDrags()
public Point2D getEnd()
public int getFinger()
public List<Point2D> getMoves()
public boolean isLongPress()
public void moveTo(Point p)
p
- a location to drag to.public void moveTo(int x, int y)
x
- the X-coord to drag to.y
- the Y-coord to drag to.public void setTiming(int duration, int wait)
duration
- total gesture duration in milliseconds.wait
- delay between two subsequent steps in milliseconds.public int getWait()
public double getLength()
public Point next()
public void plan(GesturePlanner.GesturePlannerListener consumer)
setTiming(int, int)
method must be called before this method to
set the time parameters.consumer
- the consumer.public static Map<Integer,GesturePlanner> initWithGestureCapable(List<Map> params, Dimension screenSize, int maxFingers, int duration, int wait)
GestureCapable
.params
- the list of parameters.screenSize
- the screen size.maxFingers
- maximum number of fingers supported by the device.duration
- gesture duration in milliseconds.wait
- time to wait between two subsequent steps in milliseconds.