• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MemoryCache类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.bumptech.glide.load.engine.cache.MemoryCache的典型用法代码示例。如果您正苦于以下问题:Java MemoryCache类的具体用法?Java MemoryCache怎么用?Java MemoryCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MemoryCache类属于com.bumptech.glide.load.engine.cache包,在下文中一共展示了MemoryCache类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testTrimMemory

import com.bumptech.glide.load.engine.cache.MemoryCache; //导入依赖的package包/类
@Test
public void testTrimMemory() {
  BitmapPool bitmapPool = mock(BitmapPool.class);
  MemoryCache memoryCache = mock(MemoryCache.class);

  Glide glide =
      new GlideBuilder().setBitmapPool(bitmapPool).setMemoryCache(memoryCache)
          .build(getContext());

  final int level = 123;

  glide.trimMemory(level);

  verify(bitmapPool).trimMemory(eq(level));
  verify(memoryCache).trimMemory(eq(level));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:GlideTest.java


示例2: Engine

import com.bumptech.glide.load.engine.cache.MemoryCache; //导入依赖的package包/类
public Engine(MemoryCache memoryCache,
    DiskCache.Factory diskCacheFactory,
    GlideExecutor diskCacheExecutor,
    GlideExecutor sourceExecutor,
    GlideExecutor sourceUnlimitedExecutor,
    GlideExecutor animationExecutor) {
  this(
      memoryCache,
      diskCacheFactory,
      diskCacheExecutor,
      sourceExecutor,
      sourceUnlimitedExecutor,
      animationExecutor,
      /*jobs=*/ null,
      /*keyFactory=*/ null,
      /*activeResources=*/ null,
      /*engineJobFactory=*/ null,
      /*decodeJobFactory=*/ null,
      /*resourceRecycler=*/ null);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:Engine.java


示例3: GlideModule

import com.bumptech.glide.load.engine.cache.MemoryCache; //导入依赖的package包/类
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);
    }
}
 
开发者ID:palaima,项目名称:DebugDrawer,代码行数:17,代码来源:GlideModule.java


示例4: BitmapPreFillRunner

import com.bumptech.glide.load.engine.cache.MemoryCache; //导入依赖的package包/类
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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:BitmapPreFillRunner.java


示例5: Engine

