# Print output for @column tags ?>
public
final
class
SelectionEvent
extends Object
implements
Parcelable
java.lang.Object | |
↳ | android.view.textclassifier.SelectionEvent |
A selection event. Specify index parameters as word token indices.
Constants | |
---|---|
int |
ACTION_ABANDON
User abandoned the selection. |
int |
ACTION_COPY
User copied the selection. |
int |
ACTION_CUT
User cut the selection. |
int |
ACTION_DRAG
User dragged+dropped the selection. |
int |
ACTION_OTHER
User performed an action on the selection. |
int |
ACTION_OVERTYPE
User typed over the selection. |
int |
ACTION_PASTE
User pasted over the selection. |
int |
ACTION_RESET
User reset the smart selection. |
int |
ACTION_SELECT_ALL
User activated Select All |
int |
ACTION_SHARE
User shared the selection. |
int |
ACTION_SMART_SHARE
User clicked the textAssist menu item. |
int |
EVENT_AUTO_SELECTION
Something else other than User or the default TextClassifier triggered a selection. |
int |
EVENT_SELECTION_MODIFIED
User modified an existing selection. |
int |
EVENT_SELECTION_STARTED
User started a new selection. |
int |
EVENT_SMART_SELECTION_MULTI
Smart selection triggered spanning multiple tokens (words). |
int |
EVENT_SMART_SELECTION_SINGLE
Smart selection triggered for a single token (word). |
int |
INVOCATION_LINK
Selection was invoked by the user tapping on a link. |
int |
INVOCATION_MANUAL
Selection was invoked by the user long pressing, double tapping, or dragging to select. |
int |
INVOCATION_UNKNOWN
Unknown invocation method |
Inherited constants |
---|
Fields | |
---|---|
public
static
final
Creator<SelectionEvent> |
CREATOR
|
Public methods | |
---|---|
static
SelectionEvent
|
createSelectionActionEvent(int start, int end, int actionType)
Creates an event specifying an action taken on a selection. |
static
SelectionEvent
|
createSelectionActionEvent(int start, int end, int actionType, TextClassification classification)
Creates an event specifying an action taken on a selection. |
static
SelectionEvent
|
createSelectionModifiedEvent(int start, int end)
Creates a "selection modified" event. |
static
SelectionEvent
|
createSelectionModifiedEvent(int start, int end, TextClassification classification)
Creates a "selection modified" event. |
static
SelectionEvent
|
createSelectionModifiedEvent(int start, int end, TextSelection selection)
Creates a "selection modified" event. |
static
SelectionEvent
|
createSelectionStartedEvent(int invocationMethod, int start)
Creates a "selection started" event. |
int
|
describeContents()
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one. |
long
|
getDurationSincePreviousEvent()
Returns the duration in ms between when this event was triggered and when the previous event in the selection session was triggered. |
long
|
getDurationSinceSessionStart()
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
|
getEntityType()
Returns the type of entity that is associated with this event. |
int
|
getEventIndex()
Returns the index (e.g. 1st event, 2nd event, etc.) of this event in the selection session. |
long
|
getEventTime()
Returns the time this event was triggered. |
int
|
getEventType()
Returns the type of event that was triggered. |
int
|
getInvocationMethod()
Returns the way the selection mode was invoked. |
String
|
getPackageName()
Returns the package name of the app that this event originated in. |
String
|
getResultId()
Returns the id of the text classifier result associated with this event. |
TextClassificationSessionId
|
getSessionId()
Returns the selection session id. |
int
|
getSmartEnd()
Returns the end index of this events relative to the index of the smart selection event in the selection session. |
int
|
getSmartStart()
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
|
getWidgetType()
Returns the type of widget that was involved in triggering this event. |
String
|
getWidgetVersion()
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(int eventType)
Returns true if the eventType is a terminal event type. |
String
|
toString()
Returns a string representation of the object. |
void
|
writeToParcel(Parcel dest, int flags)
Flatten this object in to a Parcel. |
Inherited methods | |
---|---|
public static final int ACTION_ABANDON
User abandoned the selection.
Constant Value: 107 (0x0000006b)
public static final int ACTION_COPY
User copied the selection.
Constant Value: 101 (0x00000065)
public static final int ACTION_CUT
User cut the selection.
Constant Value: 103 (0x00000067)
public static final int ACTION_DRAG
User dragged+dropped the selection.
Constant Value: 106 (0x0000006a)
public static final int ACTION_OTHER
User performed an action on the selection.
Constant Value: 108 (0x0000006c)
public static final int ACTION_OVERTYPE
User typed over the selection.
Constant Value: 100 (0x00000064)
public static final int ACTION_PASTE
User pasted over the selection.
Constant Value: 102 (0x00000066)
public static final int ACTION_RESET
User reset the smart selection.
Constant Value: 201 (0x000000c9)
public static final int ACTION_SELECT_ALL
User activated Select All
Constant Value: 200 (0x000000c8)
public static final int ACTION_SHARE
User shared the selection.
Constant Value: 104 (0x00000068)
public static final int ACTION_SMART_SHARE
User clicked the textAssist menu item.
Constant Value: 105 (0x00000069)
public static final int EVENT_AUTO_SELECTION
Something else other than User or the default TextClassifier triggered a selection.
Constant Value: 5 (0x00000005)
public static final int EVENT_SELECTION_MODIFIED
User modified an existing selection.
Constant Value: 2 (0x00000002)
public static final int EVENT_SELECTION_STARTED
User started a new selection.
Constant Value: 1 (0x00000001)
public static final int EVENT_SMART_SELECTION_MULTI
Smart selection triggered spanning multiple tokens (words).
Constant Value: 4 (0x00000004)
public static final int EVENT_SMART_SELECTION_SINGLE
Smart selection triggered for a single token (word).
Constant Value: 3 (0x00000003)
public static final int INVOCATION_LINK
Selection was invoked by the user tapping on a link.
Constant Value: 2 (0x00000002)
public static final int INVOCATION_MANUAL
Selection was invoked by the user long pressing, double tapping, or dragging to select.
Constant Value: 1 (0x00000001)
public static final int INVOCATION_UNKNOWN
Unknown invocation method
Constant Value: 0 (0x00000000)
public static SelectionEvent createSelectionActionEvent (int start, int end, int actionType)
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 ACTION_OVERTYPE , ACTION_COPY , ACTION_PASTE , ACTION_CUT , ACTION_SHARE , ACTION_SMART_SHARE , ACTION_DRAG , ACTION_ABANDON , ACTION_OTHER , ACTION_SELECT_ALL , or ACTION_RESET |
Returns | |
---|---|
SelectionEvent |
This value cannot be null . |
Throws | |
---|---|
IllegalArgumentException |
if end is less than start |
public static SelectionEvent createSelectionActionEvent (int start, int end, int actionType, TextClassification classification)
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 ACTION_OVERTYPE , ACTION_COPY , ACTION_PASTE , ACTION_CUT , ACTION_SHARE , ACTION_SMART_SHARE , ACTION_DRAG , ACTION_ABANDON , ACTION_OTHER , ACTION_SELECT_ALL , or ACTION_RESET |
classification |
TextClassification : the TextClassification object returned by the TextClassifier that
classified the selected text
This value cannot be null . |
Returns | |
---|---|
SelectionEvent |
This value cannot be null . |
Throws | |
---|---|
IllegalArgumentException |
if end is less than start |
IllegalArgumentException |
If actionType is not a valid SelectionEvent actionType |
public static SelectionEvent createSelectionModifiedEvent (int start, int end)
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 |
Returns | |
---|---|
SelectionEvent |
This value cannot be null . |
Throws | |
---|---|
IllegalArgumentException |
if end is less than start |
public static SelectionEvent createSelectionModifiedEvent (int start, int end, TextClassification classification)
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 . |
Returns | |
---|---|
SelectionEvent |
This value cannot be null . |
Throws | |
---|---|
IllegalArgumentException |
if end is less than start |
public static SelectionEvent createSelectionModifiedEvent (int start, int end, TextSelection selection)
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 . |
Returns | |
---|---|
SelectionEvent |
This value cannot be null . |
Throws | |
---|---|
IllegalArgumentException |
if end is less than start |
public static SelectionEvent createSelectionStartedEvent (int invocationMethod, int start)
Creates a "selection started" event.
Parameters | |
---|---|
invocationMethod |
int : the way the selection was triggered
Value is INVOCATION_MANUAL , INVOCATION_LINK , or INVOCATION_UNKNOWN |
start |
int : the index of the selected text |
Returns | |
---|---|
SelectionEvent |
This value cannot be null . |
public int describeContents ()
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.
Returns | |
---|---|
int |
a bitmask indicating the set of special object types marshaled
by this Parcelable object instance.
Value is either 0 or CONTENTS_FILE_DESCRIPTOR |
public boolean equals (Object obj)
Indicates whether some other object is "equal to" this one.
The equals
method implements an equivalence relation
on non-null object references:
x
, x.equals(x)
should return
true
.
x
and y
, x.equals(y)
should return true
if and only if
y.equals(x)
returns true
.
x
, y
, and z
, if
x.equals(y)
returns true
and
y.equals(z)
returns true
, then
x.equals(z)
should return true
.
x
and y
, multiple invocations of
x.equals(y)
consistently return true
or consistently return false
, provided no
information used in equals
comparisons on the
objects is modified.
x
,
x.equals(null)
should return false
.
The equals
method for class Object
implements
the most discriminating possible equivalence relation on objects;
that is, for any non-null reference values x
and
y
, this method returns true
if and only
if x
and y
refer to the same object
(x == y
has the value true
).
Note that it is generally necessary to override the hashCode
method whenever this method is overridden, so as to maintain the
general contract for the hashCode
method, which states
that equal objects must have equal hash codes.
Parameters | |
---|---|
obj |
Object : This value may be null . |
Returns | |
---|---|
boolean |
true if this object is the same as the obj
argument; false otherwise. |
public long getDurationSincePreviousEvent ()
Returns the duration in ms between when this event was triggered and when the previous event in the selection session was triggered.
Returns | |
---|---|
long |
public long getDurationSinceSessionStart ()
Returns the duration in ms between when this event was triggered and when the first event in the selection session was triggered.
Returns | |
---|---|
long |
public int getEnd ()
Returns the end index of this events relative to the index of the start selection event in the selection session.
Returns | |
---|---|
int |
public String getEntityType ()
Returns the type of entity that is associated with this event. e.g.
TextClassifier.TYPE_EMAIL
.
Returns | |
---|---|
String |
Value is TextClassifier.TYPE_UNKNOWN , TextClassifier.TYPE_OTHER , TextClassifier.TYPE_EMAIL , TextClassifier.TYPE_PHONE , TextClassifier.TYPE_ADDRESS , TextClassifier.TYPE_URL , TextClassifier.TYPE_DATE , TextClassifier.TYPE_DATE_TIME , TextClassifier.TYPE_FLIGHT_NUMBER , or android.view.textclassifier.TextClassifier.TYPE_DICTIONARY
This value cannot be null . |
public int getEventIndex ()
Returns the index (e.g. 1st event, 2nd event, etc.) of this event in the selection session.
Returns | |
---|---|
int |
public long getEventTime ()
Returns the time this event was triggered.
Returns | |
---|---|
long |
public int getEventType ()
Returns the type of event that was triggered. e.g. ACTION_COPY
.
public int getInvocationMethod ()
Returns the way the selection mode was invoked.
Returns | |
---|---|
int |
Value is INVOCATION_MANUAL , INVOCATION_LINK , or INVOCATION_UNKNOWN |
public String getPackageName ()
Returns the package name of the app that this event originated in.
Returns | |
---|---|
String |
This value cannot be null . |
public String getResultId ()
Returns the id of the text classifier result associated with this event.
Returns | |
---|---|
String |
This value may be null . |
public TextClassificationSessionId getSessionId ()
Returns the selection session id.
Returns | |
---|---|
TextClassificationSessionId |
This value may be null . |
public int getSmartEnd ()
Returns the end index of this events relative to the index of the smart selection event in the selection session.
Returns | |
---|---|
int |
public int getSmartStart ()
Returns the start index of this events relative to the index of the smart selection event in the selection session.
Returns | |
---|---|
int |
public int getStart ()
Returns the start index of this events relative to the index of the start selection event in the selection session.
Returns | |
---|---|
int |
public String getWidgetType ()
Returns the type of widget that was involved in triggering this event.
public String getWidgetVersion ()
Returns a string version info for the widget this event was triggered in.
Returns | |
---|---|
String |
This value may be null . |
public int hashCode ()
Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
HashMap
.
The general contract of hashCode
is:
hashCode
method
must consistently return the same integer, provided no information
used in equals
comparisons on the object is modified.
This integer need not remain consistent from one execution of an
application to another execution of the same application.
equals(Object)
method, then calling the hashCode
method on each of
the two objects must produce the same integer result.
equals(java.lang.Object)
method, then calling the hashCode
method 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.
As much as is reasonably practical, the hashCode method defined by
class Object
does return distinct integers for distinct
objects. (This is typically implemented by converting the internal
address of the object into an integer, but this implementation
technique is not required by the
Java™ programming language.)
Returns | |
---|---|
int |
a hash code value for this object. |
public static boolean isTerminal (int eventType)
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 ACTION_OVERTYPE , ACTION_COPY , ACTION_PASTE , ACTION_CUT , ACTION_SHARE , ACTION_SMART_SHARE , ACTION_DRAG , ACTION_ABANDON , ACTION_OTHER , ACTION_SELECT_ALL , ACTION_RESET , EVENT_SELECTION_STARTED , EVENT_SELECTION_MODIFIED , EVENT_SMART_SELECTION_SINGLE , EVENT_SMART_SELECTION_MULTI , or EVENT_AUTO_SELECTION |
Returns | |
---|---|
boolean |
public String toString ()
Returns a string representation of the object. In general, the
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
Returns | |
---|---|
String |
a string representation of the object. |
public void writeToParcel (Parcel dest, int flags)
Flatten this object in to a Parcel.
Parameters | |
---|---|
dest |
Parcel : The Parcel in which the object should be written. |
flags |
int : Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE .
Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |