ConversationAction
class ConversationAction
kotlin.Any | |
↳ | androidx.textclassifier.ConversationAction |
Represents an action suggested by a TextClassifier
on a given conversation.
Summary
Nested classes | |
---|---|
Builder class to construct |
Constants | |
---|---|
static String |
Indicates an action to add a contact. |
static String |
Indicates an action to call a phone number. |
static String |
Indicates an action to copy a code. |
static String |
Indicates an action to create a reminder. |
static String |
Indicates an action to open an URL. |
static String |
Indicates an action to send an email. |
static String |
Indicates an action to send a SMS. |
static String |
Indicates an action to reply with a location. |
static String |
Indicates an action to reply with a text message. |
static String |
Indicates an action to track a flight. |
static String |
Indicates an action to view a calendar at a specified time. |
static String |
Indicates an action to view the map at a specified location. |
Public methods | |
---|---|
static ConversationAction |
createFromBundle(@NonNull bundle: Bundle) Converts a bundle that was created using |
RemoteActionCompat? |
Returns a RemoteActionCompat object, which contains the icon, label and a PendingIntent, for the specified action type. |
Float |
Returns the confidence score for the specified action. |
Bundle |
Returns the extended data related to this conversation action. |
CharSequence? |
Returns the text reply that could be sent as a reply to the given conversation. |
String |
getType() Returns the type of this action, for example, |
Bundle |
toBundle() Adds this object to a Bundle that can be read back with the same parameters to |
Constants
TYPE_ADD_CONTACT
static val TYPE_ADD_CONTACT: String
Indicates an action to add a contact.
Value: "add_contact"
TYPE_CALL_PHONE
static val TYPE_CALL_PHONE: String
Indicates an action to call a phone number.
Value: android.view.textclassifier.ConversationAction.TYPE_CALL_PHONE
TYPE_CREATE_REMINDER
static val TYPE_CREATE_REMINDER: String
Indicates an action to create a reminder.
Value: android.view.textclassifier.ConversationAction.TYPE_CREATE_REMINDER
TYPE_OPEN_URL
static val TYPE_OPEN_URL: String
Indicates an action to open an URL.
Value: android.view.textclassifier.ConversationAction.TYPE_OPEN_URL
TYPE_SEND_EMAIL
static val TYPE_SEND_EMAIL: String
Indicates an action to send an email.
Value: android.view.textclassifier.ConversationAction.TYPE_SEND_EMAIL
TYPE_SEND_SMS
static val TYPE_SEND_SMS: String
Indicates an action to send a SMS.
Value: android.view.textclassifier.ConversationAction.TYPE_SEND_SMS
TYPE_SHARE_LOCATION
static val TYPE_SHARE_LOCATION: String
Indicates an action to reply with a location.
Value: android.view.textclassifier.ConversationAction.TYPE_SHARE_LOCATION
TYPE_TEXT_REPLY
static val TYPE_TEXT_REPLY: String
Indicates an action to reply with a text message.
Value: android.view.textclassifier.ConversationAction.TYPE_TEXT_REPLY
TYPE_TRACK_FLIGHT
static val TYPE_TRACK_FLIGHT: String
Indicates an action to track a flight.
Value: android.view.textclassifier.ConversationAction.TYPE_TRACK_FLIGHT
TYPE_VIEW_CALENDAR
static val TYPE_VIEW_CALENDAR: String
Indicates an action to view a calendar at a specified time.
Value: android.view.textclassifier.ConversationAction.TYPE_VIEW_CALENDAR
TYPE_VIEW_MAP
static val TYPE_VIEW_MAP: String
Indicates an action to view the map at a specified location.
Value: android.view.textclassifier.ConversationAction.TYPE_VIEW_MAP
Public methods
createFromBundle
@NonNull static fun createFromBundle(@NonNull bundle: Bundle): ConversationAction
Converts a bundle that was created using toBundle()
to a ConversationAction
.
getAction
@Nullable fun getAction(): RemoteActionCompat?
Returns a RemoteActionCompat object, which contains the icon, label and a PendingIntent, for the specified action type.
getConfidenceScore
@FloatRange(0, 1) fun getConfidenceScore(): Float
Returns the confidence score for the specified action. The value ranges from 0 (low confidence) to 1 (high confidence).
getExtras
@NonNull fun getExtras(): Bundle
Returns the extended data related to this conversation action.
NOTE: Each call to this method returns a new bundle copy so clients should prefer to hold a reference to the returned bundle rather than frequently calling this method.
getTextReply
@Nullable fun getTextReply()