RemoteInputIntentHelper.Companion

object RemoteInputIntentHelper.Companion


Summary

Public methods

final @NonNull Intent

Create an intent with action for remote input.

final @Nullable CharSequence

Returns the CharSequence from the given Intent that specifies what is displayed to cancel the action.

final @Nullable CharSequence

Returns the CharSequence from the given Intent that specifies what is displayed to confirm that the action should be executed.

final @Nullable CharSequence

Returns the CharSequence from the given Intent that specifies what is displayed while the wearable is preparing to automatically execute the action.

final @Nullable List<@NonNull RemoteInput>

Returns the array of RemoteInput from the given Intent that specifies inputs to be collected from a user.

final @Nullable List<@NonNull CharSequence>

Returns the array of CharSequence from the given Intent that provides context for creating Smart Reply choices within a RemoteInput session.

final @Nullable CharSequence

Returns the CharSequence from the given Intent that specifies what is displayed on top of the confirmation screen to describe the action.

final boolean

Checks whether the given Intent has extra for the array of RemoteInput.

final boolean

Checks whether the action of the given intent is for remote input.

final @NonNull Intent

Adds the CharSequence to the given Intent that specifies what is displayed to cancel the action.

final @NonNull Intent

Adds the CharSequence to the given Intent that specifies what is displayed to confirm that the action should be executed.

final @NonNull Intent

Adds the CharSequence to the given Intent that specifies what is displayed while the wearable is preparing to automatically execute the action.

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.

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.

final @NonNull Intent

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

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.

Returns
@NonNull Intent

The created intent with action for remote input.

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 putCancelLabelExtra or null if no value is found.

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 putConfirmLabelExtra or null if no value is found.

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 putInProgressLabelExtra or null if no value is found.

getRemoteInputsExtra

public final @Nullable List<@NonNull RemoteInputgetRemoteInputsExtra(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 RemoteInput previously added with putRemoteInputsExtra or null which means no user input required.

getSmartReplyContextExtra

public final @Nullable List<@NonNull CharSequencegetSmartReplyContextExtra(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 CharSequence previously added with putSmartReplyContextExtra or putSmartReplyContextExtra or null if no value is found.

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 putTitleExtra or null if no value is found.

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.

Returns
@NonNull Intent

The given intent.

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.

Returns
@NonNull Intent

The given intent.

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.

Returns
@NonNull Intent

The given intent.

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 RemoteInput to be added.

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.

Returns
@NonNull Intent

The given intent.

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.

Returns
@NonNull Intent

The given intent.