SelectionEvent
class SelectionEvent : Parcelable
| kotlin.Any | |
| ↳ | android.view.textclassifier.SelectionEvent | 
A selection event. Specify index parameters as word token indices.
Summary
| Constants | |
|---|---|
| static Int | User abandoned the selection. | 
| static Int | User copied the selection. | 
| static Int | User cut the selection. | 
| static Int | User dragged+dropped the selection. | 
| static Int | User performed an action on the selection. | 
| static Int | User typed over the selection. | 
| static Int | User pasted over the selection. | 
| static Int | User reset the smart selection. | 
| static Int | User activated Select All | 
| static Int | User shared the selection. | 
| static Int | User clicked the textAssist menu item. | 
| static Int | Something else other than User or the default TextClassifier triggered a selection. | 
| static Int | User modified an existing selection. | 
| static Int | User started a new selection. | 
| static Int | Smart selection triggered spanning multiple tokens (words). | 
| static Int | Smart selection triggered for a single token (word). | 
| static Int | Selection was invoked by the user tapping on a link. | 
| static Int | Selection was invoked by the user long pressing, double tapping, or dragging to select. | 
| static Int | Unknown invocation method | 
| Inherited constants | |
|---|---|
| Public methods | |
|---|---|
| static SelectionEvent | createSelectionActionEvent(start: Int, end: Int, actionType: Int)Creates an event specifying an action taken on a selection. | 
| static SelectionEvent | createSelectionActionEvent(start: Int, end: Int, actionType: Int, classification: TextClassification)Creates an event specifying an action taken on a selection. | 
| static SelectionEvent | createSelectionModifiedEvent(start: Int, end: Int)Creates a "selection modified" event. | 
| static SelectionEvent | createSelectionModifiedEvent(start: Int, end: Int, classification: TextClassification)Creates a "selection modified" event. | 
| static SelectionEvent | createSelectionModifiedEvent(start: Int, end: Int, selection: TextSelection)Creates a "selection modified" event. | 
| static SelectionEvent | createSelectionStartedEvent(invocationMethod: Int, start: Int)Creates a "selection started" event. | 
| Int | |
| Boolean | Indicates whether some other object is "equal to" this one. | 
| Long | Returns the duration in ms between when this event was triggered and when the previous event in the selection session was triggered. | 
| Long | Returns the duration in ms between when this event was triggered and when the first event in the selection session was triggered. | 
| Int | getEnd()Returns the end index of this events relative to the index of the start selection event in the selection session. | 
| String | Returns the type of entity that is associated with this event. | 
| Int | Returns the index (e.g. 1st event, 2nd event, etc.) of this event in the selection session. | 
| Long | Returns the time this event was triggered. | 
| Int | Returns the type of event that was triggered. | 
| Int | Returns the way the selection mode was invoked. | 
| String | Returns the package name of the app that this event originated in. | 
| String? | Returns the id of the text classifier result associated with this event. | 
| TextClassificationSessionId? | Returns the selection session id. | 
| Int | Returns the end index of this events relative to the index of the smart selection event in the selection session. | 
| Int | Returns the start index of this events relative to the index of the smart selection event in the selection session. | 
| Int | getStart()Returns the start index of this events relative to the index of the start selection event in the selection session. | 
| String | Returns the type of widget that was involved in triggering this event. | 
| String? | Returns a string version info for the widget this event was triggered in. | 
| Int | hashCode() | 
| static Boolean | isTerminal(eventType: Int)Returns true if the eventType is a terminal event type. | 
| String | toString() | 
| Unit | writeToParcel(dest: Parcel, flags: Int) | 
| Properties | |
|---|---|
| static Parcelable.Creator<SelectionEvent!> | |
Constants
ACTION_ABANDON
static val ACTION_ABANDON: Int
User abandoned the selection.
Value: 107ACTION_DRAG
static val ACTION_DRAG: Int
User dragged+dropped the selection.
Value: 106ACTION_OTHER
static val ACTION_OTHER: Int
User performed an action on the selection.
Value: 108ACTION_OVERTYPE
static val ACTION_OVERTYPE: Int
User typed over the selection.
Value: 100ACTION_PASTE
static val ACTION_PASTE: Int
User pasted over the selection.
Value: 102ACTION_RESET
static val ACTION_RESET: Int
User reset the smart selection.
Value: 201ACTION_SELECT_ALL
static val ACTION_SELECT_ALL: Int
User activated Select All
Value: 200ACTION_SHARE
static val ACTION_SHARE: Int
User shared the selection.
Value: 104ACTION_SMART_SHARE
static val ACTION_SMART_SHARE: Int
User clicked the textAssist menu item.
Value: 105EVENT_AUTO_SELECTION
static val EVENT_AUTO_SELECTION: Int
Something else other than User or the default TextClassifier triggered a selection.
Value: 5EVENT_SELECTION_MODIFIED
static val EVENT_SELECTION_MODIFIED: Int
User modified an existing selection.
Value: 2EVENT_SELECTION_STARTED
static val EVENT_SELECTION_STARTED: Int
User started a new selection.
Value: 1EVENT_SMART_SELECTION_MULTI
static val EVENT_SMART_SELECTION_MULTI: Int
Smart selection triggered spanning multiple tokens (words).
Value: 4EVENT_SMART_SELECTION_SINGLE
static val EVENT_SMART_SELECTION_SINGLE: Int
Smart selection triggered for a single token (word).
Value: 3INVOCATION_LINK
static val INVOCATION_LINK: Int
Selection was invoked by the user tapping on a link.
Value: 2INVOCATION_MANUAL
static val INVOCATION_MANUAL: Int
Selection was invoked by the user long pressing, double tapping, or dragging to select.
Value: 1INVOCATION_UNKNOWN
static val INVOCATION_UNKNOWN: Int
Unknown invocation method
Value: 0Public methods
createSelectionActionEvent
static fun createSelectionActionEvent(
start: Int,
end: Int,
actionType: Int
): SelectionEvent
Creates an event specifying an action taken on a selection. Use when the user clicks on an action to act on the selected text.
| Parameters | |
|---|---|
| start | Int: the start (inclusive) index of the selection | 
| end | Int: the end (exclusive) index of the selection | 
| actionType | Int: the action that was performed on the selection Value is android.view.textclassifier.SelectionEvent#ACTION_OVERTYPE,android.view.textclassifier.SelectionEvent#ACTION_COPY,android.view.textclassifier.SelectionEvent#ACTION_PASTE,android.view.textclassifier.SelectionEvent#ACTION_CUT,android.view.textclassifier.SelectionEvent#ACTION_SHARE,android.view.textclassifier.SelectionEvent#ACTION_SMART_SHARE,android.view.textclassifier.SelectionEvent#ACTION_DRAG,android.view.textclassifier.SelectionEvent#ACTION_ABANDON,android.view.textclassifier.SelectionEvent#ACTION_OTHER,android.view.textclassifier.SelectionEvent#ACTION_SELECT_ALL, orandroid.view.textclassifier.SelectionEvent#ACTION_RESET | 
| Return | |
|---|---|
| SelectionEvent | This value cannot be null. | 
| Exceptions | |
|---|---|
| java.lang.IllegalArgumentException | if end is less than start | 
createSelectionActionEvent
static fun createSelectionActionEvent(
start: Int,
end: Int,
actionType: Int,
classification: TextClassification
): SelectionEvent
Creates an event specifying an action taken on a selection. Use when the user clicks on an action to act on the selected text and the selection's entity type is known.
| Parameters | |
|---|---|
| start | Int: the start (inclusive) index of the selection | 
| end | Int: the end (exclusive) index of the selection | 
| actionType | Int: the action that was performed on the selection Value is android.view.textclassifier.SelectionEvent#ACTION_OVERTYPE,android.view.textclassifier.SelectionEvent#ACTION_COPY,android.view.textclassifier.SelectionEvent#ACTION_PASTE,android.view.textclassifier.SelectionEvent#ACTION_CUT,android.view.textclassifier.SelectionEvent#ACTION_SHARE,android.view.textclassifier.SelectionEvent#ACTION_SMART_SHARE,android.view.textclassifier.SelectionEvent#ACTION_DRAG,android.view.textclassifier.SelectionEvent#ACTION_ABANDON,android.view.textclassifier.SelectionEvent#ACTION_OTHER,android.view.textclassifier.SelectionEvent#ACTION_SELECT_ALL, orandroid.view.textclassifier.SelectionEvent#ACTION_RESET | 
| classification | TextClassification: the TextClassification object returned by the TextClassifier that classified the selected text This value cannot be null. | 
| Return | |
|---|---|
| SelectionEvent | This value cannot be null. | 
| Exceptions | |
|---|---|
| java.lang.IllegalArgumentException | If actionType is not a valid SelectionEvent actionType | 
createSelectionModifiedEvent
static fun createSelectionModifiedEvent(
start: Int,
end: Int
): SelectionEvent
Creates a "selection modified" event. Use when the user modifies the selection.
| Parameters | |
|---|---|
| start | Int: the start (inclusive) index of the selection | 
| end | Int: the end (exclusive) index of the selection | 
| Return | |
|---|---|
| SelectionEvent | This value cannot be null. | 
| Exceptions | |
|---|---|
| java.lang.IllegalArgumentException | if end is less than start | 
createSelectionModifiedEvent
static fun createSelectionModifiedEvent(
start: Int,
end: Int,
classification: TextClassification
): SelectionEvent
Creates a "selection modified" event. Use when the user modifies the selection and the selection's entity type is known.
| Parameters | |
|---|---|
| start | Int: the start (inclusive) index of the selection | 
| end | Int: the end (exclusive) index of the selection | 
| classification | TextClassification: the TextClassification object returned by the TextClassifier that classified the selected text This value cannot be null. | 
| Return | |
|---|---|
| SelectionEvent | This value cannot be null. | 
| Exceptions | |
|---|---|
| java.lang.IllegalArgumentException | if end is less than start | 
createSelectionModifiedEvent
static fun createSelectionModifiedEvent(
start: Int,
end: Int,
selection: TextSelection
): SelectionEvent
Creates a "selection modified" event. Use when a TextClassifier modifies the selection.
| Parameters | |
|---|---|
| start | Int: the start (inclusive) index of the selection | 
| end | Int: the end (exclusive) index of the selection | 
| selection | TextSelection: the TextSelection object returned by the TextClassifier for the specified selection This value cannot be null. | 
| Return | |
|---|---|
| SelectionEvent | This value cannot be null. | 
| Exceptions | |
|---|---|
| java.lang.IllegalArgumentException | if end is less than start | 
createSelectionStartedEvent
static fun createSelectionStartedEvent(
invocationMethod: Int,
start: Int
): SelectionEvent
Creates a "selection started" event.
| Parameters | |
|---|---|
| invocationMethod | Int: the way the selection was triggered Value is android.view.textclassifier.SelectionEvent#INVOCATION_MANUAL,android.view.textclassifier.SelectionEvent#INVOCATION_LINK, orandroid.view.textclassifier.SelectionEvent#INVOCATION_UNKNOWN | 
| start | Int: the index of the selected text | 
| Return | |
|---|---|
| SelectionEvent | This value cannot be null. | 
describeContents
fun describeContents(): Int
| Return | |
|---|---|
| Int | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0orandroid.os.Parcelable#CONTENTS_FILE_DESCRIPTOR | 
equals
fun equals(other: Any?): Boolean
Indicates whether some other object is "equal to" this one.
 The equals method implements an equivalence relation on non-null object references: 
