GestureDescription.StrokeDescription


public static class GestureDescription.StrokeDescription
extends Object

java.lang.Object
   ↳ android.accessibilityservice.GestureDescription.StrokeDescription


Immutable description of stroke that can be part of a gesture.

Summary

Public constructors

StrokeDescription(Path path, long startTime, long duration)
StrokeDescription(Path path, long startTime, long duration, boolean willContinue)

Public methods

GestureDescription.StrokeDescription continueStroke(Path path, long startTime, long duration, boolean willContinue)

Create a new stroke that will continue this one.

long getDuration()

Get the stroke's duration

Path getPath()

Retrieve a copy of the path for this stroke

long getStartTime()

Get the stroke's start time

boolean willContinue()

Check if this stroke is marked to continue in the next gesture.

Inherited methods

Public constructors

StrokeDescription

Added in API level 24
public StrokeDescription (Path path, 
                long startTime, 
                long duration)

Parameters
path Path: The path to follow. Must have exactly one contour. The bounds of the path must not be negative. The path must not be empty. If the path has zero length (for example, a single moveTo()), the stroke is a touch that doesn't move. This value cannot be null.

startTime long: The time, in milliseconds, from the time the gesture starts to the time the stroke should start. Must not be negative. Value is 0 or greater

duration long: The duration, in milliseconds, the stroke takes to traverse the path. Must be positive. Value is 0 or greater

StrokeDescription

Added in API level 26
public StrokeDescription (Path path, 
                long startTime, 
                long duration, 
                boolean willContinue)

Parameters
path Path: The path to follow. Must have exactly one contour. The bounds of the path must not be negative. The path must not be empty. If the path has zero length (for example, a single moveTo()), the stroke is a touch that doesn't move. This value cannot be null.

startTime long: The time, in milliseconds, from the time the gesture starts to the time the stroke should start. Must not be negative. Value is 0 or greater

duration long: The duration, in milliseconds, the stroke takes to traverse the path. Must be positive. Value is 0 or greater

willContinue boolean: true if this stroke will be continued by one in the next gesture false otherwise. Continued strokes keep their pointers down when the gesture completes.

Public methods

continueStroke

Added in API level 26
public GestureDescription.StrokeDescription continueStroke (Path path, 
                long startTime, 
                long duration, 
                boolean willContinue)

Create a new stroke that will continue this one. This is only possible if this stroke will continue.

Parameters
path Path: The path for the stroke that continues this one. The starting point of this path must match the ending point of the stroke it continues.

startTime long: The time, in milliseconds, from the time the gesture starts to the time this stroke should start. Must not be negative. This time is from the start of the new gesture, not the one being continued.

duration long: The duration for the new stroke. Must not be negative.

willContinue boolean: true if this stroke will be continued by one in the next gesture false otherwise.

Returns
GestureDescription.StrokeDescription

getDuration

Added in API level 24
public long getDuration ()

Get the stroke's duration

Returns
long the duration for this stroke

getPath

Added in API level 24
public Path getPath ()

Retrieve a copy of the path for this stroke

Returns
Path A copy of the path

getStartTime

Added in API level 24
public long getStartTime ()

Get the stroke's start time

Returns
long the start time for this stroke.

willContinue

Added in API level 26
public boolean willContinue ()

Check if this stroke is marked to continue in the next gesture.

Returns
boolean true if the stroke is to be continued.