prepend

open fun <Data> prepend(dataClass: Class<Data>, encoder: Encoder<Data>): Registry

Prepends the given Encoder into the list of available Encoders so that it is attempted before all later and default Encoders for the given data class.

This method allows you to replace the default Encoder because it ensures the registered Encoder will run first. If multiple Encoders are registered for the same type or super type, the Encoder that is registered first will be used.

See also


open fun <Data, TResource> prepend(    dataClass: Class<Data>,     resourceClass: Class<TResource>,     decoder: ResourceDecoder<Data, TResource>): Registry

Prepends the given ResourceDecoder into the list of all available s so that it is attempted before all later and default ResourceDecoders for the given types.

This method allows you to replace the default ResourceDecoder because it ensures the registered ResourceDecoder will run first. You can use the handles to fall back to the default ResourceDecoders if you only want to change the default functionality for certain types of data.

See also

Parameters

dataClass

The data that will be decoded from (java.io.InputStream, etc).

resourceClass

The resource that will be decoded to (android.graphics.Bitmap, com.bumptech.glide.load.resource.gif.GifDrawable etc).

decoder

The ResourceDecoder to register.


open fun <Data, TResource> prepend(    bucket: String,     dataClass: Class<Data>,     resourceClass: Class<TResource>,     decoder: ResourceDecoder<Data, TResource>): Registry

Prepends the given ResourceDecoder into the list of available ResourceDecoders in the same bucket so that it is attempted before all later and default s for the given types in that bucket.

This method allows you to replace the default ResourceDecoder for this bucket because it ensures the registered ResourceDecoder will run first. You can use the handles to fall back to the default s if you only want to change the default functionality for certain types of data.

See also

Parameters

bucket

The bucket identifier to add this decoder to.

dataClass

The data that will be decoded from (java.io.InputStream, etc).

resourceClass

The resource that will be decoded to (android.graphics.Bitmap, com.bumptech.glide.load.resource.gif.GifDrawable etc).

decoder

The ResourceDecoder to register.


open fun <TResource> prepend(resourceClass: Class<TResource>, encoder: ResourceEncoder<TResource>): Registry

Prepends the given ResourceEncoder into the list of available ResourceEncoders so that it is attempted before all later and default ResourceEncoders for the given data type.

This method allows you to replace the default ResourceEncoder because it ensures the registered ResourceEncoder will run first. If multiple ResourceEncoders are registered for the same type or super type, the ResourceEncoder that is registered first will be used.

See also


open fun <Model, Data> prepend(    modelClass: Class<Model>,     dataClass: Class<Data>,     factory: ModelLoaderFactory<Model, Data>): Registry

Prepends a new ModelLoaderFactory onto the beginning of the existing set so that the constructed ModelLoader will be tried before all default and previously registered ModelLoaders for the given model and data classes.

If you're attempting to add additional functionality or add a backup that should run only after the default ModelLoaders run, use append. This method is best for adding an additional case to Glide's existing functionality that should run first. This method will still run Glide's default s if the prepended ModelLoaders fail.

If multiple ModelLoaderFactorys are registered for the same model and/or data classes, the ModelLoaders they produce will be attempted in the order the s were registered. Only if all ModelLoaders fail will the entire request fail.

See also

Parameters

modelClass

The model class (e.g. URL, file path).

dataClass

the data class (e.g. java.io.InputStream, ).