Java 类com.android.volley.ResponseDelivery 实例源码

项目:Goalie_Android    文件:BaseTest.java   
private RequestQueue newVolleyRequestQueueForTest(final Context context) {
    File cacheDir = new File(context.getCacheDir(), "cache/volley");
    Network network = new BasicNetwork(new HurlStack());
    ResponseDelivery responseDelivery = new ExecutorDelivery(Executors.newSingleThreadExecutor());
    RequestQueue queue = new RequestQueue(new DiskBasedCache(cacheDir), network, 4, responseDelivery);
    queue.start();

    return queue;
}
项目:SaveVolley    文件:RequestQueueTest.java   
@Test public void publicMethods() throws Exception {
    // Catch-all test to find API-breaking changes.
    assertNotNull(RequestQueue.class.getConstructor(Cache.class, Network.class, int.class,
            ResponseDelivery.class));
    assertNotNull(RequestQueue.class.getConstructor(Cache.class, Network.class, int.class));
    assertNotNull(RequestQueue.class.getConstructor(Cache.class, Network.class));

    assertNotNull(RequestQueue.class.getMethod("start"));
    assertNotNull(RequestQueue.class.getMethod("stop"));
    assertNotNull(RequestQueue.class.getMethod("getSequenceNumber"));
    assertNotNull(RequestQueue.class.getMethod("getCache"));
    assertNotNull(RequestQueue.class.getMethod("cancelAll", RequestQueue.RequestFilter.class));
    assertNotNull(RequestQueue.class.getMethod("cancelAll", Object.class));
    assertNotNull(RequestQueue.class.getMethod("add", Request.class));
    assertNotNull(RequestQueue.class.getDeclaredMethod("finish", Request.class));
}
项目:payments-Android-SDK    文件:ApiInvoker.java   
public static void initializeInstance(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery, int connectionTimeout) {
  INSTANCE = new ApiInvoker(cache, network, threadPoolSize, delivery, connectionTimeout);
  setUserAgent("Swagger-Codegen/1.0.0/android");

  // Setup authentications (key: authentication name, value: authentication).
  INSTANCE.authentications = new HashMap<String, Authentication>();
  // Prevent the authentications from being modified.
  INSTANCE.authentications = Collections.unmodifiableMap(INSTANCE.authentications);
}
项目:swaggy-jenkins    文件:ApiInvoker.java   
public static void initializeInstance(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery, int connectionTimeout) {
  INSTANCE = new ApiInvoker(cache, network, threadPoolSize, delivery, connectionTimeout);
  setUserAgent("Swagger-Codegen/1.0.0/android");

  // Setup authentications (key: authentication name, value: authentication).
  INSTANCE.authentications = new HashMap<String, Authentication>();
  INSTANCE.authentications.put("jenkins_auth", new HttpBasicAuth());
  // Prevent the authentications from being modified.
  INSTANCE.authentications = Collections.unmodifiableMap(INSTANCE.authentications);
}
项目:ef-app_android    文件:ApiInvoker.java   
public static void initializeInstance(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery, int connectionTimeout) {
   INSTANCE = new ApiInvoker(cache, network, threadPoolSize, delivery, connectionTimeout);
   setUserAgent("Swagger-Codegen/1.0.0/android");

   // Setup authentications (key: authentication name, value: authentication).
   INSTANCE.authentications = new HashMap<String, Authentication>();
   INSTANCE.authentications.put("Bearer", new ApiKeyAuth("header", "Authorization"));
   // Prevent the authentications from being modified.
   INSTANCE.authentications = Collections.unmodifiableMap(INSTANCE.authentications);
}
项目:wasp    文件:WaspTest.java   
public WaspTest() throws Exception {
  File cacheDir = new File(context.getCacheDir(), "volley");
  Network network = new BasicNetwork(new OkHttpStack(new OkHttpClient()));
  ResponseDelivery delivery = new ExecutorDelivery(executor);
  requestQueue = new RequestQueue(new DiskBasedCache(cacheDir), network, 4, delivery);
  requestQueue.start();

  server.start();
}
项目:eManga    文件:SmartRequestQueue.java   
/**
 * Creates the worker pool. Processing will not begin until {@link #start()} is called.
 *
 * @param cache A Cache to use for persisting responses to disk
 * @param network A Network interface for performing HTTP requests
 * @param threadPoolSize Number of network dispatcher threads to create
 * @param delivery A ResponseDelivery interface for posting responses and errors
 */
public SmartRequestQueue(Cache cache, Network network, int threadPoolSize,
                    ResponseDelivery delivery) {
    super(cache, network, threadPoolSize, delivery);
    mCache = cache;
    mNetwork = network;
    mDispatchers = new NetworkDispatcher[threadPoolSize];
    mDelivery = delivery;
}
项目:payments-Android-SDK    文件:ApiInvoker.java   
private void initConnectionRequest(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery) {
  mRequestQueue = new RequestQueue(cache, network, threadPoolSize, delivery);
  mRequestQueue.start();
}
项目:swaggy-jenkins    文件:ApiInvoker.java   
private void initConnectionRequest(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery) {
  mRequestQueue = new RequestQueue(cache, network, threadPoolSize, delivery);
  mRequestQueue.start();
}
项目:SimpleRESTClientHandler    文件:RestClientManager.java   
public static RestClientManager initialize(Context context, ResponseDelivery responseDelivery)
{
    sInstance = new RestClientManager(context, responseDelivery);

    return sInstance;
}
项目:ef-app_android    文件:ApiInvoker.java   
private void initConnectionRequest(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery) {
   mRequestQueue = new RequestQueue(cache, network, threadPoolSize, delivery);
   mRequestQueue.start();
}
项目:android-project-template    文件:ContentResolverRequestQueue.java   
public ContentResolverRequestQueue(@NonNull Cache cache, @NonNull ContentResolverNetwork network, int threadPoolSize, ResponseDelivery delivery) {
    super(cache, network, threadPoolSize, delivery);
}
项目:SimpleRESTClientHandler    文件:VolleyHelper.java   
public static RequestQueue newRequestQueue(Context context, ResponseDelivery responseDelivery)
{
    File cacheDir = new File(context.getCacheDir(), DEFAULT_CACHE_DIR);

    Network network = new BasicNetwork(new HurlStack());

    RequestQueue requestQueue = new RequestQueue(new DiskBasedCache(cacheDir), network, DEFAULT_NETWORK_THREAD_POOL_SIZE, responseDelivery);

    requestQueue.start();

    return requestQueue;
}
项目:SimpleRESTClientHandler    文件:RestClientManager.java   
/**
 * Method used to create a queue that uses a custom response delivery.
 *
 * @param context          the context the manager will use to create de queue (Use application context in the application initialization)
 * @param responseDelivery this can be used to execute calls in a worker or a main thread. Be careful with it's usage since it can generate a blocking thread and this can lead to a poor performance of your app.
 *                         Consider using a SingleThreadExecutor to perform Async tests in your unit testing clases.
 *                         <p/>
 *                         Example: new ExecutorDelivery(Executors.newSingleThreadExecutor())
 */
private RestClientManager(Context context, ResponseDelivery responseDelivery)
{
    mContext = context;
    mRequestQueue = VolleyHelper.newRequestQueue(mContext, responseDelivery);
}