TextClassifierEvent.TextSelectionEvent Class

Definition

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

[Android.Runtime.Register("android/view/textclassifier/TextClassifierEvent$TextSelectionEvent", ApiSince=29, DoNotGenerateAcw=true)]
public sealed class TextClassifierEvent.TextSelectionEvent : Android.Views.TextClassifiers.TextClassifierEvent, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("android/view/textclassifier/TextClassifierEvent$TextSelectionEvent", ApiSince=29, DoNotGenerateAcw=true)>]
type TextClassifierEvent.TextSelectionEvent = class
    inherit TextClassifierEvent
    interface IParcelable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
TextClassifierEvent.TextSelectionEvent
Attributes
Implements

Remarks

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

// User started a selection. e.g. "York" in text "New York City, NY".
                new TextSelectionEvent.Builder(TYPE_SELECTION_STARTED)
                    .setEventContext(classificationContext)
                    .setEventIndex(0)
                    .build();

                // System smart-selects a recognized entity. e.g. "New York City".
                new TextSelectionEvent.Builder(TYPE_SMART_SELECTION_MULTI)
                    .setEventContext(classificationContext)
                    .setResultId(textSelection.getId())
                    .setRelativeWordStartIndex(-1) // Goes back one word to "New" from "York".
                    .setRelativeWordEndIndex(2)    // Goes forward 2 words from "York" to start of ",".
                    .setEntityTypes(textClassification.getEntity(0))
                    .setScore(textClassification.getConfidenceScore(entityType))
                    .setEventIndex(1)
                    .build();

                // User resets the selection to the original selection. i.e. "York".
                new TextSelectionEvent.Builder(TYPE_SELECTION_RESET)
                    .setEventContext(classificationContext)
                    .setResultId(textSelection.getId())
                    .setRelativeSuggestedWordStartIndex(-1) // Repeated from above.
                    .setRelativeSuggestedWordEndIndex(2)    // Repeated from above.
                    .setRelativeWordStartIndex(0)           // Original selection is always at (0, 1].
                    .setRelativeWordEndIndex(1)
                    .setEntityTypes(textClassification.getEntity(0))
                    .setScore(textClassification.getConfidenceScore(entityType))
                    .setEventIndex(2)
                    .build();

                // User modified the selection. e.g. "New".
                new TextSelectionEvent.Builder(TYPE_SELECTION_MODIFIED)
                    .setEventContext(classificationContext)
                    .setResultId(textSelection.getId())
                    .setRelativeSuggestedWordStartIndex(-1) // Repeated from above.
                    .setRelativeSuggestedWordEndIndex(2)    // Repeated from above.
                    .setRelativeWordStartIndex(-1)          // Goes backward one word from "York" to
                    "New".
                    .setRelativeWordEndIndex(0)             // Goes backward one word to exclude "York".
                    .setEntityTypes(textClassification.getEntity(0))
                    .setScore(textClassification.getConfidenceScore(entityType))
                    .setEventIndex(3)
                    .build();

                // Smart (contextual) actions (at indices, 0, 1, 2) presented to the user.
                // e.g. "Map", "Ride share", "Explore".
                new TextSelectionEvent.Builder(TYPE_ACTIONS_SHOWN)
                    .setEventContext(classificationContext)
                    .setResultId(textClassification.getId())
                    .setEntityTypes(textClassification.getEntity(0))
                    .setScore(textClassification.getConfidenceScore(entityType))
                    .setActionIndices(0, 1, 2)
                    .setEventIndex(4)
                    .build();

                // User chooses the "Copy" action.
                new TextSelectionEvent.Builder(TYPE_COPY_ACTION)
                    .setEventContext(classificationContext)
                    .setResultId(textClassification.getId())
                    .setEntityTypes(textClassification.getEntity(0))
                    .setScore(textClassification.getConfidenceScore(entityType))
                    .setEventIndex(5)
                    .build();

                // User chooses smart action at index 1. i.e. "Ride share".
                new TextSelectionEvent.Builder(TYPE_SMART_ACTION)
                    .setEventContext(classificationContext)
                    .setResultId(textClassification.getId())
                    .setEntityTypes(textClassification.getEntity(0))
                    .setScore(textClassification.getConfidenceScore(entityType))
                    .setActionIndices(1)
                    .setEventIndex(5)
                    .build();

                // Selection dismissed.
                new TextSelectionEvent.Builder(TYPE_SELECTION_DESTROYED)
                    .setEventContext(classificationContext)
                    .setResultId(textClassification.getId())
                    .setEntityTypes(textClassification.getEntity(0))
                    .setScore(textClassification.getConfidenceScore(entityType))
                    .setEventIndex(6)
                    .build();

