Package com.bumptech.glide.module
Interface GlideModule
-
@Deprecated public interface GlideModuleDeprecated.Libraries should useLibraryGlideModuleand Applications should useAppGlideModule.An interface allowing lazy configuration of Glide including setting options usingGlideBuilderand registeringModelLoaders.To use this interface:
- Implement the GlideModule interface in a class with public visibility, calling
Registry.prepend(Class, Class, com.bumptech.glide.load.ResourceDecoder)for eachModelLoaderyou'd like to register:public class FlickrGlideModule implements GlideModule { @Override public void applyOptions(Context context, GlideBuilder builder) { builder.setDecodeFormat(DecodeFormat.ALWAYS_ARGB_8888); } @Override public void registerComponents(Context context, Glide glide) { glide.register(Model.class, Data.class, new MyModelLoader()); } } - Add your implementation to your list of keeps in your proguard.cfg file:
-keepnames class * com.bumptech.glide.samples.flickr.FlickrGlideModule - Add a metadata tag to your AndroidManifest.xml with your GlideModule implementation's fully
qualified classname as the key, and
GlideModuleas the value:<meta-data android:name="com.bumptech.glide.samples.flickr.FlickrGlideModule" android:value="GlideModule" />
All implementations must be publicly visible and contain only an empty constructor so they can be instantiated via reflection when Glide is lazily initialized.
There is no defined order in which modules are called, so projects should be careful to avoid applying conflicting settings in different modules. If an application depends on libraries that have conflicting modules, the application should consider avoiding the library modules and instead providing their required dependencies in a single application module.
- Implement the GlideModule interface in a class with public visibility, calling
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidapplyOptions(android.content.Context context, GlideBuilder builder)Deprecated.Lazily apply options to aGlideBuilderimmediately before the Glide singleton is created.voidregisterComponents(android.content.Context context, Glide glide, Registry registry)Deprecated.Lazily register components immediately after the Glide singleton is created but before any requests can be started.
-
-
-
Method Detail
-
registerComponents
void registerComponents(@NonNull android.content.Context context, @NonNull Glide glide, @NonNull Registry registry)Deprecated.Lazily register components immediately after the Glide singleton is created but before any requests can be started.This method will be called once and only once per implementation.
- Parameters:
context- An ApplicationContext.glide- The Glide singleton that is in the process of being initialized.registry- AnRegistryto use to register components.
-
applyOptions
void applyOptions(@NonNull android.content.Context context, @NonNull GlideBuilder builder)Deprecated.Lazily apply options to aGlideBuilderimmediately before the Glide singleton is created.This method will be called once and only once per implementation.
- Parameters:
context- An ApplicationContext.builder- TheGlideBuilderthat will be used to create Glide.
-
-