private void init(Context context) { ImagePipelineConfig.Builder builder = ImagePipelineConfig.newBuilder(context) .setDownsampleEnabled(true); String cache = BoxingFileHelper.getCacheDir(context); if (TextUtils.isEmpty(cache)) { throw new IllegalStateException("the cache dir is null"); } if (cache != null) { DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder(context) .setBaseDirectoryPath(new File(cache)) .setBaseDirectoryName(IMAGE_PIPELINE_CACHE_DIR) .setMaxCacheSize(MAX_DISK_CACHE_SIZE) .setMaxCacheSizeOnLowDiskSpace(MAX_DISK_CACHE_LOW_SIZE) .setMaxCacheSizeOnVeryLowDiskSpace(MAX_DISK_CACHE_VERYLOW_SIZE) .build(); builder.setMainDiskCacheConfig(diskCacheConfig); } ImagePipelineConfig config = builder.build(); Fresco.initialize(context, config); }
/** Initializes Fresco with the specified config. */ public static void initialize( Context context, @Nullable ImagePipelineConfig imagePipelineConfig, @Nullable DraweeConfig draweeConfig) { if (sIsInitialized) { FLog.w( TAG, "Fresco has already been initialized! `Fresco.initialize(...)` should only be called " + "1 single time to avoid memory leaks!"); } else { sIsInitialized = true; } // we should always use the application context to avoid memory leaks context = context.getApplicationContext(); if (imagePipelineConfig == null) { ImagePipelineFactory.initialize(context); } else { ImagePipelineFactory.initialize(imagePipelineConfig); } initializeDrawee(context, draweeConfig); }
@Override public void onCreate() { super.onCreate(); final Config config = Config.load(this); ImagePipelineConfig.Builder imagePipelineConfigBuilder = ImagePipelineConfig.newBuilder(this) .setResizeAndRotateEnabledForNetwork(false) .setDownsampleEnabled(config.downsampling); if (WebpSupportStatus.sIsWebpSupportRequired) { imagePipelineConfigBuilder.experiment().setWebpSupportEnabled(config.webpSupportEnabled); } if (config.decodingThreadCount == 0) { imagePipelineConfigBuilder.setExecutorSupplier( new DefaultExecutorSupplier(Const.NUMBER_OF_PROCESSORS)); } else { imagePipelineConfigBuilder.setExecutorSupplier( new ScrollPerfExecutorSupplier(Const.NUMBER_OF_PROCESSORS, config.decodingThreadCount)); } imagePipelineConfigBuilder.experiment().setDecodeCancellationEnabled(config.decodeCancellation); DraweeConfig draweeConfig = DraweeConfig.newBuilder() .setDrawDebugOverlay(config.draweeOverlayEnabled) .build(); Fresco.initialize(this, imagePipelineConfigBuilder.build(), draweeConfig); }
/** * 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()); }
private void init(Context context) { ImagePipelineConfig.Builder builder = ImagePipelineConfig.newBuilder(context) .setDownsampleEnabled(true); String cache = BoxingFileHelper.getCacheDir(context); if (TextUtils.isEmpty(cache)) { throw new IllegalStateException("the cache dir is null"); } if (!TextUtils.isEmpty(cache)) { DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder(context) .setBaseDirectoryPath(new File(cache)) .setBaseDirectoryName(IMAGE_PIPELINE_CACHE_DIR) .setMaxCacheSize(MAX_DISK_CACHE_SIZE) .setMaxCacheSizeOnLowDiskSpace(MAX_DISK_CACHE_LOW_SIZE) .setMaxCacheSizeOnVeryLowDiskSpace(MAX_DISK_CACHE_VERYLOW_SIZE) .build(); builder.setMainDiskCacheConfig(diskCacheConfig); } ImagePipelineConfig config = builder.build(); Fresco.initialize(context, config); }
@Override public void onCreate() { super.onCreate(); app = this; // 存放所有activity的集合 mActivityList = new ArrayList<>(); // 渐进式图片 ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this) .setProgressiveJpegConfig(new SimpleProgressiveJpegConfig()) .build(); Fresco.initialize(this, config); }
@Override public void onCreate() { super.onCreate(); OkHttpClient okHttpClient = new OkHttpClient.Builder() .build(); ImagePipelineConfig config = OkHttpImagePipelineConfigFactory.newBuilder(this, okHttpClient) .setMainDiskCacheConfig(getDiskCacheConfig()) .setNetworkFetcher(new OkHttpNetworkFetcher(okHttpClient)) .setDownsampleEnabled(true) .build(); Fresco.initialize(this, config); Context context = getApplicationContext(); String packageName = context.getPackageName(); String processName = getProcessName(android.os.Process.myPid()); CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(context); strategy.setUploadProcess(processName == null || processName.equals(packageName)); CrashReport.initCrashReport(getApplicationContext(), "0a6e92fb70", false, strategy); registerActivityLifecycleCallbacks(ActivityLifecycleHelper.build()); }
@Override public void onCreate() { super.onCreate(); // di if (appComponent == null) { appComponent = DaggerAppComponent.builder() .appModule(new AppModule(this)) .build(); } getAppComponent().inject(this); // fresco ImagePipelineConfig imagePipelineConfig = OkHttpImagePipelineConfigFactory.newBuilder(this, mOkHttpClient) .setDownsampleEnabled(true) .build(); Fresco.initialize(this, imagePipelineConfig); // logging if (BuildConfig.DEBUG) { Timber.plant(new ThreadAwareDebugTree()); } }
/** * 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()); }
/** * 初始化 */ public static void init(@NonNull Application application) { DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder(application) .setBaseDirectoryName(CACHE_DIR_NAME) .setBaseDirectoryPath(CacheUtil.getCacheDirectory(application, null)) .build(); ImagePipelineConfig config = ImagePipelineConfig.newBuilder(application) .setResizeAndRotateEnabledForNetwork(true) .setDownsampleEnabled(true) .setBitmapMemoryCacheParamsSupplier(new MemoryCacheParamsSupplier( (ActivityManager) application.getSystemService(Context.ACTIVITY_SERVICE))) // 内存缓存配置 .setMainDiskCacheConfig(diskCacheConfig) // 磁盘缓存配置 .setCacheKeyFactory(DefaultCacheKeyFactory.getInstance()) // 自定义缓存key .build(); Fresco.initialize(application, config); }
@Override public void onCreate() { super.onCreate(); CrashReport.initCrashReport(getApplicationContext(), "e1a62089c6", false); ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this) .setProgressiveJpegConfig(new SimpleProgressiveJpegConfig()) .build(); Fresco.initialize(this, config); SDKInitializer.initialize(this); Bmob.initialize(this, "b0cb494256d9b86fc931ca930a055b75"); Logger.addLogAdapter(new AndroidLogAdapter(){ @Override public boolean isLoggable(int priority, String tag) { return true;// TODO: 2017/6/5 } }); sInstance = this; initUser(); }
private void FrescoInit() { DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder(this) .setMaxCacheSize(40 * ByteConstants.MB) .setBaseDirectoryPathSupplier(new Supplier<File>() { @Override public File get() { return getCacheDir(); } }) .build(); final FrescoCacheParams bitmapCacheParams = new FrescoCacheParams(activityManager); //Set<RequestListener> listeners = new HashSet<>(); ImagePipelineConfig imagePipelineConfig = OkHttpImagePipelineConfigFactory.newBuilder(this, RetrofitClient.getInstance().getOkHttpClient()) .setMainDiskCacheConfig(diskCacheConfig) .setBitmapMemoryCacheParamsSupplier(bitmapCacheParams) .setDownsampleEnabled(true) .build(); Fresco.initialize(this, imagePipelineConfig); }
/** * Get the default Fresco configuration builder. * Allows adding of configuration options in addition to the default values. * * @return {@link ImagePipelineConfig.Builder} that has been initialized with default values */ public static ImagePipelineConfig.Builder getDefaultConfigBuilder(ReactContext context) { HashSet<RequestListener> requestListeners = new HashSet<>(); requestListeners.add(new SystraceRequestListener()); OkHttpClient client = OkHttpClientProvider.createClient(); // make sure to forward cookies for any requests via the okHttpClient // so that image requests to endpoints that use cookies still work CookieJarContainer container = (CookieJarContainer) client.cookieJar(); ForwardingCookieHandler handler = new ForwardingCookieHandler(context); container.setCookieJar(new JavaNetCookieJar(handler)); return OkHttpImagePipelineConfigFactory .newBuilder(context.getApplicationContext(), client) .setNetworkFetcher(new ReactOkHttpNetworkFetcher(client)) .setDownsampleEnabled(false) .setRequestListeners(requestListeners); }
private static ImagePipelineConfig getDefaultConfig( Context context, @Nullable RequestListener listener, @Nullable DiskCacheConfig diskCacheConfig) { HashSet<RequestListener> requestListeners = new HashSet<>(); requestListeners.add(new SystraceRequestListener()); if (listener != null) { requestListeners.add(listener); } OkHttpClient okHttpClient = OkHttpClientProvider.getOkHttpClient(); ImagePipelineConfig.Builder builder = OkHttpImagePipelineConfigFactory.newBuilder(context.getApplicationContext(), okHttpClient); builder .setDownsampleEnabled(false) .setRequestListeners(requestListeners); if (diskCacheConfig != null) { builder.setMainDiskCacheConfig(diskCacheConfig); } return builder.build(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder() .setBaseDirectoryPath(new File(Environment.getExternalStorageDirectory().getAbsoluteFile(), "Medlinker Pictures")) .setBaseDirectoryName("fresco") .setMaxCacheSize(Runtime.getRuntime().maxMemory() / 8) .build(); ImagePipelineConfig imagePipelineConfig = ImagePipelineConfig.newBuilder(this) .setMainDiskCacheConfig(diskCacheConfig) .setDownsampleEnabled(true) .build(); Fresco.initialize(this, imagePipelineConfig); setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, options)); }
/** * 初始化操作,建议在子线程中进行 * 添加的依赖: * compile 'com.facebook.fresco:fresco:0.10.0+' compile 'com.facebook.fresco:animated-webp:0.10.0' compile 'com.facebook.fresco:animated-gif:0.10.0' * @param context * @param cacheSizeInM 磁盘缓存的大小,以M为单位 */ public static void init(final Context context,int cacheSizeInM){ DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder(context) .setMaxCacheSize(cacheSizeInM*1024*1024) .setBaseDirectoryName(PHOTO_FRESCO) .setBaseDirectoryPathSupplier(new Supplier<File>() { @Override public File get() { return context.getCacheDir(); } }) .build(); MyImageCacheStatsTracker imageCacheStatsTracker = new MyImageCacheStatsTracker(); ImagePipelineConfig config = ImagePipelineConfig.newBuilder(context) .setMainDiskCacheConfig(diskCacheConfig) .setImageCacheStatsTracker(imageCacheStatsTracker) .setDownsampleEnabled(true)//Downsampling,它处理图片的速度比常规的裁剪更快, // 并且同时支持PNG,JPG以及WEP格式的图片,非常强大,与ResizeOptions配合使用 .setBitmapsConfig(Bitmap.Config.RGB_565) .build(); Fresco.initialize(context, config); }
@Override public void onCreate() { super.onCreate(); OkHttpClient okHttpClient = new OkHttpClient(); File sd = Environment.getExternalStorageDirectory(); String image = sd.getPath() + "/imageLoad"; //配置图片缓存目录 File cacheDir = new File(image); if (!cacheDir.exists()) { Log.i("App", "path:" + cacheDir.getAbsolutePath()); } //初始化Fresco,使用OkHttp3作为网络请求 ImagePipelineConfig.Builder configBuilder = FrescoConfig .getConfigBuilder(getApplicationContext(), cacheDir, okHttpClient); Fresco.initialize(this, configBuilder.build()); }
/** * initialize * * @param context context */ public static void initialize(Context context) { try { if (isInit) return; Class<?> clazz = Class.forName("com.facebook.imagepipeline.core.ImagePipelineConfig"); if (clazz != null) { ImagePipelineConfig config = ImagePipelineConfig.newBuilder(context) .setDownsampleEnabled(true) .build(); Fresco.initialize(context, config); isInit = true; } } catch (Exception e) { } }
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(); }
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); }
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; }
@Override public void onCreate() { super.onCreate(); init(); //初始化KLog KLog.init(BuildConfig.LOG_DEBUG); // fresco图片库的初始化 ImagePipelineConfig.Builder configBuilder = ImagePipelineConfig.newBuilder(this); ImagePipelineConfig imagePipelineConfig = configBuilder.build(); Fresco.initialize(this, imagePipelineConfig); /** * 如果存在SD卡则将缓存写入SD卡,否则写入手机内存 */ if (getApplicationContext().getExternalCacheDir() != null && ExistSDCard()) { cacheDir = getApplicationContext().getExternalCacheDir().toString(); } else { cacheDir = getApplicationContext().getCacheDir().toString(); } }
@Override public void onCreate() { super.onCreate(); applicationContext = this; /** * 设置 Fresco 图片缓存的路径 */ DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder(getApplicationContext()) .setBaseDirectoryPath(getOwnCacheDirectory(this, APP_CACHE_PATH)) .build(); ImagePipelineConfig config = ImagePipelineConfig.newBuilder(getApplicationContext()) .setMainDiskCacheConfig(diskCacheConfig) .setSmallImageDiskCacheConfig(diskCacheConfig) .build(); //初始化 Fresco 图片缓存库 Fresco.initialize(this, config); //初始化日志输出工具 JLog.initialize(BuildConfig.LOG_DEBUG); }
public void onCreate() { super.onCreate(); SMTHApplication.context = getApplicationContext(); // init IP lookup database geoDB = new GEODatabase(this); // Set<RequestListener> requestListeners = new HashSet<>(); // requestListeners.add(new RequestLoggingListener()); // init Fresco OkHttpClient httpClient = SMTHHelper.getInstance().mHttpClient; ImagePipelineConfig config = OkHttpImagePipelineConfigFactory.newBuilder(context, httpClient) // .setRequestListeners(requestListeners) // .setDownsampleEnabled(true) .build(); Fresco.initialize(context, config); // FLog.setMinimumLoggingLevel(FLog.VERBOSE); boolean bNightMode = Settings.getInstance().isNightMode(); if (bNightMode) { AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); } else { AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); } }
@Override public void onCreate() { super.onCreate(); sThis = this; // com.squareup.leakcanary.LeakCanary.install(this); initialize(this); // Glide.get(this).register(GlideUrl.class, InputStream.class, // new OkHttpUrlLoader.Factory(ApiFactory.getOkHttpClient(this))); ImagePipelineConfig config = OkHttpImagePipelineConfigFactory .newBuilder(this, ApiFactory.getOkHttpClient(this)) .build(); Fresco.initialize(this, config); if (true || OAuthUtils.haveToken(this)) { // Intent watchfaceLoader = new Intent(); // watchfaceLoader.setClass(this, BucketWatchFaceLoader.class); // startService(BucketWatchFaceLoader.getServiceIntent(this)); startService(FollowingCheckService.getServiceIntent(this)); } }
/** * 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()); }
@Override public void onCreate() { super.onCreate(); // Flog是自定义Log if (BuildConfig.DEBUG) { Flog.DebugTree tree = new Flog.DebugTree(); tree.setShowLine(false); // 是否打印类名和行号 Flog.plant(tree); } OkHttpClient okHttpClient = new OkHttpClient(); //配置Fresco ImagePipelineConfig config = OkHttpImagePipelineConfigFactory .newBuilder(this, okHttpClient) .build(); Fresco.initialize(this, config); Glide.get(this).register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(okHttpClient)); }
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); }
/** * 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()); }
/** * 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()); }