CarIcon.Builder


public final class CarIcon.Builder


A builder of CarIcon.

Summary

Public constructors

Returns a Builder instance configured with the same data as the given CarIcon instance.

Creates a Builder instance using the given IconCompat.

Public methods

@NonNull CarIcon

Constructs the CarIcon defined by this builder.

@NonNull CarIcon.Builder

Sets the tint of the icon to the given CarColor.

Public constructors

Builder

Added in 1.0.0
public Builder(@NonNull CarIcon carIcon)

Returns a Builder instance configured with the same data as the given CarIcon instance.

Throws
java.lang.NullPointerException

if icon is null

Builder

Added in 1.0.0
public Builder(@NonNull IconCompat icon)

Creates a Builder instance using the given IconCompat.

The following types are supported:

TYPE_URI is only supported in templates that explicitly allow it. In those cases, the appropriate APIs will be documented to indicate this.

For TYPE_URI, the URI's scheme must be SCHEME_CONTENT.

If the icon image is loaded from URI, it may be cached on the host side. Changing the contents of the URI will result in the host showing a stale image.

Throws
java.lang.IllegalArgumentException

if icon's URI scheme is not supported

java.lang.NullPointerException

if icon is null

Public methods

build

Added in 1.0.0
public @NonNull CarIcon build()

Constructs the CarIcon defined by this builder.

setTint

Added in 1.0.0
public @NonNull CarIcon.Builder setTint(@NonNull CarColor tint)

Sets the tint of the icon to the given CarColor.

This tint overrides the tint set through setTint in the backing IconCompat with a CarColor tint. The tint set through setTint is not guaranteed to be applied if the CarIcon tint is not set.

The tint mode used to blend this color is SRC_IN.

Depending on contrast requirements, capabilities of the vehicle screens, or other factors, the color may be ignored by the host or overridden by the vehicle system.

Throws
java.lang.NullPointerException

if tin is null