public static HttpResponseCache install(Context context) throws IOException { ResponseCache installed = ResponseCache.getDefault(); if (installed instanceof Closeable) { ((Closeable) installed).close(); } File directory = SystemUtils.getCacheDir(context, "http"); long maxSize = SystemUtils.calculateDiskCacheSize(directory, MIN_DISK_CACHE_SIZE, MAX_DISK_CACHE_SIZE); return new HttpResponseCache(android.net.http.HttpResponseCache.install(directory, maxSize)); }
private ImageLoader(Context context) { File directory = SystemUtils.getCacheDir(context, "picasso"); long diskSize = SystemUtils.calculateDiskCacheSize(directory, MIN_DISK_CACHE_SIZE, MAX_DISK_CACHE_SIZE); int memSize = SystemUtils.calculateMemoryCacheSize(context); this.cache = new ImageCache(directory, diskSize, memSize); this.picasso = new Builder(context) .downloader(new ImageDownloader(context.getApplicationContext())) .memoryCache(cache) .build(); picasso.setIndicatorsEnabled(false); }