当前位置: 首页>>代码示例>>Java>>正文


Java MemoryCacheParams类代码示例

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


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

示例1: setUp

import com.facebook.imagepipeline.cache.MemoryCacheParams; //导入依赖的package包/类
@Before
public void setUp() {
  MockitoAnnotations.initMocks(this);
  MemoryCacheParams params = new MemoryCacheParams(
      4 * ByteConstants.MB,
      256,
      Integer.MAX_VALUE,
      Integer.MAX_VALUE,
      Integer.MAX_VALUE);
  when(mMemoryCacheParamsSupplier.get()).thenReturn(params);
  CountingMemoryCache<CacheKey, CloseableImage> countingMemoryCache =
      BitmapCountingMemoryCacheFactory.get(
          mMemoryCacheParamsSupplier,
          mMemoryTrimmableRegistry,
          mPlatformBitmapFactory,
          true);
  mCacheKey = new SimpleCacheKey("key");
  mAnimatedFrameCache = new AnimatedFrameCache(mCacheKey, countingMemoryCache);
  mFrame1 = CloseableReference.of(mock(CloseableImage.class));
  mFrame2 = CloseableReference.of(mock(CloseableImage.class));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:AnimatedFrameCacheTest.java

示例2: configureCaches

import com.facebook.imagepipeline.cache.MemoryCacheParams; //导入依赖的package包/类
/**
 * Configures disk and memory cache not to exceed common limits
 */
private static void configureCaches(ImagePipelineConfig.Builder configBuilder, Context context) {
    final MemoryCacheParams bitmapCacheParams = new MemoryCacheParams(
            MAX_MEMORY_CACHE_SIZE, // Max total size of elements in the cache
            Integer.MAX_VALUE,                     // Max entries in the cache
            MAX_MEMORY_CACHE_SIZE, // Max total size of elements in eviction queue
            Integer.MAX_VALUE,                     // Max length of eviction queue
            Integer.MAX_VALUE);                    // Max cache entry size
    configBuilder
            .setBitmapMemoryCacheParamsSupplier(
                    new Supplier<MemoryCacheParams>() {
                        public MemoryCacheParams get() {
                            return bitmapCacheParams;
                        }
                    })
            .setMainDiskCacheConfig(DiskCacheConfig.newBuilder(context)
                    .setBaseDirectoryPath(getExternalCacheDir(context))
                    .setBaseDirectoryName(IMAGE_PIPELINE_CACHE_DIR)
                    .setMaxCacheSize(MAX_DISK_CACHE_SIZE)
                    .build());
}
 
开发者ID:Elbehiry,项目名称:Viajes,代码行数:24,代码来源:ImagePipelineConfigFactory.java

示例3: configureCaches

import com.facebook.imagepipeline.cache.MemoryCacheParams; //导入依赖的package包/类
/**
 * Configures disk and memory cache not to exceed common limits
 */
private static void configureCaches(
    ImagePipelineConfig.Builder configBuilder,
    Context context) {
  final MemoryCacheParams bitmapCacheParams = new MemoryCacheParams(
      MAX_MEMORY_CACHE_SIZE, // Max total size of elements in the cache
      Integer.MAX_VALUE,                     // Max entries in the cache
      MAX_MEMORY_CACHE_SIZE, // Max total size of elements in eviction queue
      Integer.MAX_VALUE,                     // Max length of eviction queue
      Integer.MAX_VALUE);                    // Max cache entry size
  configBuilder
      .setBitmapMemoryCacheParamsSupplier(
          new Supplier<MemoryCacheParams>() {
            public MemoryCacheParams get() {
              return bitmapCacheParams;
            }
          })
      .setMainDiskCacheConfig(
          DiskCacheConfig.newBuilder(context)
                  .setBaseDirectoryPath(context.getApplicationContext().getCacheDir())
              .setBaseDirectoryName(IMAGE_PIPELINE_CACHE_DIR)
              .setMaxCacheSize(MAX_DISK_CACHE_SIZE)
              .build());
}
 
开发者ID:ebridfighter,项目名称:GongXianSheng,代码行数:27,代码来源:ImagePipelineConfigFactory.java

示例4: get

import com.facebook.imagepipeline.cache.MemoryCacheParams; //导入依赖的package包/类
@Override
public MemoryCacheParams get() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        return new MemoryCacheParams(
                getMaxCacheSize(),
                Integer.MAX_VALUE,
                getMaxCacheSize(),
                Integer.MAX_VALUE,
                Integer.MAX_VALUE);
    }else {
        return new MemoryCacheParams(
                getMaxCacheSize(),
                Integer.MAX_VALUE,
                getMaxCacheSize(),
                Integer.MAX_VALUE,
                Integer.MAX_VALUE);
    }
}
 
