RemoteInputIntentHelper.Companion
object RemoteInputIntentHelper.Companion
Summary
Public methods |
|
---|---|
final @NonNull Intent |
Create an intent with action for remote input. |
final @Nullable CharSequence |
getCancelLabelExtra(Intent intent) Returns the |
final @Nullable CharSequence |
getConfirmLabelExtra(Intent intent) Returns the |
final @Nullable CharSequence |
getInProgressLabelExtra(Intent intent) Returns the |
final @Nullable List<@NonNull RemoteInput> |
getRemoteInputsExtra(Intent intent) Returns the array of |
final @Nullable List<@NonNull CharSequence> |
getSmartReplyContextExtra(Intent intent) Returns the array of |
final @Nullable CharSequence |
getTitleExtra(Intent intent) Returns the |
final boolean |
hasRemoteInputsExtra(Intent intent) Checks whether the given |
final boolean |
isActionRemoteInput(Intent intent) Checks whether the action of the given intent is for remote input. |
final @NonNull Intent |
putCancelLabelExtra(Intent intent, CharSequence label) Adds the |
final @NonNull Intent |
putConfirmLabelExtra(Intent intent, CharSequence label) Adds the |
final @NonNull Intent |
putInProgressLabelExtra(Intent intent, CharSequence label) Adds the |
final @NonNull Intent |
putRemoteInputsExtra(Intent intent, List<RemoteInput> remoteInputs) Adds the array of |
final @NonNull Intent |
putSmartReplyContextExtra( Adds the array of |
final @NonNull Intent |
putTitleExtra(Intent intent, CharSequence title) Adds the |
Public methods
createActionRemoteInputIntent
public final @NonNull Intent createActionRemoteInputIntent()
Create an intent with action for remote input. This intent can be used to start an activity that will prompt the user for input. With the other helpers in this class to specify the intent extras, we can configure the behaviour of the input activity, such as specifying input be collected from a user by populating with an array of RemoteInput
with putRemoteInputsExtra
.
getCancelLabelExtra
public final @Nullable CharSequence getCancelLabelExtra(Intent intent)
Returns the CharSequence
from the given Intent
that specifies what is displayed to cancel the action.
Parameters | |
---|---|
Intent intent |
The intent with given data. |
Returns | |
---|---|
@Nullable CharSequence |
The CharSequence previously added with |
getConfirmLabelExtra
public final @Nullable CharSequence getConfirmLabelExtra(Intent intent)
Returns the CharSequence
from the given Intent
that specifies what is displayed to confirm that the action should be executed.
Parameters | |
---|---|
Intent intent |
The intent with given data. |
Returns | |
---|---|
@Nullable CharSequence |
The CharSequence previously added with |
getInProgressLabelExtra
public final @Nullable CharSequence getInProgressLabelExtra(Intent intent)
Returns the CharSequence
from the given Intent
that specifies what is displayed while the wearable is preparing to automatically execute the action.
Parameters | |
---|---|
Intent intent |
The intent with given data. |
Returns | |
---|---|
@Nullable CharSequence |
The CharSequence previously added with |
getRemoteInputsExtra
public final @Nullable List<@NonNull RemoteInput> getRemoteInputsExtra(Intent intent)
Returns the array of RemoteInput
from the given Intent
that specifies inputs to be collected from a user. Should be used with Intent
created with
.createActionRemoteInputIntent.
Parameters | |
---|---|
Intent intent |
The intent with given data. |
Returns | |
---|---|
@Nullable List<@NonNull RemoteInput> |
The array of |
getSmartReplyContextExtra
public final @Nullable List<@NonNull CharSequence> getSmartReplyContextExtra(Intent intent)
Returns the array of CharSequence
from the given Intent
that provides context for creating Smart Reply choices within a RemoteInput session.
Parameters | |
---|---|
Intent intent |
The intent with given data. |
Returns | |
---|---|
@Nullable List<@NonNull CharSequence> |
The array of |
getTitleExtra
public final @Nullable CharSequence getTitleExtra(Intent intent)
Returns the CharSequence
from the given Intent
that specifies what is displayed on top of the confirmation screen to describe the action.
Parameters | |
---|---|
Intent intent |
The intent with given data. |
Returns | |
---|---|
@Nullable CharSequence |
The CharSequence previously added with |
hasRemoteInputsExtra
public final boolean hasRemoteInputsExtra(Intent intent)
Checks whether the given Intent
has extra for the array of RemoteInput
.
isActionRemoteInput
public final boolean isActionRemoteInput(Intent intent)
Checks whether the action of the given intent is for remote input.
putCancelLabelExtra
public final @NonNull Intent putCancelLabelExtra(Intent intent, CharSequence label)
Adds the CharSequence
to the given Intent
that specifies what is displayed to cancel the action. This is usually an imperative verb, like "Cancel". Defaults to Cancel.
Parameters | |
---|---|
Intent intent |
The intent with given data. |
CharSequence label |
The CharSequence to be added. |
putConfirmLabelExtra
public final @NonNull Intent putConfirmLabelExtra(Intent intent, CharSequence label)
Adds the CharSequence
to the given Intent
that specifies what is displayed to confirm that the action should be executed. This is usually an imperative verb like "Send". Defaults to "Send".
Parameters | |
---|---|
Intent intent |
The intent with given data. |
CharSequence label |
The CharSequence to be added. |
putInProgressLabelExtra
public final @NonNull Intent putInProgressLabelExtra(Intent intent, CharSequence label)
Adds the CharSequence
to the given Intent
that specifies what is displayed while the wearable is preparing to automatically execute the action. This is usually a 'ing' verb ending in ellipsis like "Sending...". Defaults to "Sending...".
Parameters | |
---|---|
Intent intent |
The intent with given data. |
CharSequence label |
The CharSequence to be added. |
putRemoteInputsExtra
public final @NonNull Intent putRemoteInputsExtra(Intent intent, List<RemoteInput> remoteInputs)
Adds the array of RemoteInput
to the given Intent
that specifies inputs collected from a user. Should be used with Intent
created with createActionRemoteInputIntent
.
Parameters | |
---|---|
Intent intent |
The intent with given data. |
List<RemoteInput> remoteInputs |
The array of |
putSmartReplyContextExtra
public final @NonNull Intent putSmartReplyContextExtra(
Intent intent,
List<CharSequence> smartReplyContext
)
Adds the array of CharSequence
to the given Intent
that provides context for creating Smart Reply choices within a RemoteInput session. The context should be incoming chat messages that a user will reply to using RemoteInput. Only incoming messages (messages from other users) should be passed via this extra.
The messages should be in the order that they were received with the newest messages at the highest index of the CharSequence[]. For example, a possible value for this extra would be: "hey", "where are you?". In this case, "where are you?" was the most recently received message.
Passing a chat context into RemoteInput using this method does not guarantee that Smart Reply choices will be shown to a user.
Parameters | |
---|---|
Intent intent |
The intent with given data. |
List<CharSequence> smartReplyContext |
The string to be added. |
putTitleExtra
public final @NonNull Intent putTitleExtra(Intent intent, CharSequence title)
Adds the CharSequence
to the given Intent
that specifies what is displayed on top of the confirmation screen to describe the action like "SMS" or "Email".
Parameters | |
---|---|
Intent intent |
The intent with given data. |
CharSequence title |
The CharSequence to be added. |