ClickableKt
public final class ClickableKt
Summary
Public methods |
|
|---|---|
static final @NonNull LayoutModifier |
clickable(Adds the clickable property of the modified element. |
static final @NonNull LayoutModifier |
clickable(Adds the clickable property of the modified element. |
static final @NonNull ModifiersBuilders.Clickable |
clickable(Creates a |
static final @NonNull ModifiersBuilders.Clickable |
clickable(Creates a |
static final @NonNull ActionBuilders.LoadAction |
loadAction(Creates an action used to load (or reload) the layout contents. |
static final @NonNull LayoutModifier |
@RequiresSchemaVersion(major = 1, minor = 300)Sets the minimum width and height of the clickable area. |
Public methods
clickable
public static final @NonNull LayoutModifier clickable(
@NonNull LayoutModifier receiver,
@NonNull ModifiersBuilders.Clickable clickable
)
Adds the clickable property of the modified element. It allows the modified element to have actions associated with it, which will be executed when the element is tapped.
clickable
public static final @NonNull LayoutModifier clickable(
@NonNull LayoutModifier receiver,
@NonNull ActionBuilders.Action action,
String id
)
Adds the clickable property of the modified element. It allows the modified element to have actions associated with it, which will be executed when the element is tapped.
| Parameters | |
|---|---|
@NonNull ActionBuilders.Action action |
is triggered whenever the element is tapped. By default adds an empty |
String id |
is the associated identifier for this clickable. This will be passed to the action handler. |
clickable
public static final @NonNull ModifiersBuilders.Clickable clickable(
@NonNull ActionBuilders.Action action,
String id,
@RequiresSchemaVersion(major = 1, minor = 300) @Dimension(unit = 0) float minClickableWidth,
@RequiresSchemaVersion(major = 1, minor = 300) @Dimension(unit = 0) float minClickableHeight
)
Creates a Clickable that allows the modified element to have actions associated with it, which will be executed when the element is tapped.
| Parameters | |
|---|---|
@NonNull ActionBuilders.Action action |
is triggered whenever the element is tapped. By default adds an empty |
String id |
is the associated identifier for this clickable. This will be passed to the action handler. |
@RequiresSchemaVersion(major = 1, minor = 300) @Dimension(unit = 0) float minClickableWidth |
of the clickable area. The default value is 48dp, following the Material design accessibility guideline. Note that this value does not affect the layout, so the minimum clickable width is not guaranteed unless there is enough space around the element within its parent bounds. |
@RequiresSchemaVersion(major = 1, minor = 300) @Dimension(unit = 0) float minClickableHeight |
of the clickable area. The default value is 48dp, following the Material design accessibility guideline. Note that this value does not affect the layout, so the minimum clickable height is not guaranteed unless there is enough space around the element within its parent bounds. |
clickable
public static final @NonNull ModifiersBuilders.Clickable clickable(
@NonNull ProtoLayoutScope receiver,
@NonNull PendingIntent pendingIntent,
@NonNull String id,
ActionBuilders.Action fallbackAction,
@Dimension(unit = 0) float minClickableWidth,
@Dimension(unit = 0) float minClickableHeight
)
Creates a Clickable that allows the modified element to have a PendingIntent associated with it, which will be sent when the element is tapped.
This clickable requires to be created in a ProtoLayoutScope receiver scope which handles internal details of ProtoLayout layout and tiles. In Tiles cases, this scope object can be obtained via androidx.wear.tiles.RequestBuilders#TileRequest.getScope.
| Parameters | |
|---|---|
@NonNull PendingIntent pendingIntent |
is sent when the element is tapped. |
@NonNull String id |
is the associated identifier for this clickable. This will be used to the identify the pendingIntent to send in the renderer. Within the same tile, this id must be unique among all pendingIntent clickables. |
ActionBuilders.Action fallbackAction |
The Action to use as a fallback when PendingIntent isn't supported by the ProtoLayout Renderer. |
@Dimension(unit = 0) float minClickableWidth |
of the clickable area. The default value is 48dp, following the Material design accessibility guideline. Note that this value does not affect the layout, so the minimum clickable width is not guaranteed unless there is enough space around the element within its parent bounds. |
@Dimension(unit = 0) float minClickableHeight |
of the clickable area. The default value is 48dp, following the Material design accessibility guideline. Note that this value does not affect the layout, so the minimum clickable height is not guaranteed unless there is enough space around the element within its parent bounds. |
loadAction
public static final @NonNull ActionBuilders.LoadAction loadAction(
@RequiresSchemaVersion(major = 1, minor = 200) DynamicDataMap requestedStateMap
)
Creates an action used to load (or reload) the layout contents.
| Parameters | |
|---|---|
@RequiresSchemaVersion(major = 1, minor = 200) DynamicDataMap requestedStateMap |
is the state associated with this action. This state will be passed to the action handler. |
minimumTouchTargetSize
@RequiresSchemaVersion(major = 1, minor = 300)
public static final @NonNull LayoutModifier minimumTouchTargetSize(
@NonNull LayoutModifier receiver,
@Dimension(unit = 0) float minWidth,
@Dimension(unit = 0) float minHeight
)
Sets the minimum width and height of the clickable area. The default value is 48dp, following the Material design accessibility guideline. Note that this value does not affect the layout, so the minimum clickable width/height is not guaranteed unless there is enough space around the element within its parent bounds.