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