public final class TitleChip.Builder


Builder class for TitleChip.

Summary

Public constructors

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

Creates a builder for the TitleChip with associated action and the given text

Public methods

@NonNull TitleChip

Constructs and returns TitleChip with the provided content and look.

@NonNull TitleChip.Builder

Sets the colors for the TitleChip.

@NonNull TitleChip.Builder

Sets the static content description for the TitleChip.

@NonNull TitleChip.Builder

Sets the content description for the TitleChip.

@NonNull TitleChip.Builder
setHorizontalAlignment(int horizontalAlignment)

Sets the horizontal alignment in the chip.

@NonNull TitleChip.Builder
setIconContent(@NonNull String imageResourceId)

Sets the icon for the TitleChip.

@NonNull TitleChip.Builder

Sets the width of TitleChip.

@NonNull TitleChip.Builder
setWidth(@Dimension(unit = 0) float width)

Sets the width of TitleChip.

Public constructors

Builder

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

Creates a builder for the TitleChip with associated action and the given text

Parameters
@NonNull Context context

The application's context.

@NonNull String text

The text to be displayed in this title chip. Text will be displayed in 1 line and truncated if it doesn't fit.

@NonNull ModifiersBuilders.Clickable clickable

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

@NonNull DeviceParametersBuilders.DeviceParameters deviceParameters

The device parameters used for styling text.

Public methods

build

Added in 1.0.0
public @NonNull TitleChip build()

Constructs and returns TitleChip with the provided content and look.

setChipColors

Added in 1.0.0
public @NonNull TitleChip.Builder setChipColors(@NonNull ChipColors chipColors)

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

setContentDescription

Added in 1.2.0
public @NonNull TitleChip.Builder setContentDescription(@NonNull CharSequence contentDescription)

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

setContentDescription

Added in 1.2.0
public @NonNull TitleChip.Builder setContentDescription(
    @NonNull TypeBuilders.StringProp contentDescription
)

Sets the content description for the TitleChip. 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).

setHorizontalAlignment

Added in 1.0.0
public @NonNull TitleChip.Builder setHorizontalAlignment(int horizontalAlignment)

Sets the horizontal alignment in the chip. If not set, content will be centered.

setIconContent

Added in 1.0.0
public @NonNull TitleChip.Builder setIconContent(@NonNull String imageResourceId)

Sets the icon for the TitleChip. 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.

setWidth

Added in 1.0.0
public @NonNull TitleChip.Builder setWidth(@NonNull DimensionBuilders.ContainerDimension width)

Sets the width of TitleChip. If not set, default value will be set to fill the screen.

setWidth

Added in 1.0.0
public @NonNull TitleChip.Builder setWidth(@Dimension(unit = 0) float width)

Sets the width of TitleChip. If not set, default value will be set to fill the screen.