Added in API level 29

TextLinkifyEvent


class TextLinkifyEvent : TextClassifierEvent, Parcelable

This class represents events that are related to the smart linkify feature.

// User clicked on a link.
      new TextLinkifyEvent.Builder(TYPE_LINK_CLICKED)
          .setEventContext(classificationContext)
          .setResultId(textClassification.getId())
          .setEntityTypes(textClassification.getEntity(0))
          .setScore(textClassification.getConfidenceScore(entityType))
          .setEventIndex(0)
          .build();
 
      // Smart (contextual) actions presented to the user in response to a link click.
      new TextLinkifyEvent.Builder(TYPE_ACTIONS_SHOWN)
          .setEventContext(classificationContext)
          .setResultId(textClassification.getId())
          .setEntityTypes(textClassification.getEntity(0))
          .setScore(textClassification.getConfidenceScore(entityType))
          .setActionIndices(range(textClassification.getActions().size()))
          .setEventIndex(1)
          .build();
 
      // User chooses smart action at index 0.
      new TextLinkifyEvent.Builder(TYPE_SMART_ACTION)
          .setEventContext(classificationContext)
          .setResultId(textClassification.getId())
          .setEntityTypes(textClassification.getEntity(0))
          .setScore(textClassification.getConfidenceScore(entityType))
          .setActionIndices(0)
          .setEventIndex(2)
          .build();
  

Summary

Nested classes

Builder class for TextLinkifyEvent.

Inherited constants
Int CATEGORY_CONVERSATION_ACTIONS

Conversation actions

Int CATEGORY_LANGUAGE_DETECTION

Language detection

Int CATEGORY_LINKIFY

Linkify

Int CATEGORY_SELECTION

Smart selection

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_LINKS_GENERATED

Some text links were generated.

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 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.

Inherited functions
Int describeContents()

IntArray 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.

Array<String!> getEntityTypes()

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

Int getEventCategory()

Returns the event category. e.g. CATEGORY_SELECTION.

TextClassificationContext? getEventContext()

Returns the event context.

Int getEventIndex()

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

Int getEventType()

Returns the event type. e.g. TYPE_SELECTION_STARTED.

Bundle getExtras()

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

NOTE: Do not modify this bundle.

ULocale? getLocale()

Returns the detected locale.

String? getModelName()

Returns the model name.

String? getResultId()

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

FloatArray getScores()

Returns the scores of the suggestions.

String toString()

Unit writeToParcel(dest: Parcel, flags: Int)

Properties