开发者ID:nowandfurure,项目名称:richeditor,代码行数:19,代码来源:FrescoCacheParams.java

示例5: configureCaches

import com.facebook.imagepipeline.cache.MemoryCacheParams; //导入依赖的package包/类
/**
 * Configures disk and memory cache not to exceed common limits
 */
private static void configureCaches(ImagePipelineConfig.Builder configBuilder, Context context) {
    final MemoryCacheParams bitmapCacheParams = new MemoryCacheParams(
            MAX_MEMORY_CACHE_SIZE, // Max total size of elements in the cache
            Integer.MAX_VALUE,     // Max entries in the cache
            MAX_MEMORY_CACHE_SIZE, // Max total size of elements in eviction queue
            Integer.MAX_VALUE,     // Max length of eviction queue
            Integer.MAX_VALUE);    // Max cache entry size
    configBuilder
            .setBitmapMemoryCacheParamsSupplier(
                    new Supplier<MemoryCacheParams>() {
                        public MemoryCacheParams get() {
                            return bitmapCacheParams;
                        }
                    })
            .setMainDiskCacheConfig(DiskCacheConfig.newBuilder(context)
                    .setBaseDirectoryPath(getExternalCacheDir(context))
                    .setBaseDirectoryName(IMAGE_PIPELINE_CACHE_DIR)
                    .setMaxCacheSize(MAX_DISK_CACHE_SIZE)
                    .build());
}
 
开发者ID:LegendKe,项目名称:MyTravelingDiary,代码行数:24,代码来源:ImagePipelineConfigFactory.java

示例6: getConfigureCaches

import com.facebook.imagepipeline.cache.MemoryCacheParams; //导入依赖的package包/类
private ImagePipelineConfig getConfigureCaches(Context context) {
    final MemoryCacheParams bitmapCacheParams = new MemoryCacheParams(
            MAX_MEM,// 内存缓存中总图片的最大大小,以字节为单位。
            Integer.MAX_VALUE,// 内存缓存中图片的最大数量。
            MAX_MEM,// 内存缓存中准备清除但尚未被删除的总图片的最大大小,以字节为单位。
            Integer.MAX_VALUE,// 内存缓存中准备清除的总图片的最大数量。
            Integer.MAX_VALUE / 10);// 内存缓存中单个图片的最大大小。

    Supplier<MemoryCacheParams> mSupplierMemoryCacheParams = new Supplier<MemoryCacheParams>() {
        @Override
        public MemoryCacheParams get() {
            return bitmapCacheParams;
        }
    };
    ImagePipelineConfig.Builder builder = ImagePipelineConfig.newBuilder(context)
            .setDownsampleEnabled(true);
    builder.setBitmapMemoryCacheParamsSupplier(mSupplierMemoryCacheParams);
    return builder.build();
}
 
开发者ID:Limuyang1013,项目名称:ImitateNetEasyCloud,代码行数:20,代码来源:NetEasyApplication.java

示例7: initUtil

import com.facebook.imagepipeline.cache.MemoryCacheParams; //导入依赖的package包/类
private void initUtil() {
    //初始化工具类
    DBManager.initialInstance(new DBOpenHelper(mContext));
    PermissionUtil.setContext(mContext);
    MediaStoreUtil.setContext(mContext);
    Util.setContext(mContext);
    ImageUriUtil.setContext(mContext);
    DiskCache.init(mContext);
    ColorUtil.setContext(mContext);
    PlayListUtil.setContext(mContext);
    final int cacheSize = (int)(Runtime.getRuntime().maxMemory() / 8);
    ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
            .setBitmapMemoryCacheParamsSupplier(() -> new MemoryCacheParams(cacheSize, Integer.MAX_VALUE,cacheSize,Integer.MAX_VALUE, 2 * ByteConstants.MB))
            .setBitmapsConfig(Bitmap.Config.RGB_565)
            .setDownsampleEnabled(true)
            .build();
    Fresco.initialize(this,config);
}
 
开发者ID:rRemix,项目名称:APlayer,代码行数:19,代码来源:APlayerApplication.java

示例8: getImagePipelineConfig

import com.facebook.imagepipeline.cache.MemoryCacheParams; //导入依赖的package包/类
public static ImagePipelineConfig getImagePipelineConfig(Context context) {
    if (sImagePipelineConfig == null) {
        sImagePipelineConfig = ImagePipelineConfig.newBuilder(context)
                .setMainDiskCacheConfig(DiskCacheConfig.newBuilder(context)
                        .setMaxCacheSize(ConfigConstants.MAX_CACHE_DISK_SIZE)
                        .build())
                .setBitmapMemoryCacheParamsSupplier(
                        new Supplier<MemoryCacheParams>() {
                            @Override
                            public MemoryCacheParams get() {
                                return new MemoryCacheParams(ConfigConstants.MAX_CACHE_MEMORY_SIZE,
                                        Integer.MAX_VALUE,
                                        Integer.MAX_VALUE,
                                        Integer.MAX_VALUE,
                                        Integer.MAX_VALUE);
                            }
                        }
                )
                .build();
    }
    return sImagePipelineConfig;
}
 
开发者ID:zhouruikevin,项目名称:ImageLoadPK,代码行数:23,代码来源:FrescoConfigFactory.java

示例9: configureCaches

import com.facebook.imagepipeline.cache.MemoryCacheParams; //导入依赖的package包/类
/**
 * Configures disk and memory cache not to exceed common limits
 */
private static void configureCaches(
    ImagePipelineConfig.Builder configBuilder,
    Context context) {
  final MemoryCacheParams bitmapCacheParams = new MemoryCacheParams(
      MAX_MEMORY_CACHE_SIZE, // Max total size of elements in the cache
      Integer.MAX_VALUE,                     // Max entries in the cache
      MAX_MEMORY_CACHE_SIZE, // Max total size of elements in eviction queue
      Integer.MAX_VALUE,                     // Max length of eviction queue
      Integer.MAX_VALUE);                    // Max cache entry size
  configBuilder
      .setBitmapMemoryCacheParamsSupplier(
          new Supplier<MemoryCacheParams>() {
            public MemoryCacheParams get() {
              return bitmapCacheParams;
            }
          })
      .setMainDiskCacheConfig(
          DiskCacheConfig.newBuilder(context)
              .setBaseDirectoryPath(context.getApplicationContext().getCacheDir())
              .setBaseDirectoryName(IMAGE_PIPELINE_CACHE_DIR)
              .setMaxCacheSize(MAX_DISK_CACHE_SIZE)
              .build());
}
 
开发者ID:jiang111,项目名称:ZhiHu-TopAnswer,代码行数:27,代码来源:ImagePipelineConfigFactory.java

示例10: configureCaches

import com.facebook.imagepipeline.cache.MemoryCacheParams; //导入依赖的package包/类
/**
 * Configures disk and memory cache not to exceed common limits
 */
