Java 类com.bumptech.glide.module.GlideModule 实例源码

项目:glide-support    文件:BaseGlideReset.java   
/** Mimics Glide.get with a specific set of modules */
public void replace(List<Class<? extends GlideModule>> moduleClasses) {
    Glide originalGlide = null;
    if (isSetup()) {
        originalGlide = Glide.get(applicationContext);
        tearDown();
    }
    Log.d(TAG, "Setting up new Glide...");
    GlideBuilder builder = newBuilder();
    List<GlideModule> modules = createModules(moduleClasses);
    Log.v(TAG, "using modules: " + modules);
    applyOptions(modules, builder);
    Glide glide = createGlide(builder);
    registerComponents(modules, glide);
    Log.i(TAG, "Glide has been replaced, original=" + originalGlide + ", new=" + glide);
}
项目:glide-support    文件:BaseGlideReset.java   
/** new ManifestParser(applicationContext).parse(); */
protected List<GlideModule> createModules(List<Class<? extends GlideModule>> moduleClasses) {
    List<GlideModule> modules = new ArrayList<>();
    for (Class<? extends GlideModule> moduleClass : moduleClasses) {
        try {
            modules.add(moduleClass.newInstance());
        } catch (Exception ex) {
            throw new IllegalArgumentException("Cannot create GlideModule: " + moduleClass, ex);
        }
    }
    return modules;
}
项目:glide-support    文件:IssueEntryClassScanner.java   
@Override protected boolean isTargetClass(Class<?> clazz) {
    boolean accessible = !Modifier.isAbstract(clazz.getModifiers()) && Modifier.isPublic(clazz.getModifiers());
    return accessible && (
            Fragment.class.isAssignableFrom(clazz)
                    || GlideModule.class.isAssignableFrom(clazz)
                    || Activity.class.isAssignableFrom(clazz)
    );
}
项目:glide-support    文件:IssueInfo.java   
public IssueInfo(ClassNameSplitter clazz, List< Class<? extends GlideModule>> modules) {
    this.clazz = clazz;
    this.source = clazz.getHostPackageName();
    this.name = clazz.getPackageName();
    this.modules = modules;
}
项目:glide-support    文件:IssueInfo.java   
public List<Class<? extends GlideModule>> getModules() {
    return modules;
}
项目:glide-support    文件:GlideReset.java   
@Override protected void registerComponents(List<GlideModule> modules, Glide glide) {
    for (GlideModule module : modules) {
        module.registerComponents(applicationContext, glide);
    }
}
项目:glide-support    文件:GlideReset.java   
@Override protected void applyOptions(List<GlideModule> modules, GlideBuilder builder) {
    for (GlideModule module : modules) {
        module.applyOptions(applicationContext, builder);
    }
}
项目:glide-support    文件:GlideReset.java   
@Override protected void applyOptions(List<GlideModule> modules, GlideBuilder builder) {
    for (GlideModule module : modules) {
        module.applyOptions(applicationContext, builder);
    }
}
项目:glide-support    文件:GlideReset.java   
@Override protected void registerComponents(List<GlideModule> modules, Glide glide) {
    for (GlideModule module : modules) {
        module.registerComponents(applicationContext, glide.getRegistry());
    }
}
项目:glide-support    文件:BaseGlideReset.java   
protected abstract void registerComponents(List<GlideModule> modules, Glide glide);
项目:glide-support    文件:BaseGlideReset.java   
protected abstract void applyOptions(List<GlideModule> modules, GlideBuilder builder);