Transformation

interface Transformation<T> : Key

A class for performing an arbitrary transformation on a resource that implements equals and hashCode} to identify the transformation in the memory cache and updateDiskCacheKey} to identify the transformation in disk caches.

Using the fully qualified class name as a static final String (not getName to avoid proguard obfuscation) is an easy way to implement updateDiskCacheKey} correctly. If additional arguments are required they can be passed in to the constructor of the Transformation and then used to update the java.security.MessageDigest passed in to updateDiskCacheKey. If arguments are primitive types, they can typically easily be serialized using java.nio.ByteBuffer. String types can be serialized with getBytes using the constant CHARSET.

Implementations must implement equals and hashCode for memory caching to work correctly.

Parameters

<T>

The type of the resource being transformed.

Functions

Link copied to clipboard
abstract fun equals(o: Any): Boolean
For caching to work correctly, implementations must implement this method and hashCode.
Link copied to clipboard
abstract fun hashCode(): Int
For caching to work correctly, implementations must implement this method and equals.
Link copied to clipboard
abstract fun transform(    context: Context,     resource: Resource<T>,     outWidth: Int,     outHeight: Int): Resource<T>
Transforms the given resource and returns the transformed resource.
Link copied to clipboard
abstract fun updateDiskCacheKey(messageDigest: MessageDigest)
Adds all uniquely identifying information to the given digest.

Properties

Link copied to clipboard
val CHARSET: Charset
Link copied to clipboard
val STRING_CHARSET_NAME: String

Inheritors

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard