CarIcon.Builder
public
static
final
class
CarIcon.Builder
extends Object
java.lang.Object | |
↳ | androidx.car.app.model.CarIcon.Builder |
A builder of CarIcon
.
Summary
Public constructors | |
---|---|
Builder(IconCompat icon)
Creates a |
|
Builder(CarIcon carIcon)
Returns a |
Public methods | |
---|---|
CarIcon
|
build()
Constructs the |
CarIcon.Builder
|
setTint(CarColor tint)
Sets the tint of the icon to the given |
Inherited methods | |
---|---|
Public constructors
Builder
public Builder (IconCompat icon)
Creates a CarIcon.Builder
instance using the given IconCompat
.
The following types are supported:
IconCompat.TYPE_URI
is only supported in templates that explicitly allow it.
In those cases, the appropriate APIs will be documented to indicate this.
For IconCompat.TYPE_URI
, the URI's scheme must be ContentResolver.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.
Parameters | |
---|---|
icon |
IconCompat |
Throws | |
---|---|
IllegalArgumentException |
if icon 's URI scheme is not supported |
NullPointerException |
if icon is null
|
Builder
public Builder (CarIcon carIcon)
Returns a CarIcon.Builder
instance configured with the same data as the given
CarIcon
instance.
Parameters | |
---|---|
carIcon |
CarIcon |
Throws | |
---|---|
NullPointerException |
if icon is null
|
Public methods
setTint
public CarIcon.Builder setTint (CarColor tint)
Sets the tint of the icon to the given CarColor
.
This tint overrides the tint set through IconCompat.setTint(int)
in the
backing IconCompat
with a CarColor
tint.The tint set through IconCompat.setTint(int)
is not guaranteed to be applied if the CarIcon
tint
is not set.
The tint mode used to blend this color is PorterDuff.Mode.SRC_IN
.
By default, no tint is set unless one is specified with this method.
Parameters | |
---|---|
tint |
CarColor |
Returns | |
---|---|
CarIcon.Builder |
Throws | |
---|---|
NullPointerException |
if tin is null |
See also: