示例#1
0
 public void cancelRequest() {
   if (this.mListener != null) {
     BatchedImageRequest request =
         (BatchedImageRequest) ImageLoader.this.mInFlightRequests.get(this.mCacheKey);
     if (request == null) {
       request = (BatchedImageRequest) ImageLoader.this.mBatchedResponses.get(this.mCacheKey);
       if (request != null) {
         request.removeContainerAndCancelIfNecessary(this);
         if (request.mContainers.size() == 0) {
           ImageLoader.this.mBatchedResponses.remove(this.mCacheKey);
         }
       }
     } else if (request.removeContainerAndCancelIfNecessary(this)) {
       ImageLoader.this.mInFlightRequests.remove(this.mCacheKey);
     }
   }
 }
示例#2
0
    /** Releases interest in the in-flight request (and cancels it if no one else is listening). */
    public void cancelRequest() {
      if (mListener == null) {
        return;
      }

      BatchedImageRequest request = mInFlightRequests.get(mCacheKey);
      if (request != null) {
        boolean canceled = request.removeContainerAndCancelIfNecessary(this);
        if (canceled) {
          mInFlightRequests.remove(mCacheKey);
        }
      } else {
        // check to see if it is already batched for delivery.
        request = mBatchedResponses.get(mCacheKey);
        if (request != null) {
          request.removeContainerAndCancelIfNecessary(this);
          if (request.mContainers.size() == 0) {
            mBatchedResponses.remove(mCacheKey);
          }
        }
      }
    }