Exemple #1
0
 @Override
 protected void onCancelled(Callback.CancelledException cex) {
   if (tracker != null) {
     tracker.onCancelled(request);
   }
   callback.onCancelled(cex);
 }
Exemple #2
0
 @Override
 protected void onError(Throwable ex, boolean isCallbackError) {
   if (tracker != null) {
     tracker.onError(request, ex, isCallbackError);
   }
   callback.onError(ex, isCallbackError);
 }
Exemple #3
0
 @Override
 protected void onFinished() {
   if (tracker != null) {
     tracker.onFinished(request);
   }
   clearRawResult();
   IOUtil.closeQuietly(request);
   callback.onFinished();
 }
Exemple #4
0
 @Override
 protected void onSuccess(ResultType result) {
   if (tracker != null) {
     tracker.onSuccess(request);
   }
   if (result != null) {
     callback.onSuccess(result);
   }
 }
Exemple #5
0
 @Override
 protected void onStarted() {
   if (tracker != null) {
     tracker.onStart(request);
   }
   if (progressCallback != null) {
     progressCallback.onStarted();
   }
 }
Exemple #6
0
 @Override
 protected void onWaiting() {
   if (tracker != null) {
     tracker.onWaiting(request);
   }
   if (progressCallback != null) {
     progressCallback.onWaiting();
   }
 }
Exemple #7
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;
       }
   }
 }