ConfirmationActivity
class ConfirmationActivity : Activity
| kotlin.Any | |||||
| ↳ | android.content.Context | ||||
| ↳ | android.content.ContextWrapper | ||||
| ↳ | android.view.ContextThemeWrapper | ||||
| ↳ | android.app.Activity | ||||
| ↳ | androidx.wear.activity.ConfirmationActivity |
This Activity is used to display confirmation animations after the user completes an action on the wearable. There are three types of confirmations: Success: the action was completed successfully on the wearable. Failure: the action failed to complete. Open on Phone: the action has caused something to display on the phone, or in order to complete the action, the user will need to go to their phone to continue.
It is the responsibility of the wearable application developer to determine whether the action has succeeded, failed, or requires the user to go to their phone, and trigger the appropriate confirmation.
To configure the confirmation according to the result of the action, set the extra EXTRA_ANIMATION_TYPE to one of the following values:
- Displays a positive confirmation animation with an optional message.
- Displays an animation indicating an action has been sent to a paired device.
- Displays a generic failure page with an optional message.
An optional message, included in the extra EXTRA_MESSAGE will be displayed horizontally centered below the animation.
An optional duration in milliseconds to keep the confirmation activity visible for, included in the extra EXTRA_ANIMATION_DURATION_MILLIS
Summary
Constants |
|
|---|---|
const String! |
EXTRA_ANIMATION_DURATION_MILLIS = "androidx.wear.activity.extra.ANIMATION_DURATION_MILLIS"The lookup key for an optional int that defines the duration in milliseconds that the confirmation activity should be displayed. |
const String! |
EXTRA_ANIMATION_TYPE = "androidx.wear.activity.extra.ANIMATION_TYPE"The lookup key for an optional int that defines the animation type that should be displayed. |
const String! |
EXTRA_MESSAGE = "androidx.wear.activity.extra.MESSAGE"Used as a string extra field on an intent for this activity to define the message that should be displayed to the user while the activity is visible. |
const Int |
|
const Int |
|
const Int |
Public constructors |
|---|
Protected functions |
|
|---|---|
Unit |
Override this method if you wish to provide different than out-of-the-box behavior when the confirmation animation finishes. |
Inherited Constants |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Constants
EXTRA_ANIMATION_DURATION_MILLIS
const val EXTRA_ANIMATION_DURATION_MILLIS = "androidx.wear.activity.extra.ANIMATION_DURATION_MILLIS": String!
The lookup key for an optional int that defines the duration in milliseconds that the confirmation activity should be displayed. If no value is specified it will default to DEFAULT_ANIMATION_DURATION_MS
EXTRA_ANIMATION_TYPE
const val EXTRA_ANIMATION_TYPE = "androidx.wear.activity.extra.ANIMATION_TYPE": String!
The lookup key for an optional int that defines the animation type that should be displayed. Should be one of SUCCESS_ANIMATION, OPEN_ON_PHONE_ANIMATION, or FAILURE_ANIMATION
If no value is specified it will default to SUCCESS_ANIMATION
EXTRA_MESSAGE
const val EXTRA_MESSAGE = "androidx.wear.activity.extra.MESSAGE": String!
Used as a string extra field on an intent for this activity to define the message that should be displayed to the user while the activity is visible.
Public constructors
Protected functions
onAnimationFinished
protected fun onAnimationFinished(): Unit
Override this method if you wish to provide different than out-of-the-box behavior when the confirmation animation finishes. By default this method will finish the ConfirmationActivity.