Badge.Builder


public final class Badge.Builder


A builder of Badge.

Summary

Public constructors

Returns an empty Builder instance.

Public methods

@NonNull Badge

Constructs the Badge defined by this builder.

@NonNull Badge.Builder

This method is deprecated.

use setDotColor instead.

@NonNull Badge.Builder

Sets the color of the dot to the given color.

@NonNull Badge.Builder
setHasDot(boolean hasDot)

Enables a circular dot that denotes some sort of alert, notification, etc.

@NonNull Badge.Builder

Sets an icon to be displayed as a badge.

@NonNull Badge.Builder

Sets the color of the icon background to the given color.

Public constructors

Builder

Added in 1.4.0
public Builder()

Returns an empty Builder instance.

Public methods

build

Added in 1.4.0
public @NonNull Badge build()

Constructs the Badge defined by this builder.

Throws
java.lang.IllegalStateException

if the badge doesn't have a dot or an icon.

java.lang.IllegalStateException

if the a dot color is set but the badge has no dot.

java.lang.IllegalStateException

if the a icon background color is set but the badge has no icon.

setBackgroundColor

Added in 1.4.0
Deprecated in 1.8.0-alpha01
public @NonNull Badge.Builder setBackgroundColor(@NonNull CarColor backgroundColor)

Sets the color of the dot to the given backgroundColor.

setDotColor

Added in 1.8.0-alpha01
public @NonNull Badge.Builder setDotColor(@NonNull CarColor color)

Sets the color of the dot to the given color.

setHasDot

Added in 1.4.0
public @NonNull Badge.Builder setHasDot(boolean hasDot)

Enables a circular dot that denotes some sort of alert, notification, etc.

setIcon

Added in 1.4.0
public @NonNull Badge.Builder setIcon(@NonNull CarIcon icon)

Sets an icon to be displayed as a badge.

An icon badge gives context about the associated element on which it is displayed. For example, a work profile icon badge is displayed with an app icon to indicate that it is a work app.

setIconBackgroundColor

Added in 1.8.0-alpha01
public @NonNull Badge.Builder setIconBackgroundColor(@NonNull CarColor color)

Sets the color of the icon background to the given color.