Java documentation for android.view.textclassifier.TextClassifierEvent.TextSelectionEvent.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Fields

CategoryConversationActions
Obsolete.

Conversation actions

(Inherited from TextClassifierEvent)
CategoryLanguageDetection
Obsolete.

Language detection

(Inherited from TextClassifierEvent)
CategoryLinkify
Obsolete.

Linkify

(Inherited from TextClassifierEvent)
CategorySelection
Obsolete.

Smart selection

(Inherited from TextClassifierEvent)
TypeActionsGenerated
Obsolete.

TextClassifier generated some actions

(Inherited from TextClassifierEvent)
TypeActionsShown
Obsolete.

Smart actions shown to the user.

(Inherited from TextClassifierEvent)
TypeAutoSelection
Obsolete.

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

(Inherited from TextClassifierEvent)
TypeCopyAction
Obsolete.

User clicked on Copy action.

(Inherited from TextClassifierEvent)
TypeCutAction
Obsolete.

User clicked on Cut action.

(Inherited from TextClassifierEvent)
TypeLinkClicked
Obsolete.

User clicked a link.

(Inherited from TextClassifierEvent)
TypeLinksGenerated
Obsolete.

Some text links were generated.

(Inherited from TextClassifierEvent)
TypeManualReply
Obsolete.

User composed a reply.

(Inherited from TextClassifierEvent)
TypeOtherAction
Obsolete.

User clicked on a custom action.

(Inherited from TextClassifierEvent)
TypeOvertype
Obsolete.

User typed over the selection.

(Inherited from TextClassifierEvent)
TypePasteAction
Obsolete.

User clicked on Paste action.

(Inherited from TextClassifierEvent)
TypeSelectAll
Obsolete.

User clicked on Select All action

(Inherited from TextClassifierEvent)
TypeSelectionDestroyed
Obsolete.

Selection is destroyed.

(Inherited from TextClassifierEvent)
TypeSelectionDrag
Obsolete.

User dragged+dropped the selection.

(Inherited from TextClassifierEvent)
TypeSelectionModified
Obsolete.

User modified an existing selection.

(Inherited from TextClassifierEvent)
TypeSelectionReset
Obsolete.

User reset the smart selection.

(Inherited from TextClassifierEvent)
TypeSelectionStarted
Obsolete.

User started a new selection.

(Inherited from TextClassifierEvent)
TypeShareAction
Obsolete.

User clicked on Share action.

(Inherited from TextClassifierEvent)
TypeSmartAction
Obsolete.

User clicked on a Smart action.

(Inherited from TextClassifierEvent)
TypeSmartSelectionMulti
Obsolete.

Smart selection triggered spanning multiple tokens (words).

(Inherited from TextClassifierEvent)
TypeSmartSelectionSingle
Obsolete.

Smart selection triggered for a single token (word).

(Inherited from TextClassifierEvent)

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Creator
EventCategory

Returns the event category.

(Inherited from TextClassifierEvent)
EventContext

Returns the event context.

(Inherited from TextClassifierEvent)
EventIndex

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

(Inherited from TextClassifierEvent)
EventType

Returns the event type.

(Inherited from TextClassifierEvent)
Extras

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

(Inherited from TextClassifierEvent)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
Locale

Returns the detected locale.

(Inherited from TextClassifierEvent)
ModelName

Returns the model name.

(Inherited from TextClassifierEvent)
PeerReference (Inherited from Object)
RelativeSuggestedWordEndIndex

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

RelativeSuggestedWordStartIndex

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

RelativeWordEndIndex

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

RelativeWordStartIndex

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

ResultId

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

(Inherited from TextClassifierEvent)
ThresholdClass (Inherited from TextClassifierEvent)
ThresholdType (Inherited from TextClassifierEvent)

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
DescribeContents() (Inherited from TextClassifierEvent)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetActionIndices()

Returns the indices of the actions relating to this event.

(Inherited from TextClassifierEvent)
GetEntityTypes()

Returns an array of entity types.

(Inherited from TextClassifierEvent)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetScores()

Returns the scores of the suggestions.

(Inherited from TextClassifierEvent)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
WriteToParcel(Parcel, ParcelableWriteFlags) (Inherited from TextClassifierEvent)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to