Chip


@ExperimentalCarApi
@CarProtocol
@RequiresCarApi(value = 9)
public final class Chip implements Item


A Chip is a toggle-like button with text and/or leading/trailing icon(s).

Chips can, for example, be used to filter items in a SectionedItemTemplate when clicked on. A chip's style, content, and selected state can be changed in response to a user click.

Summary

Nested types

public final class Chip.Builder

A builder of Chip.

Public methods

boolean
@Nullable CarIcon

Returns the end icon of the chip, or null if not set.

@Nullable OnClickDelegate

Returns the OnClickDelegate to be called when the chip is clicked.

@Nullable CarIcon

Returns the start icon of the chip, or null if not set.

@Nullable ChipStyle

Returns the style of the chip, or null if not set.

@Nullable CarText

Returns the title of the chip, or null if not set.

int
boolean

Returns whether the chip is selected.

@NonNull String

Public methods

equals

public boolean equals(@Nullable Object other)

getEndIcon

Added in 1.8.0
public @Nullable CarIcon getEndIcon()

Returns the end icon of the chip, or null if not set.

getOnClickDelegate

Added in 1.8.0
public @Nullable OnClickDelegate getOnClickDelegate()

Returns the OnClickDelegate to be called when the chip is clicked.

getStartIcon

Added in 1.8.0
public @Nullable CarIcon getStartIcon()

Returns the start icon of the chip, or null if not set.

getStyle

Added in 1.8.0
public @Nullable ChipStyle getStyle()

Returns the style of the chip, or null if not set.

getTitle

Added in 1.8.0
public @Nullable CarText getTitle()

Returns the title of the chip, or null if not set.

hashCode

public int hashCode()

isSelected

Added in 1.8.0
public boolean isSelected()

Returns whether the chip is selected.

toString

public @NonNull String toString()