Decreased volley cache site, reduce startup time.

The startup time needs to be fixed another time.
captchafix
Florens Douwes 11 years ago
parent e3d56facce
commit c345bfd40e
  1. 7
      Clover/app/src/main/java/com/android/volley/toolbox/Volley.java
  2. 3
      Clover/app/src/main/java/org/floens/chan/ChanApplication.java

@ -45,6 +45,10 @@ public class Volley {
}
public static RequestQueue newRequestQueue(Context context, HttpStack stack, File cacheDir) {
return newRequestQueue(context, stack, cacheDir, -1);
}
public static RequestQueue newRequestQueue(Context context, HttpStack stack, File cacheDir, int diskCacheSize) {
String userAgent = "volley/0";
try {
String packageName = context.getPackageName();
@ -65,7 +69,8 @@ public class Volley {
Network network = new BasicNetwork(stack);
RequestQueue queue = new RequestQueue(new DiskBasedCache(cacheDir), network);
DiskBasedCache diskCache = diskCacheSize < 0 ? new DiskBasedCache(cacheDir) : new DiskBasedCache(cacheDir, diskCacheSize);
RequestQueue queue = new RequestQueue(diskCache, network);
queue.start();
return queue;

@ -47,6 +47,7 @@ public class ChanApplication extends Application {
private static final long FILE_CACHE_DISK_SIZE = 50 * 1024 * 1024; // 50mb
private static final String FILE_CACHE_NAME = "filecache";
private static final int VOLLEY_LRU_CACHE_SIZE = 8 * 1024 * 1024; // 8mb
private static final int VOLLEY_CACHE_SIZE = 20 * 1024 * 1024; // 8mb
private static ChanApplication instance;
private static RequestQueue volleyRequestQueue;
@ -127,7 +128,7 @@ public class ChanApplication extends Application {
File cacheDir = getExternalCacheDir() != null ? getExternalCacheDir() : getCacheDir();
volleyRequestQueue = Volley.newRequestQueue(this, null, new File(cacheDir, Volley.DEFAULT_CACHE_DIR));
volleyRequestQueue = Volley.newRequestQueue(this, null, new File(cacheDir, Volley.DEFAULT_CACHE_DIR), VOLLEY_CACHE_SIZE);
imageLoader = new ImageLoader(volleyRequestQueue, new BitmapLruImageCache(VOLLEY_LRU_CACHE_SIZE));
fileCache = new FileCache(new File(cacheDir, FILE_CACHE_NAME), FILE_CACHE_DISK_SIZE);

Loading…
Cancel
Save