TextClassifierEvent

public final class TextClassifierEvent
extends Object implements Parcelable

java.lang.Object
   ↳ android.view.textclassifier.TextClassifierEvent


A text classifier event.

Summary

Nested classes

class TextClassifierEvent.Builder

Builder to build a text classifier event. 

Constants

int CATEGORY_CONVERSATION_ACTIONS

Conversation actions

int CATEGORY_LANGUAGE_DETECTION

Language detection

int CATEGORY_LINKIFY

Linkify

int CATEGORY_SELECTION

Smart selection

int CATEGORY_UNDEFINED

Undefined category

int TYPE_ACTIONS_GENERATED

TextClassifier generated some actions

int TYPE_ACTIONS_SHOWN

Smart actions shown to the user.

int TYPE_AUTO_SELECTION

Something else other than user or the default TextClassifier triggered a selection.

int TYPE_COPY_ACTION

User clicked on Copy action.

int TYPE_CUT_ACTION

User clicked on Cut action.

int TYPE_LINK_CLICKED

User clicked a link.

int TYPE_MANUAL_REPLY

User composed a reply.

int TYPE_OTHER_ACTION

User clicked on a custom action.

int TYPE_OVERTYPE

User typed over the selection.

int TYPE_PASTE_ACTION

User clicked on Paste action.

int TYPE_SELECTION_DESTROYED

Selection is destroyed.

int TYPE_SELECTION_DRAG

User dragged+dropped the selection.

int TYPE_SELECTION_MODIFIED

User modified an existing selection.

int TYPE_SELECTION_RESET

User reset the smart selection.

int TYPE_SELECTION_STARTED

User started a new selection.

int TYPE_SELECT_ALL

User clicked on Select All action

int TYPE_SHARE_ACTION

User clicked on Share action.

int TYPE_SMART_ACTION

User clicked on a Smart action.

int TYPE_SMART_SELECTION_MULTI

Smart selection triggered spanning multiple tokens (words).

int TYPE_SMART_SELECTION_SINGLE

Smart selection triggered for a single token (word).

int TYPE_UNDEFINED

User started a new selection.

Inherited constants

Fields

public static final Creator<TextClassifierEvent> CREATOR

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

int[] getActionIndices()

Returns the indices of the actions relating to this event.

String[] getEntityTypes()

Returns an array of entity types.

int getEventCategory()

Returns the event category.

TextClassificationContext getEventContext()

Returns the event context.

int getEventIndex()

Returns the index of this event in the series of event it belongs to.

long getEventTime()

Returns the time this event occurred.

int getEventType()

Returns the event type.

Bundle getExtras()

Returns a bundle containing non-structured extra information about this event.

String getLanguage()

For language detection.

int getRelativeSuggestedWordEndIndex()

For smart selection.

int getRelativeSuggestedWordStartIndex()

For smart selection.

int getRelativeWordEndIndex()

For smart selection.

int getRelativeWordStartIndex()

For smart selection.

String getResultId()

Returns the id of the text classifier result related to this event.

float getScore()

Returns the score of the suggestion.

String toString()

Returns a string representation of the object.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

Constants

CATEGORY_CONVERSATION_ACTIONS

public static final int CATEGORY_CONVERSATION_ACTIONS

Conversation actions

Constant Value: 3 (0x00000003)

CATEGORY_LANGUAGE_DETECTION

public static final int CATEGORY_LANGUAGE_DETECTION

Language detection

Constant Value: 4 (0x00000004)

CATEGORY_LINKIFY

public static final int CATEGORY_LINKIFY

Linkify

Constant Value: 2 (0x00000002)

CATEGORY_SELECTION

public static final int CATEGORY_SELECTION

Smart selection

Constant Value: 1 (0x00000001)

CATEGORY_UNDEFINED

public static final int CATEGORY_UNDEFINED

Undefined category

Constant Value: 0 (0x00000000)

TYPE_ACTIONS_GENERATED

public static final int TYPE_ACTIONS_GENERATED

TextClassifier generated some actions

Constant Value: 20 (0x00000014)

TYPE_ACTIONS_SHOWN

public static final int TYPE_ACTIONS_SHOWN

Smart actions shown to the user.

Constant Value: 6 (0x00000006)

TYPE_AUTO_SELECTION

public static final int TYPE_AUTO_SELECTION

Something else other than user or the default TextClassifier triggered a selection.

Constant Value: 5 (0x00000005)

TYPE_COPY_ACTION

public static final int TYPE_COPY_ACTION

User clicked on Copy action.

Constant Value: 9 (0x00000009)

TYPE_CUT_ACTION

public static final int TYPE_CUT_ACTION

User clicked on Cut action.

Constant Value: 11 (0x0000000b)

public static final int TYPE_LINK_CLICKED

User clicked a link.

Constant Value: 7 (0x00000007)

TYPE_MANUAL_REPLY