private static void configureCaches(
        ImagePipelineConfig.Builder configBuilder,
        Context context) {
    FileUtils.createDirs(ConfigConstants.IMAGE_PIPELINE_CACHE_DIR);
    final MemoryCacheParams bitmapCacheParams = new MemoryCacheParams(
            ConfigConstants.MAX_MEMORY_CACHE_SIZE, // Max total size of elements in the cache
            Integer.MAX_VALUE,                     // Max entries in the cache
            ConfigConstants.MAX_MEMORY_CACHE_SIZE, // Max total size of elements in eviction queue
            Integer.MAX_VALUE,                     // Max length of eviction queue
            Integer.MAX_VALUE);                    // Max cache entry size
    configBuilder
            .setBitmapMemoryCacheParamsSupplier(
                    new Supplier<MemoryCacheParams>() {
                        public MemoryCacheParams get() {
                            return bitmapCacheParams;
                        }
                    })
            .setMainDiskCacheConfig(
                    DiskCacheConfig.newBuilder(context)
                            .setBaseDirectoryPath(FileUtils.createDirs(ConfigConstants.IMAGE_PIPELINE_BASE_DIR))
                            .setBaseDirectoryName(ConfigConstants.IMAGE_PIPELINE_CACHE_DIR)
                            .setMaxCacheSize(ConfigConstants.MAX_DISK_CACHE_SIZE)
                            .build());
}
 
开发者ID:sungerk,项目名称:meiShi,代码行数:28,代码来源:ImagePipelineConfigFactory.java

示例11: initFrescoConfig

import com.facebook.imagepipeline.cache.MemoryCacheParams; //导入依赖的package包/类
private void initFrescoConfig() {
    final MemoryCacheParams bitmapCacheParams =
            new MemoryCacheParams(MAX_MEMORY_CACHE_SIZE, // Max total size of elements in the cache
                    Integer.MAX_VALUE,                     // Max entries in the cache
                    MAX_MEMORY_CACHE_SIZE, // Max total size of elements in eviction queue
                    Integer.MAX_VALUE,                     // Max length of eviction queue
                    Integer.MAX_VALUE);
    ImagePipelineConfig config = OkHttpImagePipelineConfigFactory.newBuilder(this, mOkHttpClient)
            .setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
            .setBitmapMemoryCacheParamsSupplier(new Supplier<MemoryCacheParams>() {
                public MemoryCacheParams get() {
                    return bitmapCacheParams;
                }
            })
            .setMainDiskCacheConfig(
                    DiskCacheConfig.newBuilder(this).setMaxCacheSize(MAX_DISK_CACHE_SIZE).build())
            .setDownsampleEnabled(true)
            .build();
    Fresco.initialize(this, config);
}
 
开发者ID:gzsll,项目名称:TLint,代码行数:21,代码来源:MyApplication.java

示例12: configureCaches

import com.facebook.imagepipeline.cache.MemoryCacheParams; //导入依赖的package包/类
/**
 * Configures disk and memory cache not to exceed common limits
 */
private static void configureCaches(ImagePipelineConfig.Builder configBuilder, Context context) {
    final MemoryCacheParams bitmapCacheParams = new MemoryCacheParams(
            MAX_MEMORY_CACHE_SIZE, // Max total size of elements in the cache
            Integer.MAX_VALUE,                     // Max entries in the cache
            MAX_MEMORY_CACHE_SIZE, // Max total size of elements in eviction queue
            Integer.MAX_VALUE,                     // Max length of eviction queue
            Integer.MAX_VALUE);                    // Max cache entry size
    configBuilder
            .setBitmapMemoryCacheParamsSupplier(
                    new Supplier<MemoryCacheParams>() {
                        public MemoryCacheParams get() {
                            return bitmapCacheParams;
                        }
                    })
            .setMainDiskCacheConfig(DiskCacheConfig.newBuilder()
                            .setBaseDirectoryPath(getExternalCacheDir(context))
                            .setBaseDirectoryName(IMAGE_PIPELINE_CACHE_DIR)
                            .setMaxCacheSize(MAX_DISK_CACHE_SIZE)
                            .build());
}
 
开发者ID:haoyunbang,项目名称:HaoCommon,代码行数:24,代码来源:ImagePipelineConfigFactory.java

示例13: configureCaches

