Search in sources :

Example 1 with OkNetwork

use of im.amomo.volley.OkNetwork in project OkVolley by googolmo.

the class OkVolley method newRequestQueue.

public static RequestQueue newRequestQueue(Context context) {
    if (InstanceNetwork == null) {
        InstanceNetwork = new OkNetwork(getDefaultHttpStack());
    }
    if (InstanceCache == null) {
        File cache = context.getExternalCacheDir();
        if (cache == null) {
            cache = context.getCacheDir();
        }
        File cacheDir = new File(cache, DEFAULT_CACHE_DIR);
        InstanceCache = new DiskBasedCache(cacheDir);
    }
    RequestQueue queue = new RequestQueue(InstanceCache, InstanceNetwork);
    queue.start();
    return queue;
}
Also used : RequestQueue(com.android.volley.RequestQueue) OkNetwork(im.amomo.volley.OkNetwork) DiskBasedCache(com.android.volley.toolbox.DiskBasedCache) File(java.io.File)

Aggregations

RequestQueue (com.android.volley.RequestQueue)1 DiskBasedCache (com.android.volley.toolbox.DiskBasedCache)1 OkNetwork (im.amomo.volley.OkNetwork)1 File (java.io.File)1