CompactChip.Builder


class CompactChip.Builder


Builder class for CompactChip.

Summary

Public constructors

Builder(
    context: Context,
    clickable: ModifiersBuilders.Clickable,
    deviceParameters: DeviceParametersBuilders.DeviceParameters
)

Creates a builder for the CompactChip with associated action.

Builder(
    context: Context,
    text: String,
    clickable: ModifiersBuilders.Clickable,
    deviceParameters: DeviceParametersBuilders.DeviceParameters
)

Creates a builder for the CompactChip with associated action and the given text.

Public functions

CompactChip

Constructs and returns CompactChip with the provided content and look.

CompactChip.Builder

Sets the colors for the CompactChip.

CompactChip.Builder
setContentDescription(contentDescription: CharSequence)

Sets the static content description for the CompactChip.

CompactChip.Builder

Sets the content description for the CompactChip.

CompactChip.Builder
setIconContent(imageResourceId: String)

Sets the icon for the CompactChip.

CompactChip.Builder

Sets the text for the CompactChip.

Public constructors

Builder

Added in 1.2.0
Builder(
    context: Context,
    clickable: ModifiersBuilders.Clickable,
    deviceParameters: DeviceParametersBuilders.DeviceParameters
)

Creates a builder for the CompactChip with associated action. Please add text, icon or both content with setTextContent and setIconContent.

Parameters
context: Context

The application's context.

clickable: ModifiersBuilders.Clickable

Associated Clickable for click events. When the CompactChip is clicked it will fire the associated action.

deviceParameters: DeviceParametersBuilders.DeviceParameters

The device parameters used for styling text.

Builder

Added in 1.0.0
Builder(
    context: Context,
    text: String,
    clickable: ModifiersBuilders.Clickable,
    deviceParameters: DeviceParametersBuilders.DeviceParameters
)

Creates a builder for the CompactChip with associated action and the given text.

Parameters
context: Context

The application's context.

text: String

The text to be displayed in this compact chip.

clickable: ModifiersBuilders.Clickable

Associated Clickable for click events. When the CompactChip is clicked it will fire the associated action.

deviceParameters: DeviceParametersBuilders.DeviceParameters

The device parameters used for styling text.

Public functions

build

Added in 1.0.0
fun build(): CompactChip

Constructs and returns CompactChip with the provided content and look.

setChipColors

Added in 1.0.0
fun setChipColors(chipColors: ChipColors): CompactChip.Builder

Sets the colors for the CompactChip. If set, getBackgroundColor will be used for the background of the button and getContentColor for the text. If not set, COMPACT_PRIMARY_COLORS will be used.

setContentDescription

Added in 1.2.0
fun setContentDescription(contentDescription: CharSequence): CompactChip.Builder

Sets the static content description for the CompactChip. It is highly recommended to provide this for chip containing an icon.

setContentDescription

Added in 1.2.0
fun setContentDescription(contentDescription: TypeBuilders.StringProp): CompactChip.Builder

Sets the content description for the CompactChip. It is highly recommended to provide this for chip containing an icon.

While this field is statically accessible from 1.0, it's only bindable since version 1.2 and renderers supporting version 1.2 will use the dynamic value (if set).

setIconContent

Added in 1.0.0
fun setIconContent(imageResourceId: String): CompactChip.Builder

Sets the icon for the CompactChip. Provided icon will be tinted to the given content color from ChipColors. This icon should be image with chosen alpha channel that can be tinted.

setTextContent

Added in 1.2.0
fun setTextContent(text: String): CompactChip.Builder

Sets the text for the CompactChip.