Skip to content

Instantly share code, notes, and snippets.

@omarmiatello
Created November 4, 2013 14:36
Show Gist options
  • Save omarmiatello/7303375 to your computer and use it in GitHub Desktop.
Save omarmiatello/7303375 to your computer and use it in GitHub Desktop.
package com.neosperience.egea;
import android.app.Application;
import android.graphics.Bitmap;
import com.neosperience.egea.utils.volleytoolbox.ImageCacheManager;
import com.neosperience.egea.utils.volleytoolbox.RequestManager;
/**
* Created by Omar on 03/09/13.
*/
public class EgeaApplication extends Application {
private static int DISK_IMAGECACHE_SIZE = 1024*1024*10;
private static Bitmap.CompressFormat DISK_IMAGECACHE_COMPRESS_FORMAT = Bitmap.CompressFormat.PNG;
private static int DISK_IMAGECACHE_QUALITY = 100; //PNG is lossless so quality is ignored but must be provided
@Override
public void onCreate() {
super.onCreate();
init();
}
/**
* Intialize the request manager and the image cache
*/
private void init() {
RequestManager.init(this);
createImageCache();
}
/**
* Create the image cache. Uses Memory Cache by default. Change to Disk for a Disk based LRU implementation.
*/
private void createImageCache(){
ImageCacheManager.getInstance().init(this,
this.getPackageCodePath()
, DISK_IMAGECACHE_SIZE
, DISK_IMAGECACHE_COMPRESS_FORMAT
, DISK_IMAGECACHE_QUALITY
, ImageCacheManager.CacheType.DISK);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment