androidx.glance.action
Interfaces
Action |
An Action defines the actions a user can take. |
Classes
ActionParameters |
Action parameters, used to pass information to an |
ActionParameters.Key |
Key for |
ActionParameters.Pair |
Key Value pairs for Parameters. |
MutableActionParameters |
Mutable version of |
Composables
Constants summary
const @DrawableRes Int |
NoRippleOverride = 0Constant. |
Top-level functions summary
ActionParameters |
actionParametersOf(vararg pairs: ActionParameters.Pair<Any>)Returns a new read-only Parameters, from the specified contents. |
inline Action |
<T : Activity> actionStartActivity(parameters: ActionParameters)Creates an |
Action |
<T : Activity> actionStartActivity(Creates an |
Action |
actionStartActivity(Creates an |
inline Action |
@ExperimentalGlanceApiCreates an |
Action |
@ExperimentalGlanceApiCreates an |
Action |
@ExperimentalGlanceApiCreates an |
MutableActionParameters |
mutableActionParametersOf(vararg pairs: ActionParameters.Pair<Any>)Returns a new MutableParameters, from the specified contents. |
Extension functions summary
GlanceModifier |
GlanceModifier.clickable(onClick: Action)Apply an |
GlanceModifier |
GlanceModifier.clickable(Apply an |
MutableActionParameters |
Gets a mutable copy of Parameters, containing all key value pairs. |
ActionParameters |
Gets a read-only copy of Parameters, containing all key value pairs. |
ActionParameters.Key<T> |
<T : Any> Preferences.Key<T>.toParametersKey()Creates an action key from a preferences key. |
Constants
NoRippleOverride
const val NoRippleOverride = 0: @DrawableRes Int
Constant. Tells the system that there is no ripple override. When this is passed, the system will use default behavior for the ripple.
Top-level functions
actionParametersOf
fun actionParametersOf(vararg pairs: ActionParameters.Pair<Any>): ActionParameters
Returns a new read-only Parameters, from the specified contents. The key element in the given pairs will point to the corresponding value element. All values must be either of primitive or Parcelable types.
If multiple pairs have the same key, the resulting map will contain only the value from the last of those pairs.
actionStartActivity
inline fun <T : Activity> actionStartActivity(
parameters: ActionParameters = actionParametersOf()
): Action
Creates an Action that launches the specified Activity when triggered.
| Parameters | |
|---|---|
parameters: ActionParameters = actionParametersOf() |
the parameters associated with the action. Parameter values will be added to the activity intent, keyed by the parameter key name string. |
actionStartActivity
fun <T : Activity> actionStartActivity(
activity: Class<T>,
parameters: ActionParameters = actionParametersOf()
): Action
Creates an Action that launches the specified Activity when triggered.
| Parameters | |
|---|---|
activity: Class<T> |
class of the activity to launch |
parameters: ActionParameters = actionParametersOf() |
the parameters associated with the action. Parameter values will be added to the activity intent, keyed by the parameter key name string. |
actionStartActivity
fun actionStartActivity(
componentName: ComponentName,
parameters: ActionParameters = actionParametersOf()
): Action
Creates an Action that launches the Activity specified by the given ComponentName.
| Parameters | |
|---|---|
componentName: ComponentName |
component of the activity to launch |
parameters: ActionParameters = actionParametersOf() |
the parameters associated with the action. Parameter values will be added to the activity intent, keyed by the parameter key name string. |
actionStartActivity
@ExperimentalGlanceApi
inline fun <T : Activity> actionStartActivity(
parameters: ActionParameters = actionParametersOf(),
activityOptions: Bundle? = null
): Action
Creates an Action that launches the specified Activity when triggered.
| Parameters | |
|---|---|
parameters: ActionParameters = actionParametersOf() |
the parameters associated with the action. Parameter values will be added to the activity intent, keyed by the parameter key name string. |
activityOptions: Bundle? = null |
Additional options built from an |
actionStartActivity
@ExperimentalGlanceApi
fun <T : Activity> actionStartActivity(
activity: Class<T>,
parameters: ActionParameters = actionParametersOf(),
activityOptions: Bundle? = null
): Action
Creates an Action that launches the specified Activity when triggered.
| Parameters | |
|---|---|
activity: Class<T> |
class of the activity to launch |
parameters: ActionParameters = actionParametersOf() |
the parameters associated with the action. Parameter values will be added to the activity intent, keyed by the parameter key name string. |
activityOptions: Bundle? = null |
Additional options built from an |
actionStartActivity
@ExperimentalGlanceApi
fun actionStartActivity(
componentName: ComponentName,
parameters: ActionParameters = actionParametersOf(),
activityOptions: Bundle? = null
): Action
Creates an Action that launches the Activity specified by the given ComponentName.
| Parameters | |
|---|---|
componentName: ComponentName |
component of the activity to launch |
parameters: ActionParameters = actionParametersOf() |
the parameters associated with the action. Parameter values will be added to the activity intent, keyed by the parameter key name string. |
activityOptions: Bundle? = null |
Additional options built from an |
mutableActionParametersOf
fun mutableActionParametersOf(vararg pairs: ActionParameters.Pair<Any>): MutableActionParameters
Returns a new MutableParameters, from the specified contents. The key element in the given pairs will point to the corresponding value element. All values must be either of primitive or Parcelable types.
If multiple pairs have the same key, the resulting Parameters will contain only the value from the last of those pairs.
Extension functions
GlanceModifier.clickable
fun GlanceModifier.clickable(onClick: Action): GlanceModifier
Apply an Action, to be executed in response to a user click.
| Parameters | |
|---|---|
onClick: Action |
The action to run. |
GlanceModifier.clickable
fun GlanceModifier.clickable(
onClick: Action,
rippleOverride: @DrawableRes Int = NoRippleOverride
): GlanceModifier
Apply an Action, to be executed in response to a user click.
| Parameters | |
|---|---|
onClick: Action |
The action to run. |
rippleOverride: @DrawableRes Int = NoRippleOverride |
A drawable resource to use as the onClick ripple. Use |
ActionParameters.toMutableParameters
fun ActionParameters.toMutableParameters(): MutableActionParameters
Gets a mutable copy of Parameters, containing all key value pairs. This can be used to edit the parameter data without creating a new object.
This is similar to Map.toMutableMap.
| Returns | |
|---|---|
MutableActionParameters |
a MutableParameters with all the same parameters as this Parameters |
ActionParameters.toParameters
fun ActionParameters.toParameters(): ActionParameters
Gets a read-only copy of Parameters, containing all key value pairs.
This is similar to Map.toMap.
| Returns | |
|---|---|
ActionParameters |
a copy of this Parameters |
Preferences.Key.toParametersKey
fun <T : Any> Preferences.Key<T>.toParametersKey(): ActionParameters.Key<T>
Creates an action key from a preferences key.