import com.bumptech.glide.load.engine.cache.MemoryCache; //导入依赖的package包/类
public Engine(MemoryCache memoryCache,
    DiskCache.Factory diskCacheFactory,
    GlideExecutor diskCacheExecutor,
    GlideExecutor sourceExecutor,
    GlideExecutor sourceUnlimitedExecutor) {
  this(memoryCache, diskCacheFactory, diskCacheExecutor, sourceExecutor, sourceUnlimitedExecutor,
      null, null, null, null, null, null);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:Engine.java


示例6: testCanSetMemoryCategory

import com.bumptech.glide.load.engine.cache.MemoryCache; //导入依赖的package包/类
@Test
public void testCanSetMemoryCategory() {
  MemoryCache memoryCache = mock(MemoryCache.class);
  BitmapPool bitmapPool = mock(BitmapPool.class);

  MemoryCategory memoryCategory = MemoryCategory.NORMAL;
  Glide glide =
      new GlideBuilder().setMemoryCache(memoryCache).setBitmapPool(bitmapPool)
          .build(getContext());
  glide.setMemoryCategory(memoryCategory);

  verify(memoryCache).setSizeMultiplier(eq(memoryCategory.getMultiplier()));
  verify(bitmapPool).setSizeMultiplier(eq(memoryCategory.getMultiplier()));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:GlideTest.java


示例7: testClearMemory

import com.bumptech.glide.load.engine.cache.MemoryCache; //导入依赖的package包/类
@Test
public void testClearMemory() {
  BitmapPool bitmapPool = mock(BitmapPool.class);
  MemoryCache memoryCache = mock(MemoryCache.class);

  Glide glide =
      new GlideBuilder().setBitmapPool(bitmapPool).setMemoryCache(memoryCache)
          .build(getContext());

  glide.clearMemory();

  verify(bitmapPool).clearMemory();
  verify(memoryCache).clearMemory();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:GlideTest.java


示例8: applyOptions

import com.bumptech.glide.load.engine.cache.MemoryCache; //导入依赖的package包/类
@Override
public void applyOptions(Context context, GlideBuilder builder) {
  // Run all tasks on the main thread so they complete synchronously.
  GlideExecutor executor = MockGlideExecutor.newMainThreadExecutor();

  DiskCache.Factory diskCacheFactory = mock(DiskCache.Factory.class);
  when(diskCacheFactory.build()).thenReturn(mock(DiskCache.class));

  builder.setMemoryCache(mock(MemoryCache.class)).setDiskCache(diskCacheFactory)
      .setResizeExecutor(executor).setDiskCacheExecutor(executor);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:GlideTest.java


示例9: BitmapPreFillRunner

import com.bumptech.glide.load.engine.cache.MemoryCache; //导入依赖的package包/类
@VisibleForTesting
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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:BitmapPreFillRunner.java


示例10: Glide

import com.bumptech.glide.load.engine.cache.MemoryCache; //导入依赖的package包/类
Glide(Engine engine, RequestQueue requestQueue, MemoryCache memoryCache, BitmapPool bitmapPool,
        Context context) {
    this.engine = engine;
    this.requestQueue = requestQueue;
    this.bitmapPool = bitmapPool;
    this.memoryCache = memoryCache;

    dataLoadProviderFactory = new DataLoadProviderFactory();
    dataLoadProviderFactory.register(InputStream.class, Bitmap.class, new StreamBitmapDataLoadProvider(bitmapPool));

    dataLoadProviderFactory.register(ParcelFileDescriptor.class, Bitmap.class,
            new FileDescriptorBitmapDataLoadProvider(bitmapPool));

    ImageVideoDataLoadProvider imageVideoDataLoadProvider = new ImageVideoDataLoadProvider(bitmapPool);
    dataLoadProviderFactory.register(ImageVideoWrapper.class, Bitmap.class, imageVideoDataLoadProvider);

    GifDataLoadProvider gifDataLoadProvider = new GifDataLoadProvider(context, bitmapPool);
    dataLoadProviderFactory.register(ImageVideoWrapper.class, GifBitmapWrapper.class,
            new ImageVideoGifDataLoadProvider(imageVideoDataLoadProvider, gifDataLoadProvider));

    register(File.class, ParcelFileDescriptor.class, new FileDescriptorFileLoader.Factory());
    register(File.class, InputStream.class, new StreamFileLoader.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 VolleyUrlLoader.Factory(requestQueue));

    transcoderFactory.register(Bitmap.class, BitmapDrawable.class,
            new BitmapDrawableTranscoder(context.getResources(), bitmapPool));
    transcoderFactory.register(GifBitmapWrapper.class, Drawable.class,
            new GifBitmapDrawableTranscoder(context));
}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:37,代码来源:Glide.java


示例11: EngineJob

import com.bumptech.glide.load.engine.cache.MemoryCache; //导入依赖的package包/类
public EngineJob(Key key, MemoryCache cache, Handler mainHandler, boolean isCacheable, EngineJobListener listener) {
    this.key = key;
    this.cache = cache;
    this.isCacheable = isCacheable;
    this.listener = listener;
    this.mainHandler = mainHandler;
}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:8,代码来源:EngineJob.java


示例12: Engine

import com.bumptech.glide.load.engine.cache.MemoryCache; //导入依赖的package包/类
Engine(ResourceRunnerFactory factory, MemoryCache cache, Map<Key, ResourceRunner> runners, KeyFactory keyFactory) {
    this.factory = factory;
    this.cache = cache;
    this.runners = runners;
    this.keyFactory = keyFactory;

    cache.setResourceRemovedListener(this);
}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:9,代码来源:Engine.java


示例13: DefaultResourceRunnerFactory

import com.bumptech.glide.load.engine.cache.MemoryCache; //导入依赖的package包/类
public DefaultResourceRunnerFactory(MemoryCache memoryCache, DiskCache diskCache, Handler mainHandler,
        ExecutorService service, Handler bgHandler ) {
    this.memoryCache = memoryCache;
    this.diskCache = diskCache;
    this.mainHandler = mainHandler;
    this.service = service;
    this.bgHandler = bgHandler;
}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:9,代码来源:DefaultResourceRunnerFactory.java


示例14: BitmapPreFiller

import com.bumptech.glide.load.engine.cache.MemoryCache; //导入依赖的package包/类
public BitmapPreFiller(MemoryCache memoryCache, BitmapPool bitmapPool,
    DecodeFormat defaultFormat) {
  this.memoryCache = memoryCache;
  this.bitmapPool = bitmapPool;
  this.defaultFormat = defaultFormat;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:BitmapPreFiller.java


示例15: setMemoryCache

import com.bumptech.glide.load.engine.cache.MemoryCache; //导入依赖的package包/类
public GlideBuilder setMemoryCache(MemoryCache memoryCache) {
    this.memoryCache = memoryCache;
    return this;
}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:5,代码来源:GlideBuilder.java


示例16: EngineBuilder

import com.bumptech.glide.load.engine.cache.MemoryCache; //导入依赖的package包/类
public EngineBuilder(MemoryCache memoryCache, DiskCache diskCache) {
    this.memoryCache = memoryCache;
    this.diskCache = diskCache;
}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:5,代码来源:EngineBuilder.java


示例17: setMemoryCache

import com.bumptech.glide.load.engine.cache.MemoryCache; //导入依赖的package包/类
/**
 * Sets the {@link com.bumptech.glide.load.engine.cache.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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:GlideBuilder.java



注:本文中的com.bumptech.glide.load.engine.cache.MemoryCache类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ContainerLogsRetentionPolicy类代码示例发布时间:2022-05-23
下一篇:
Java ConnectionStateCallback类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap