类com.bumptech.glide.load.engine.cache.MemoryCache源码实例Demo

下面列出了怎么用com.bumptech.glide.load.engine.cache.MemoryCache的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: DebugDrawer   文件: GlideModule.java
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);
    }
}
 
源代码2 项目: giffun   文件: BitmapPreFillRunner.java
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;
}
 
源代码3 项目: giffun   文件: Engine.java
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);
}
 
源代码4 项目: giffun   文件: Glide.java
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);
}
 
源代码5 项目: giffun   文件: BitmapPreFiller.java
public BitmapPreFiller(MemoryCache memoryCache, BitmapPool bitmapPool, DecodeFormat defaultFormat) {
    this.memoryCache = memoryCache;
    this.bitmapPool = bitmapPool;
    this.defaultFormat = defaultFormat;
}
 
源代码6 项目: giffun   文件: BitmapPreFillRunner.java
public BitmapPreFillRunner(BitmapPool bitmapPool, MemoryCache memoryCache, PreFillQueue allocationOrder) {
    this(bitmapPool, memoryCache, allocationOrder, DEFAULT_CLOCK, new Handler(Looper.getMainLooper()));
}
 
源代码7 项目: giffun   文件: Engine.java
public Engine(MemoryCache memoryCache, DiskCache.Factory diskCacheFactory, ExecutorService diskCacheService,
        ExecutorService sourceService) {
    this(memoryCache, diskCacheFactory, diskCacheService, sourceService, null, null, null, null, null);
}
 
源代码8 项目: giffun   文件: GlideBuilder.java
/**
 * 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;
}
 
 类所在包
 类方法
 同包方法