Ejemplo n.º 1
0
 public static void cancelByContextRef(final Context context) {
   HttpUtils.getRequestQueue()
       .cancelAll(
           new RequestQueue.RequestFilter() {
             @Override
             public boolean apply(Request<?> request) {
               if (request.getTag() instanceof WeakReference) {
                 try {
                   WeakReference<Context> contextWeakReference =
                       (WeakReference<Context>) request.getTag();
                   return contextWeakReference.get() == context;
                 } catch (ClassCastException e) {
                   Log.e("Request %s is not tags with context", request.getUrl());
                   return false;
                 }
               }
               return false;
             }
           });
 }
Ejemplo n.º 2
0
 public static void init() {
   memoryCache = new ImageLruCache();
   drawableLoader = new DrawableLoader(HttpUtils.getRequestQueue(), memoryCache);
 }