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 |
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| 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()Returns a hash code value for the object. |
| static Boolean |
isTerminal(eventType: Int)Returns true if the eventType is a terminal event type. |
| String |
toString()Returns a string representation of the object. |
| Unit |
writeToParcel(dest: Parcel, flags: Int)Flatten this object in to a Parcel. |
| 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 one of the following: |
| 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 one of the following: |
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 one of the following: |
start |
Int: the index of the selected text |
| Return | |
|---|---|
SelectionEvent |
This value cannot be null. |
describeContents
fun describeContents(): Int
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel,int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.
| Return | |
|---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or
|
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 |
true if this object is the same as the obj argument; false otherwise. |
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.
| Return | |
|---|---|
Int |
Value is one of the following: |
getInvocationMethod
fun getInvocationMethod(): Int
Returns the way the selection mode was invoked.
| Return | |
|---|---|
Int |
Value is one of the following: |
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. |
hashCode
fun hashCode(): Int
Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.
The general contract of hashCode is:
- Whenever it is invoked on the same object more than once during an execution of a Java application, the
hashCodemethod must consistently return the same integer, provided no information used inequalscomparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application. - If two objects are equal according to the
equalsmethod, then calling thehashCodemethod on each of the two objects must produce the same integer result. - It is not required that if two objects are unequal according to the
equalsmethod, then calling thehashCodemethod on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
| Return | |
|---|---|
Int |
a hash code value for this object. |
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.
| Parameters | |
|---|---|
eventType |
Int: Value is one of the following: |
toString
fun toString(): String
Returns a string representation of the object.
| Return | |
|---|---|
String |
a string representation of the object. |
writeToParcel
fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
Flatten this object in to a Parcel.
| 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 either 0 or a combination of the following:
|