The Android Developer Challenge is back! Submit your idea before December 2.

Builder

class Builder
kotlin.Any
   ↳ androidx.car.cluster.navigation.ImageReference.Builder

Builder for creating an ImageReference.

Summary

Public constructors

Builder for creating an ImageReference.

Public methods

ImageReference

Returns a ImageReference built with the provided information.

ImageReference.Builder
setContentUri(@NonNull contentUri: String)

Sets a 'content://' style URI

ImageReference.Builder
setIsTintable(isTintable: Boolean)

Sets whether this image is "tintable" or not.

ImageReference.Builder
setOriginalSize(width: Int, height: Int)

Sets the aspect ratio of this image, expressed as with and height sizes.

Public constructors

<init>

Builder()

Builder for creating an ImageReference.

Public methods

build

@NonNull fun build(): ImageReference

Returns a ImageReference built with the provided information. Calling ImageReference.Builder#setContentUri(String) and ImageReference.Builder#setOriginalSize(int, int) before calling this method is mandatory.

Return
ImageReference: an ImageReference instance
Exceptions
NullPointerException if content URI is not provided.
IllegalArgumentException if original size is not set.

setContentUri

@NonNull fun setContentUri(@NonNull contentUri: String): ImageReference.Builder

Sets a 'content://' style URI

Return
ImageReference.Builder: this object for chaining
Exceptions
NullPointerException if the provided contentUri is null
IllegalArgumentException if the provided contentUri doesn't start with 'content://'.

setIsTintable

@NonNull fun setIsTintable(isTintable: Boolean): ImageReference.Builder

Sets whether this image is "tintable" or not. An image is "tintable" when all its content is defined in its alpha-channel, designed to be colorized (e.g. using android.graphics.PorterDuff.Mode#SRC_ATOP image composition). If this method is not used, images will be non "tintable" by default.

Return
ImageReference.Builder: this object for chaining

setOriginalSize

@NonNull fun setOriginalSize(width: Int, height: Int): ImageReference.Builder

Sets the aspect ratio of this image, expressed as with and height sizes. Both dimensions must be greater than 0.

Return
ImageReference.Builder: this object for chaining
Exceptions
IllegalArgumentException if any of the dimensions is not positive.