com.bumptech.glide.load.engine.cache.MemoryCache Java Examples
The following examples show how to use
com.bumptech.glide.load.engine.cache.MemoryCache.
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: GlideModule.java From DebugDrawer with Apache License 2.0 | 6 votes |
public GlideModule(@NonNull Glide glide) { if (!HAS_GLIDE) { throw new RuntimeException("Glide dependency is not found"); } this.glide = glide; try { final Class<?> glideClass = glide.getClass(); final Field field = glideClass.getDeclaredField("memoryCache"); field.setAccessible(true); this.memoryCache = (MemoryCache) field.get(glide); } catch (Throwable t) { throw new RuntimeException("Incompatible Glide version", t); } }
Example #2
Source File: BitmapPreFillRunner.java From giffun with Apache License 2.0 | 5 votes |
BitmapPreFillRunner(BitmapPool bitmapPool, MemoryCache memoryCache, PreFillQueue allocationOrder, Clock clock, Handler handler) { this.bitmapPool = bitmapPool; this.memoryCache = memoryCache; this.toPrefill = allocationOrder; this.clock = clock; this.handler = handler; }
Example #3
Source File: Engine.java From giffun with Apache License 2.0 | 5 votes |
Engine(MemoryCache cache, DiskCache.Factory diskCacheFactory, ExecutorService diskCacheService, ExecutorService sourceService, Map<Key, EngineJob> jobs, EngineKeyFactory keyFactory, Map<Key, WeakReference<EngineResource<?>>> activeResources, EngineJobFactory engineJobFactory, ResourceRecycler resourceRecycler) { this.cache = cache; this.diskCacheProvider = new LazyDiskCacheProvider(diskCacheFactory); if (activeResources == null) { activeResources = new HashMap<Key, WeakReference<EngineResource<?>>>(); } this.activeResources = activeResources; if (keyFactory == null) { keyFactory = new EngineKeyFactory(); } this.keyFactory = keyFactory; if (jobs == null) { jobs = new HashMap<Key, EngineJob>(); } this.jobs = jobs; if (engineJobFactory == null) { engineJobFactory = new EngineJobFactory(diskCacheService, sourceService, this); } this.engineJobFactory = engineJobFactory; if (resourceRecycler == null) { resourceRecycler = new ResourceRecycler(); } this.resourceRecycler = resourceRecycler; cache.setResourceRemovedListener(this); }
Example #4
Source File: Glide.java From giffun with Apache License 2.0 | 4 votes |
Glide(Engine engine, MemoryCache memoryCache, BitmapPool bitmapPool, Context context, DecodeFormat decodeFormat, DiskCache.Factory diskCacheFactory) { this.engine = engine; this.bitmapPool = bitmapPool; this.memoryCache = memoryCache; this.decodeFormat = decodeFormat; this.diskCacheFactory = diskCacheFactory; loaderFactory = new GenericLoaderFactory(context); mainHandler = new Handler(Looper.getMainLooper()); bitmapPreFiller = new BitmapPreFiller(memoryCache, bitmapPool, decodeFormat); dataLoadProviderRegistry = new DataLoadProviderRegistry(); StreamBitmapDataLoadProvider streamBitmapLoadProvider = new StreamBitmapDataLoadProvider(bitmapPool, decodeFormat); dataLoadProviderRegistry.register(InputStream.class, Bitmap.class, streamBitmapLoadProvider); FileDescriptorBitmapDataLoadProvider fileDescriptorLoadProvider = new FileDescriptorBitmapDataLoadProvider(bitmapPool, decodeFormat); dataLoadProviderRegistry.register(ParcelFileDescriptor.class, Bitmap.class, fileDescriptorLoadProvider); ImageVideoDataLoadProvider imageVideoDataLoadProvider = new ImageVideoDataLoadProvider(streamBitmapLoadProvider, fileDescriptorLoadProvider); dataLoadProviderRegistry.register(ImageVideoWrapper.class, Bitmap.class, imageVideoDataLoadProvider); GifDrawableLoadProvider gifDrawableLoadProvider = new GifDrawableLoadProvider(context, bitmapPool); dataLoadProviderRegistry.register(InputStream.class, GifDrawable.class, gifDrawableLoadProvider); dataLoadProviderRegistry.register(ImageVideoWrapper.class, GifBitmapWrapper.class, new ImageVideoGifDrawableLoadProvider(imageVideoDataLoadProvider, gifDrawableLoadProvider, bitmapPool)); dataLoadProviderRegistry.register(InputStream.class, File.class, new StreamFileDataLoadProvider()); register(File.class, ParcelFileDescriptor.class, new FileDescriptorFileLoader.Factory()); register(File.class, InputStream.class, new StreamFileLoader.Factory()); register(int.class, ParcelFileDescriptor.class, new FileDescriptorResourceLoader.Factory()); register(int.class, InputStream.class, new StreamResourceLoader.Factory()); register(Integer.class, ParcelFileDescriptor.class, new FileDescriptorResourceLoader.Factory()); register(Integer.class, InputStream.class, new StreamResourceLoader.Factory()); register(String.class, ParcelFileDescriptor.class, new FileDescriptorStringLoader.Factory()); register(String.class, InputStream.class, new StreamStringLoader.Factory()); register(Uri.class, ParcelFileDescriptor.class, new FileDescriptorUriLoader.Factory()); register(Uri.class, InputStream.class, new StreamUriLoader.Factory()); register(URL.class, InputStream.class, new StreamUrlLoader.Factory()); register(GlideUrl.class, InputStream.class, new HttpUrlGlideUrlLoader.Factory()); register(byte[].class, InputStream.class, new StreamByteArrayLoader.Factory()); transcoderRegistry.register(Bitmap.class, GlideBitmapDrawable.class, new GlideBitmapDrawableTranscoder(context.getResources(), bitmapPool)); transcoderRegistry.register(GifBitmapWrapper.class, GlideDrawable.class, new GifBitmapWrapperDrawableTranscoder( new GlideBitmapDrawableTranscoder(context.getResources(), bitmapPool))); bitmapCenterCrop = new CenterCrop(bitmapPool); drawableCenterCrop = new GifBitmapWrapperTransformation(bitmapPool, bitmapCenterCrop); bitmapFitCenter = new FitCenter(bitmapPool); drawableFitCenter = new GifBitmapWrapperTransformation(bitmapPool, bitmapFitCenter); }
Example #5
Source File: BitmapPreFiller.java From giffun with Apache License 2.0 | 4 votes |
public BitmapPreFiller(MemoryCache memoryCache, BitmapPool bitmapPool, DecodeFormat defaultFormat) { this.memoryCache = memoryCache; this.bitmapPool = bitmapPool; this.defaultFormat = defaultFormat; }
Example #6
Source File: BitmapPreFillRunner.java From giffun with Apache License 2.0 | 4 votes |
public BitmapPreFillRunner(BitmapPool bitmapPool, MemoryCache memoryCache, PreFillQueue allocationOrder) { this(bitmapPool, memoryCache, allocationOrder, DEFAULT_CLOCK, new Handler(Looper.getMainLooper())); }
Example #7
Source File: Engine.java From giffun with Apache License 2.0 | 4 votes |
public Engine(MemoryCache memoryCache, DiskCache.Factory diskCacheFactory, ExecutorService diskCacheService, ExecutorService sourceService) { this(memoryCache, diskCacheFactory, diskCacheService, sourceService, null, null, null, null, null); }
Example #8
Source File: GlideBuilder.java From giffun with Apache License 2.0 | 2 votes |
/** * Sets the {@link MemoryCache} implementation to store * {@link com.bumptech.glide.load.engine.Resource}s that are not currently in use. * * @param memoryCache The cache to use. * @return This builder. */ public GlideBuilder setMemoryCache(MemoryCache memoryCache) { this.memoryCache = memoryCache; return this; }