ModifiersBuilders.Clickable.Builder


public final class ModifiersBuilders.Clickable.Builder


Builder for Clickable

Summary

Public constructors

Creates an instance of Builder.

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

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

Public methods

@NonNull ModifiersBuilders.Clickable

Builds an instance from accumulated values.

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

Sets the ID associated with this action.

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

Sets the minimum height of the clickable area.

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

Sets the minimum width of the clickable area.

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

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

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

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

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

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

Public constructors

Builder

Added in 1.0.0
public 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)
public Builder(@NonNull ProtoLayoutScope scope, @NonNull String clickableId)

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 methods

build

Added in 1.0.0
public @NonNull ModifiersBuilders.Clickable build()

Builds an instance from accumulated values.

setId

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

Sets the ID associated with this action.

setMinimumClickableHeight

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

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)
public @NonNull ModifiersBuilders.Clickable.Builder setMinimumClickableWidth(
    @NonNull DimensionBuilders.DpProp minimumClickableWidth
)

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)
public @NonNull ModifiersBuilders.Clickable.Builder setOnClick(@NonNull ActionBuilders.Action onClick)

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)
public @NonNull ModifiersBuilders.Clickable.Builder setOnClick(@NonNull PendingIntent pendingIntent)

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)
public @NonNull ModifiersBuilders.Clickable.Builder setVisualFeedbackEnabled(boolean visualFeedbackEnabled)

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