import com.facebook.imagepipeline.cache.MemoryCacheParams; //导入依赖的package包/类
/**
 * Configures disk and memory cache not to exceed common limits
 */
private static void configureCaches(
    ImagePipelineConfig.Builder configBuilder,
    Context context) {
  final MemoryCacheParams bitmapCacheParams = new MemoryCacheParams(
      ConfigConstants.MAX_MEMORY_CACHE_SIZE, // Max total size of elements in the cache
      Integer.MAX_VALUE,                     // Max entries in the cache
      ConfigConstants.MAX_MEMORY_CACHE_SIZE, // Max total size of elements in eviction queue
      Integer.MAX_VALUE,                     // Max length of eviction queue
      Integer.MAX_VALUE);                    // Max cache entry size
  configBuilder
      .setBitmapMemoryCacheParamsSupplier(
          new Supplier<MemoryCacheParams>() {
            public MemoryCacheParams get() {
              return bitmapCacheParams;
            }
          })
      .setMainDiskCacheConfig(
          DiskCacheConfig.newBuilder(context)
              .setBaseDirectoryPath(context.getApplicationContext().getCacheDir())
              .setBaseDirectoryName(IMAGE_PIPELINE_CACHE_DIR)
              .setMaxCacheSize(ConfigConstants.MAX_DISK_CACHE_SIZE)
              .build());
}
 
开发者ID:facebook,项目名称:fresco,代码行数:27,代码来源:ImagePipelineConfigFactory.java

示例14: get

import com.facebook.imagepipeline.cache.MemoryCacheParams; //导入依赖的package包/类
@Override
public MemoryCacheParams get() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        return new MemoryCacheParams(getMaxCacheSize(), MAX_CACHE_ENTRIES, MAX_CACHE_EVICTION_SIZE, MAX_CACHE_EVICTION_ENTRIES, 1);
    } else {
        return new MemoryCacheParams(
                getMaxCacheSize(),
                MAX_CACHE_ASHM_ENTRIES,
                Integer.MAX_VALUE,
                Integer.MAX_VALUE,
                Integer.MAX_VALUE);
    }
}
 
开发者ID:BaoBaoJianqiang,项目名称:CustomListView,代码行数:14,代码来源:FrescoBitmapMemoryCacheSupplier.java

示例15: init

import com.facebook.imagepipeline.cache.MemoryCacheParams; //导入依赖的package包/类
public void init(final Context context) {
    final int MAX_HEAP_SIZE = (int) Runtime.getRuntime().maxMemory();
    final int MAX_DISK_CACHE_SIZE = 300 * ByteConstants.MB;
    final int MAX_MEMORY_CACHE_SIZE = MAX_HEAP_SIZE / 3;
    final MemoryCacheParams bitmapCacheParams = new MemoryCacheParams(
            MAX_MEMORY_CACHE_SIZE,
            Integer.MAX_VALUE,
            MAX_MEMORY_CACHE_SIZE,
            Integer.MAX_VALUE,
            Integer.MAX_VALUE);

    DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder(context)
            .setMaxCacheSize(MAX_DISK_CACHE_SIZE)//最大缓存
            .setBaseDirectoryName("udesk")//子目录
            .setBaseDirectoryPathSupplier(new Supplier<File>() {
                @Override
                public File get() {
                    return UdeskUtil.getExternalCacheDir(context);
                }
            })
            .build();
    ImagePipelineConfig config = ImagePipelineConfig.newBuilder(context)
            .setBitmapMemoryCacheParamsSupplier(
                    new Supplier<MemoryCacheParams>() {
                        public MemoryCacheParams get() {
                            return bitmapCacheParams;
                        }
                    })
            .setMainDiskCacheConfig(diskCacheConfig)
            .setDownsampleEnabled(true)
            .setBitmapsConfig(Bitmap.Config.RGB_565)
            .build();

    Fresco.initialize(context, config);
}
 
开发者ID:lennyup,项目名称:react-native-udesk,代码行数:36,代码来源:UdeskSDKManager.java


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