io.selendroid.android
Class AndroidTouchScreen

java.lang.Object
  extended by io.selendroid.android.AndroidTouchScreen
All Implemented Interfaces:
TouchScreen

public class AndroidTouchScreen
extends Object
implements TouchScreen

Implements touch capabilities of a device.


Constructor Summary
AndroidTouchScreen(ServerInstrumentation instrumentation, MotionSender motions)
           
 
Method Summary
 void doubleTap(Coordinates where)
          Allows the execution of double tapon the screen, analogous to double click using a Mouse.
 void down(int x, int y)
          Allows the execution of the gesture 'down' on the screen.
 void flick(Coordinates where, int xOffset, int yOffset, int speed)
          Allows the execution of flick gestures starting in a location's element.
 void flick(int speedX, int speedY)
          Sends a flick gesture to the current view.
 float getBrightness()
           
 void longPress(Coordinates where)
          Allows the execution of long press gestures.
 void move(int x, int y)
          Allows the execution of the gesture 'move' on the screen.
 void scroll(Coordinates where, int xOffset, int yOffset)
          Creates a scroll gesture that starts on a particular screen location.
 void scroll(int xOffset, int yOffset)
          Allows the view to be scrolled by an x and y offset.
 void setBrightness(float brightness)
          Set the screen brightness, with a setting of 0 meaning that the screen should be turned off.
 void singleTap(Coordinates where)
          Allows the execution of single tap on the screen, analogous to click using a Mouse.
 void up(int x, int y)
          Allows the execution of the gesture 'up' on the screen.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AndroidTouchScreen

public AndroidTouchScreen(ServerInstrumentation instrumentation,
                          MotionSender motions)
Method Detail

singleTap

public void singleTap(Coordinates where)
Description copied from interface: TouchScreen
Allows the execution of single tap on the screen, analogous to click using a Mouse.

Specified by:
singleTap in interface TouchScreen
Parameters:
where - The location on the screen. Typically a WebElement

down

public void down(int x,
                 int y)
Description copied from interface: TouchScreen
Allows the execution of the gesture 'down' on the screen. It is typically the first of a sequence of touch gestures.

Specified by:
down in interface TouchScreen
Parameters:
x - The x coordinate relative to the viewport
y - The y coordinate relative to the viewport

up

public void up(int x,
               int y)
Description copied from interface: TouchScreen
Allows the execution of the gesture 'up' on the screen. It is typically the last of a sequence of touch gestures.

Specified by:
up in interface TouchScreen
Parameters:
x - The x coordinate relative to the viewport
y - The y coordinate relative to the viewport

move

public void move(int x,
                 int y)
Description copied from interface: TouchScreen
Allows the execution of the gesture 'move' on the screen.

Specified by:
move in interface TouchScreen
Parameters:
x - The x coordinate relative to the viewport
y - The y coordinate relative to the viewport

scroll

public void scroll(Coordinates where,
                   int xOffset,
                   int yOffset)
Description copied from interface: TouchScreen
Creates a scroll gesture that starts on a particular screen location.

Specified by:
scroll in interface TouchScreen
Parameters:
where - the location where the scroll starts, usually a WebElement.
xOffset - The x offset to scroll
yOffset - The y offset to scroll

doubleTap

public void doubleTap(Coordinates where)
Description copied from interface: TouchScreen
Allows the execution of double tapon the screen, analogous to double click using a Mouse.

Specified by:
doubleTap in interface TouchScreen
Parameters:
where - The coordinates of the element to double tap

longPress

public void longPress(Coordinates where)
Description copied from interface: TouchScreen
Allows the execution of long press gestures.

Specified by:
longPress in interface TouchScreen
Parameters:
where - The coordinate of the element to long press

scroll

public void scroll(int xOffset,
                   int yOffset)
Description copied from interface: TouchScreen
Allows the view to be scrolled by an x and y offset.

Specified by:
scroll in interface TouchScreen
Parameters:
xOffset - The horizontal offset relative to the viewport
yOffset - The vertical offset relative to the viewport

flick

public void flick(int speedX,
                  int speedY)
Description copied from interface: TouchScreen
Sends a flick gesture to the current view.

Specified by:
flick in interface TouchScreen
Parameters:
speedX - The horizontal speed in pixels/second
speedY - The vertical speed in pixels/second

flick

public void flick(Coordinates where,
                  int xOffset,
                  int yOffset,
                  int speed)
Description copied from interface: TouchScreen
Allows the execution of flick gestures starting in a location's element.

Specified by:
flick in interface TouchScreen
Parameters:
where - The coordinate of the element to flick on
xOffset - The x offset relative to the viewport
yOffset - The y offset relative to the viewport

getBrightness

public float getBrightness()
Specified by:
getBrightness in interface TouchScreen
Returns:
The current screen brightness as a float between 0 and 1. If the screen is off, 0.0 will be returned.

setBrightness

public void setBrightness(float brightness)
Description copied from interface: TouchScreen
Set the screen brightness, with a setting of 0 meaning that the screen should be turned off.

Specified by:
setBrightness in interface TouchScreen
Parameters:
brightness - The screen brightness to use.


Copyright © 2014. All rights reserved.