|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface GlideModule
An interface allowing lazy configuration of Glide including setting options using
GlideBuilder
and registering
ModelLoaders
.
To use this interface:
Glide.register(Class, Class, com.bumptech.glide.load.model.ModelLoaderFactory)
for each ModelLoader
you'd like to register:
public class FlickrGlideModule implements GlideModule {
@Override
public void applyOptions(Context context, GlideBuilder builder) {
buidler.setDecodeFormat(DecodeFormat.ALWAYS_ARGB_8888);
}
@Override
public void registerComponents(Context context, Glide glide) {
glide.register(Model.class, Data.class, new MyModelLoader());
}
}
-keepnames class * com.bumptech.glide.samples.flickr.FlickrGlideModule
GlideModule
as 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.
Method Summary | |
---|---|
void |
applyOptions(Context context,
GlideBuilder builder)
Lazily apply options to a GlideBuilder immediately before the Glide singleton is
created. |
void |
registerComponents(Context context,
Glide glide)
Lazily register components immediately after the Glide singleton is created but before any requests can be started. |
Method Detail |
---|
void applyOptions(Context context, GlideBuilder builder)
GlideBuilder
immediately before the Glide singleton is
created.
This method will be called once and only once per implementation.
context
- An Application Context
.builder
- The GlideBuilder
that will be used to create Glide.void registerComponents(Context context, Glide glide)
This method will be called once and only once per implementation.
context
- An Application Context
.glide
- The newly created Glide singleton.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |