Esempio n. 1
0
 @Override
 @SuppressWarnings("unchecked")
 protected void onUpdate(int flag, Object... args) {
   switch (flag) {
     case FLAG_CACHE:
       {
         synchronized (cacheLock) {
           try {
             if (tracker != null) {
               tracker.onCache(request);
             }
             trustCache = this.cacheCallback.onCache((ResultType) args[0]);
           } catch (Throwable ex) {
             trustCache = false;
             callback.onError(ex, true);
           } finally {
             cacheLock.notifyAll();
           }
         }
       }
     case FLAG_PROGRESS:
       {
         if (this.progressCallback != null && args.length == 3) {
           try {
             this.progressCallback.onLoading(
                 ((Number) args[0]).longValue(),
                 ((Number) args[1]).longValue(),
                 (Boolean) args[2]);
           } catch (Throwable ex) {
             callback.onError(ex, true);
           }
         }
       }
     default:
       {
         break;
       }
   }
 }