- It is reflexive: for any non-null reference value x,x.equals(x)should returntrue.
- It is symmetric: for any non-null reference values xandy,x.equals(y)should returntrueif and only ify.equals(x)returnstrue.
- It is transitive: for any non-null reference values x,y, andz, ifx.equals(y)returnstrueandy.equals(z)returnstrue, thenx.equals(z)should returntrue.
- It is consistent: for any non-null reference values xandy, multiple invocations ofx.equals(y)consistently returntrueor consistently returnfalse, provided no information used inequalscomparisons on the objects is modified.
- For any non-null reference value x,x.equals(null)should returnfalse.
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| Parameters | |
|---|---|
| obj | This value may be null. | 
| Return | |
|---|---|
| Boolean | trueif this object is the same as the obj argument;falseotherwise. | 
getDurationSincePreviousEvent
fun getDurationSincePreviousEvent(): Long
Returns the duration in ms between when this event was triggered and when the previous event in the selection session was triggered.
getDurationSinceSessionStart
fun getDurationSinceSessionStart(): Long
Returns the duration in ms between when this event was triggered and when the first event in the selection session was triggered.
getEnd
fun getEnd(): Int
Returns the end index of this events relative to the index of the start selection event in the selection session.
getEntityType
fun getEntityType(): String
Returns the type of entity that is associated with this event. e.g. android.view.textclassifier.TextClassifier#TYPE_EMAIL.
getEventIndex
fun getEventIndex(): Int
Returns the index (e.g. 1st event, 2nd event, etc.) of this event in the selection session.
getEventTime
fun getEventTime(): Long
Returns the time this event was triggered.
getEventType
fun getEventType(): Int
Returns the type of event that was triggered. e.g. ACTION_COPY.
getInvocationMethod
fun getInvocationMethod(): Int
Returns the way the selection mode was invoked.
getPackageName
fun getPackageName(): String
Returns the package name of the app that this event originated in.
| Return | |
|---|---|
| String | This value cannot be null. | 
getResultId
fun getResultId(): String?
Returns the id of the text classifier result associated with this event.
| Return | |
|---|---|
| String? | This value may be null. | 
getSessionId
fun getSessionId(): TextClassificationSessionId?
Returns the selection session id.
| Return | |
|---|---|
| TextClassificationSessionId? | This value may be null. | 
getSmartEnd
fun getSmartEnd(): Int
Returns the end index of this events relative to the index of the smart selection event in the selection session.
getSmartStart
fun getSmartStart(): Int
Returns the start index of this events relative to the index of the smart selection event in the selection session.
getStart
fun getStart(): Int
Returns the start index of this events relative to the index of the start selection event in the selection session.
getWidgetType
fun getWidgetType(): String
Returns the type of widget that was involved in triggering this event.
getWidgetVersion
fun getWidgetVersion(): String?
Returns a string version info for the widget this event was triggered in.
| Return | |
|---|---|
| String? | This value may be null. | 
isTerminal
static fun isTerminal(eventType: Int): Boolean
Returns true if the eventType is a terminal event type. Otherwise returns false. A terminal event is an event that ends a selection interaction.
toString
fun toString(): String
| Return | |
|---|---|
| String | a string representation of the object. | 
writeToParcel
fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
| Parameters | |
|---|---|
| dest | Parcel: The Parcel in which the object should be written. This value cannot be null. | 
| flags | Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either0or a combination ofandroid.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES | 
