Java Code Examples for com.bumptech.glide.Glide#isSetup()
The following examples show how to use
com.bumptech.glide.Glide#isSetup() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GlideReset.java From glide-support with The Unlicense | 6 votes |
/** Mimics Glide.get with a specific set of modules */ public void replace(Iterable<Class<? extends GlideModule>> moduleClasses) { Glide originalGlide = null; if (Glide.isSetup()) { originalGlide = Glide.get(applicationContext); tearDown(); } Log.d(TAG, "Setting up new Glide..."); GlideBuilder builder = new GlideBuilder(applicationContext); List<GlideModule> modules = createModules(moduleClasses); Log.v(TAG, "using modules: " + modules); applyOptions(modules, builder); Glide.setup(builder); Glide newGlide = Glide.get(applicationContext); registerComponents(modules, newGlide); Log.i(TAG, "Glide has been replaced, original=" + originalGlide + ", new=" + newGlide); }
Example 2
Source File: GlideUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 6 votes |
public static void init(final Context context) { OkHttpClient okHttpClient = new OkHttpClient(); okHttpClient.setReadTimeout(30, TimeUnit.SECONDS); okHttpClient.setConnectTimeout(30, TimeUnit.SECONDS); // okHttpClient.setProtocols(Arrays.asList(Protocol.HTTP_1_1)); GlideBuilder glideBuilder = new GlideBuilder(context) .setDiskCache(new DiskCache.Factory() { @Override public DiskCache build() { // Careful: the external cache directory doesn't enforce permissions File cacheLocation = new File(context.getExternalCacheDir(), AppConfig.CACHE_IMAGE_DIR); cacheLocation.mkdirs(); return DiskLruCacheWrapper.get(cacheLocation, 100 * 1024 * 1024); } }); if (!Glide.isSetup()) { Glide.setup(glideBuilder); } Glide.get(context).register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(okHttpClient)); }
Example 3
Source File: GlideReset.java From glide-support with The Unlicense | 5 votes |
/** Try to get rid of references and clean as much as possible */ public void tearDown() { if (!Glide.isSetup()) { return; } Log.v(TAG, "Tearing down Glide, it was set up before"); Glide.with(applicationContext).onDestroy(); // TODO discover other contexts and destroy recursively // Note: there are likely none, because the activities that were shows prior should have been destroyed already Glide.get(applicationContext).clearMemory(); // TODO RequestManagerRetriever.get().applicationManager = null; setGlide(null); }