public static final int TYPE_MANUAL_REPLY

User composed a reply.

Constant Value: 19 (0x00000013)

TYPE_OTHER_ACTION

public static final int TYPE_OTHER_ACTION

User clicked on a custom action.

Constant Value: 16 (0x00000010)

TYPE_OVERTYPE

public static final int TYPE_OVERTYPE

User typed over the selection.

Constant Value: 8 (0x00000008)

TYPE_PASTE_ACTION

public static final int TYPE_PASTE_ACTION

User clicked on Paste action.

Constant Value: 10 (0x0000000a)

TYPE_SELECTION_DESTROYED

public static final int TYPE_SELECTION_DESTROYED

Selection is destroyed.

Constant Value: 15 (0x0000000f)

TYPE_SELECTION_DRAG

public static final int TYPE_SELECTION_DRAG

User dragged+dropped the selection.

Constant Value: 14 (0x0000000e)

TYPE_SELECTION_MODIFIED

public static final int TYPE_SELECTION_MODIFIED

User modified an existing selection.

Constant Value: 2 (0x00000002)

TYPE_SELECTION_RESET

public static final int TYPE_SELECTION_RESET

User reset the smart selection.

Constant Value: 18 (0x00000012)

TYPE_SELECTION_STARTED

public static final int TYPE_SELECTION_STARTED

User started a new selection.

Constant Value: 1 (0x00000001)

TYPE_SELECT_ALL

public static final int TYPE_SELECT_ALL

User clicked on Select All action

Constant Value: 17 (0x00000011)

TYPE_SHARE_ACTION

public static final int TYPE_SHARE_ACTION

User clicked on Share action.

Constant Value: 12 (0x0000000c)

TYPE_SMART_ACTION

public static final int TYPE_SMART_ACTION

User clicked on a Smart action.

Constant Value: 13 (0x0000000d)

TYPE_SMART_SELECTION_MULTI

public static final int TYPE_SMART_SELECTION_MULTI

Smart selection triggered spanning multiple tokens (words).

Constant Value: 4 (0x00000004)

TYPE_SMART_SELECTION_SINGLE

public static final int TYPE_SMART_SELECTION_SINGLE

Smart selection triggered for a single token (word).

Constant Value: 3 (0x00000003)

TYPE_UNDEFINED

public static final int TYPE_UNDEFINED

User started a new selection.

Constant Value: 0 (0x00000000)

Fields

CREATOR

public static final Creator<TextClassifierEvent> CREATOR

Public methods

describeContents

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

getActionIndices

public int[] getActionIndices ()

Returns the indices of the actions relating to this event. Actions are usually returned by the text classifier in priority order with the most preferred action at index 0. This list gives an indication of the position of the actions that are being reported.

Returns
int[] This value will never be null.

getEntityTypes

public String[] getEntityTypes ()

Returns an array of entity types. e.g. TextClassifier#TYPE_ADDRESS.

Returns
String[] This value will never be null.

getEventCategory

public int getEventCategory ()

Returns the event category. e.g. CATEGORY_SELECTION.

Returns
int Value is CATEGORY_UNDEFINED, CATEGORY_SELECTION, CATEGORY_LINKIFY, CATEGORY_CONVERSATION_ACTIONS, or CATEGORY_LANGUAGE_DETECTION

getEventContext

public TextClassificationContext getEventContext ()

Returns the event context.

Returns
TextClassificationContext This value may be null.

getEventIndex

public int getEventIndex ()

Returns the index of this event in the series of event it belongs to.

Returns
int

getEventTime

public long getEventTime ()

Returns the time this event occurred. This is the number of milliseconds since January 1, 1970, 00:00:00 GMT. 0 indicates not set.

Returns
long

getExtras

public Bundle getExtras ()

Returns a bundle containing non-structured extra information about this event.

NOTE: Do not modify this bundle.

Returns
Bundle This value will never be null.

getLanguage

public String getLanguage ()

For language detection. Returns the language tag for the detected locale.

Returns
String This value may be null.

getRelativeSuggestedWordEndIndex

public int getRelativeSuggestedWordEndIndex ()

For smart selection. Returns the relative word (exclusive) index of the end of the smart selection.

Returns
int

getRelativeSuggestedWordStartIndex

public int getRelativeSuggestedWordStartIndex ()

For smart selection. Returns the relative word index of the start of the smart selection.

Returns
int

getRelativeWordEndIndex

public int getRelativeWordEndIndex ()

For smart selection. Returns the relative word (exclusive) index of the end of the selection.

Returns
int

getRelativeWordStartIndex

public int getRelativeWordStartIndex ()

For smart selection. Returns the relative word index of the start of the selection.

Returns
int

getResultId

public String getResultId ()

Returns the id of the text classifier result related to this event.

Returns
String This value may be null.

getScore

public float getScore ()

Returns the score of the suggestion.

Returns
float

toString

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.

writeToParcel

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