Avatar

data class Avatar(data: List<Any?>, maxSectionSize: Int, avatarBorderWidth: Int, errorPlaceholder: Drawable?, onSuccess: (request: ImageRequest, metadata: ImageResult.Metadata) -> Unit, onError: (request: ImageRequest, throwable: Throwable) -> Unit)

A data transfer model for transferring image data to AvatarFetcher. This model will be fetched by AvatarFetcher when we request image loading by using this type to Coil.

The default supported data types are:

Parameters

data

A list of image data.

maxSectionSize

The maximum section size of the avatar when loading multiple images.

avatarBorderWidth

The border width of AvatarView.

errorPlaceholder

An error placeholder that should be shown when request failed.

Constructors

Link copied to clipboard
fun Avatar(data: List<Any?>, maxSectionSize: Int, avatarBorderWidth: Int, errorPlaceholder: Drawable?, onSuccess: (request: ImageRequest, metadata: ImageResult.Metadata) -> Unit, onError: (request: ImageRequest, throwable: Throwable) -> Unit)

Properties

Link copied to clipboard
val avatarBorderWidth: Int

The border width of AvatarView.

Link copied to clipboard
val data: List<Any?>

A list of data to be requested.

Link copied to clipboard
val errorPlaceholder: Drawable?

An error placeholder that should be shown when request failed.

Link copied to clipboard
val maxSectionSize: Int

The maximum size of the sections.

Link copied to clipboard
val onError: (request: ImageRequest, throwable: Throwable) -> Unit

A lambda function will be executed when loading failed.

Link copied to clipboard
val onSuccess: (request: ImageRequest, metadata: ImageResult.Metadata) -> Unit

A lambda function will be executed when loading succeeds.

Functions

Link copied to clipboard
fun <T : Any> getTag(key: String): T?

Returns the tag associated with this avatar using the given key.

Link copied to clipboard
fun <T : Any> setTagIfAbsent(key: String, newValue: T)

Sets a tag associated with this avatar and a key. If the given newValue was already set for the given key, this calls do nothing, the given newValue would be ignored.