ModifiersBuilders.Clickable.Builder


class ModifiersBuilders.Clickable.Builder


Builder for Clickable

Summary

Public constructors

Creates an instance of Builder.

@RequiresSchemaVersion(major = 1, minor = 600)
Builder(scope: ProtoLayoutScope, clickableId: String)

Creates an instance of Builder which is able to accept a PendingIntent as onClick action.

Public functions

ModifiersBuilders.Clickable

Builds an instance from accumulated values.

ModifiersBuilders.Clickable.Builder
@RequiresSchemaVersion(major = 1, minor = 0)
setId(id: String)

Sets the ID associated with this action.

ModifiersBuilders.Clickable.Builder
@RequiresSchemaVersion(major = 1, minor = 300)
setMinimumClickableHeight(
    minimumClickableHeight: DimensionBuilders.DpProp
)

Sets the minimum height of the clickable area.

ModifiersBuilders.Clickable.Builder
@RequiresSchemaVersion(major = 1, minor = 300)
setMinimumClickableWidth(
    minimumClickableWidth: DimensionBuilders.DpProp
)

Sets the minimum width of the clickable area.

ModifiersBuilders.Clickable.Builder
@RequiresSchemaVersion(major = 1, minor = 0)
setOnClick(onClick: ActionBuilders.Action)

Sets the action to perform when the element this modifier is attached to is clicked.

ModifiersBuilders.Clickable.Builder
@RequiresSchemaVersion(major = 1, minor = 600)
setOnClick(pendingIntent: PendingIntent)

Sets the PendingIntent to perform when the element this modifier is attached to is clicked.

ModifiersBuilders.Clickable.Builder
@RequiresSchemaVersion(major = 1, minor = 400)
setVisualFeedbackEnabled(visualFeedbackEnabled: Boolean)

Sets whether the click visual feedback (such as a ripple) should be enabled.

Public constructors

Builder

Added in 1.0.0
Builder()

Creates an instance of Builder.

Note that, builder created with this constructor can not be used to invoke setOnClick, otherwise an exception will be thrown. Instead, create the builder with Builder for setting a PendingIntent as onClick action.

Builder

Added in 1.4.0-alpha01
@RequiresSchemaVersion(major = 1, minor = 600)
Builder(scope: ProtoLayoutScope, clickableId: String)

Creates an instance of Builder which is able to accept a PendingIntent as onClick action. Builder instance created with this constructor works with other type of actions as well.

Note that, calling #setId would override the clickable Id set here.

Public functions

build

Added in 1.0.0
fun build(): ModifiersBuilders.Clickable

Builds an instance from accumulated values.

setId

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
fun setId(id: String): ModifiersBuilders.Clickable.Builder

Sets the ID associated with this action.

setMinimumClickableHeight

Added in 1.1.0
@RequiresSchemaVersion(major = 1, minor = 300)
fun setMinimumClickableHeight(
    minimumClickableHeight: DimensionBuilders.DpProp
): ModifiersBuilders.Clickable.Builder

Sets the minimum 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 height is not guaranteed unless there is enough space around the element within its parent bounds.

Note that this field only supports static values.

setMinimumClickableWidth

Added in 1.1.0
@RequiresSchemaVersion(major = 1, minor = 300)
fun setMinimumClickableWidth(
    minimumClickableWidth: DimensionBuilders.DpProp
): ModifiersBuilders.Clickable.Builder

Sets the minimum width 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.

Note that this field only supports static values.

setOnClick

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
fun setOnClick(onClick: ActionBuilders.Action): ModifiersBuilders.Clickable.Builder

Sets the action to perform when the element this modifier is attached to is clicked.

setOnClick

Added in 1.4.0-alpha01
@RequiresSchemaVersion(major = 1, minor = 600)
fun setOnClick(pendingIntent: PendingIntent): ModifiersBuilders.Clickable.Builder

Sets the PendingIntent to perform when the element this modifier is attached to is clicked.

Note that this method is mutually exclusive with #setOnClick(Action), the later method call will override the previous one.

Throws
java.lang.IllegalArgumentException

if the builder is not constructed with Builder.

setVisualFeedbackEnabled

Added in 1.2.0
@RequiresSchemaVersion(major = 1, minor = 400)
fun setVisualFeedbackEnabled(visualFeedbackEnabled: Boolean): ModifiersBuilders.Clickable.Builder

Sets whether the click visual feedback (such as a ripple) should be enabled. Defaults to true.