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

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

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.

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.

Develop your UI on Android.

Updated Apr 19, 2024