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