Added in API level 34

InsertModeGesture


class InsertModeGesture : HandwritingGesture, Parcelable

A sub-class of HandwritingGesture for starting an insert mode which inserts a space in the editor to let users hand write freely at the designated insertion point. This class holds the information required for insertion of text in toolkit widgets like TextView. Once InsertMode gesture is started, it continues until IME calls CancellationSignal.cancel() and toolkit can receive cancel using CancellationSignal.setOnCancelListener(CancellationSignal.OnCancelListener) obtained from getCancellationSignal().

Summary

Nested classes

Builder for InsertModeGesture.

Inherited constants
Int CONTENTS_FILE_DESCRIPTOR

Descriptor bit used with describeContents(): indicates that the Parcelable object's flattened representation includes a file descriptor.

Int PARCELABLE_WRITE_RETURN_VALUE

Flag for use with writeToParcel: the object being written is a return value, that is the result of a function such as "Parcelable someFunction()", "void someFunction(out Parcelable)", or "void someFunction(inout Parcelable)". Some implementations may want to release resources at this point.

Int GRANULARITY_CHARACTER

Operate on text per character basis. i.e. each character is selected based on its intersection with selection rectangle.

Strategy of operating at a granular level is maintained in the UI toolkit. A character/word/line is included if its center is within the gesture rectangle. e.g. if a selection RectF with GRANULARITY_CHARACTER includes width-wise center of the character, it should be selected. Similarly, text in a line should be included in the operation if rectangle includes line height center.

Int GRANULARITY_WORD

Operate text per word basis. e.g. if selection includes width-wise center of the word, whole word is selected.

Strategy of operating at a granular level is maintained in the UI toolkit. A character/word/line is included if its center is within the gesture rectangle. e.g. if a selection RectF with GRANULARITY_WORD includes width-wise center of the word, it should be selected. Similarly, text in a line should be included in the operation if rectangle includes line height center.

Refer to https://www.unicode.org/reports/tr29/#Word_Boundaries for more detail on how word breaks are decided.

Public methods
Int

Boolean
equals(other: Any?)

CancellationSignal

Returns the CancellationSignal associated with finishing this gesture.

PointF

Returns the insertion point PointF (in screen coordinates) where space will be created for additional text to be inserted.

Int

Unit
writeToParcel(dest: Parcel, flags: Int)

Used to package this object into a Parcel.

Inherited functions
String? getFallbackText()

The fallback text that will be committed at current cursor position if there is no applicable text beneath the area of gesture. For example, select can fail if gesture is drawn over area that has no text beneath. example 2: join can fail if the gesture is drawn over text but there is no whitespace.

Properties
static Parcelable.Creator<InsertModeGesture!>

Used to make this class parcelable.

Public methods

describeContents

Added in API level 34
fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

equals

Added in API level 34
fun equals(other: Any?): Boolean
Parameters
obj the reference object with which to compare.
Return
Boolean true if this object is the same as the obj argument; false otherwise.

getCancellationSignal

Added in API level 34
fun getCancellationSignal(): CancellationSignal

Returns the CancellationSignal associated with finishing this gesture. Once InsertMode gesture is started, it continues until IME calls CancellationSignal.cancel() and toolkit can receive cancel using CancellationSignal.setOnCancelListener(CancellationSignal.OnCancelListener).

Return
CancellationSignal This value cannot be null.

getInsertionPoint

Added in API level 34
fun getInsertionPoint(): PointF

Returns the insertion point PointF (in screen coordinates) where space will be created for additional text to be inserted.

Return
PointF This value cannot be null.

hashCode

Added in API level 34
fun hashCode(): Int
Return
Int a hash code value for this object.

writeToParcel

Added in API level 34
fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit

Used to package this object into a Parcel.

Parameters
dest Parcel: The Parcel to be written. This value cannot be null.
flags Int: The flags used for parceling.

Properties

CREATOR

Added in API level 34
static val CREATOR: Parcelable.Creator<InsertModeGesture!>

Used to make this class parcelable.