Java 类com.android.volley.RequestQueue.RequestFilter 实例源码

项目:FMTech    文件:FinskyApp.java   
private static void drain(RequestQueue paramRequestQueue, int paramInt)
{
  paramRequestQueue.cancelAll(new RequestQueue.RequestFilter()
  {
    public final boolean apply(Request<?> paramAnonymousRequest)
    {
      if ((paramAnonymousRequest instanceof DfeRequest))
      {
        if (((DfeRequest)paramAnonymousRequest).mAvoidBulkCancel) {
          return false;
        }
      }
      else if ((paramAnonymousRequest instanceof VendingRequest))
      {
        if (((VendingRequest)paramAnonymousRequest).mAvoidBulkCancel) {
          return false;
        }
      }
      else if ((paramAnonymousRequest instanceof EscrowRequest)) {
        return false;
      }
      return paramAnonymousRequest.getSequence() < this.val$seq;
    }
  });
}
项目:GeekZone    文件:BaseAPIHelper.java   
/**
 * 取消
 * @param method
 * @param api
 * @param urlParams
 * @param params
 */
public void cancel(final int method,
                   final int api,
                   final Object[] urlParams,
                   final Map<String, String> params) {
    final String targetUrl = buildUrl(method, api, urlParams, params);
    mRequestQueue.cancelAll(new RequestFilter() {
        @Override
        public boolean apply(Request<?> request) {
            return String.valueOf(request.getTag()) == targetUrl;
        }
    });
}
项目:GeekZone    文件:BaseAPIHelper.java   
/**
 * 取消所有请求
 */
public void cancel() {
    mRequestQueue.cancelAll(new RequestFilter() {
        @Override
        public boolean apply(Request<?> request) {
            return (request instanceof BaseRequest);
        }
    });
}
项目:ooooim_android    文件:CommonDataLoader.java   
/**
 * 取消所有请求.
 */
public void cancelAllRequest() {
    if (mRequestQueue != null) mRequestQueue.cancelAll(new RequestFilter() {
        @Override
        public boolean apply(Request<?> request) {
            return true;
        }
    });
}
项目:aibao_demo    文件:CommonDataLoader.java   
/**
 * 取消所有请求.
 */
public void cancelAllRequest() {
    if (mRequestQueue != null) mRequestQueue.cancelAll(new RequestFilter() {
        @Override
        public boolean apply(Request<?> request) {
            return true;
        }
    });
}
项目:info_demo    文件:CommonDataLoader.java   
/**
 * 取消所有请求.
 */
public void cancelAllRequest() {
    if (mRequestQueue != null) mRequestQueue.cancelAll(new RequestFilter() {
        @Override
        public boolean apply(Request<?> request) {
            return true;
        }
    });
}
项目:FMTech    文件:AddressEntryFragment.java   
public final void onDetach()
{
  super.onDetach();
  this.mOnRegionCodeSelectedListener = null;
  cancelPendingAdminAreaMetadataRetrievalRequest();
  getRequestQueue().cancelAll(new RequestQueue.RequestFilter()
  {
    public final boolean apply(Request<?> paramAnonymousRequest)
    {
      return paramAnonymousRequest instanceof CountryMetadataRetrievalTask.CountryMetadataRetrievalRequest;
    }
  });
}
项目:podio-android    文件:VolleyClient.java   
protected synchronized void clearRefreshQueue() {
    volleyRefreshQueue.cancelAll(new RequestFilter() {
        @Override
        public boolean apply(com.android.volley.Request<?> request) {
            return true;
        }
    });
}
项目:podio-android    文件:VolleyClient.java   
protected synchronized void clearRequestQueue() {
    volleyRequestQueue.cancelAll(new RequestFilter() {
        @Override
        public boolean apply(com.android.volley.Request<?> request) {
            return true;
        }
    });
}
项目:egg-android    文件:EggTaskCentral.java   
@Deprecated
public void cancelVolleyRquestByObject(final Object obj) {
    if (mVolleyQueue == null) {
        return;
    }
    mVolleyQueue.cancelAll(new RequestFilter() {
        @Override
        public boolean apply(Request<?> request) {
            if (request.getTag() != null && request.getTag() instanceof VolleyTag) {
                return ((VolleyTag) request.getTag()).object == obj;
            }
            return false;
        }
    });
}
项目:egg-android    文件:EggTaskCentral.java   
@Deprecated
public void cancelVolleyRequestAll() {
    if (mVolleyQueue == null) {
        return;
    }
    mVolleyQueue.cancelAll(new RequestFilter() {
        @Override
        public boolean apply(Request<?> request) {
            return true;
        }
    });
}
项目:GitHub    文件:VolleyNetworkFetcher.java   
@Override
public void fetch(final VolleyNetworkFetchState fetchState, final Callback callback) {
  fetchState.submitTime = SystemClock.elapsedRealtime();

  final RawRequest request = new RawRequest(
      fetchState.getUri().toString(),
      new Response.Listener<byte[]>() {
        @Override
        public void onResponse(byte[] bytes) {
          fetchState.responseTime = SystemClock.uptimeMillis();

          try {
            InputStream is = new ByteArrayInputStream(bytes);
            callback.onResponse(is, bytes.length);
          } catch (IOException e) {
            callback.onFailure(e);
          }
        }
      },
      new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError volleyError) {
          callback.onFailure(volleyError);
        }
      });

  fetchState.getContext().addCallbacks(
      new BaseProducerContextCallbacks() {
        @Override
        public void onCancellationRequested() {
          mRequestQueue.cancelAll(new RequestFilter() {
            @Override
            public boolean apply(Request<?> candidate) {
              return candidate != null && request.getSequence() == candidate.getSequence();
            }
          });
        }
      });

  mRequestQueue.add(request);
}
项目:fresco    文件:VolleyNetworkFetcher.java   
@Override
public void fetch(final VolleyNetworkFetchState fetchState, final Callback callback) {
  fetchState.submitTime = SystemClock.elapsedRealtime();

  final RawRequest request = new RawRequest(
      fetchState.getUri().toString(),
      new Response.Listener<byte[]>() {
        @Override
        public void onResponse(byte[] bytes) {
          fetchState.responseTime = SystemClock.uptimeMillis();

          try {
            InputStream is = new ByteArrayInputStream(bytes);
            callback.onResponse(is, bytes.length);
          } catch (IOException e) {
            callback.onFailure(e);
          }
        }
      },
      new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError volleyError) {
          callback.onFailure(volleyError);
        }
      });

  fetchState.getContext().addCallbacks(
      new BaseProducerContextCallbacks() {
        @Override
        public void onCancellationRequested() {
          mRequestQueue.cancelAll(new RequestFilter() {
            @Override
            public boolean apply(Request<?> candidate) {
              return candidate != null && request.getSequence() == candidate.getSequence();
            }
          });
        }
      });

  mRequestQueue.add(request);
}
项目:egg-android    文件:EggTaskCentral.java   
@Deprecated
public void cancelVolleyRequest(RequestFilter filter) {
    if (mVolleyQueue!=null) {
        mVolleyQueue.cancelAll(filter);
    }
}
项目:egg-android    文件:EggTaskCentral.java   
public void cancelRequestQueue(jp.egg.android.request2.okhttp.RequestQueue.RequestFilter filter) {
    if (mRequestQueue != null) {
        mRequestQueue.cancelAll(filter);
    }
}
项目:AcFun-Area63    文件:AcApp.java   
public static void cancelAllRequest(RequestFilter filter){
    mQueue.cancelAll(filter);
}