示例#1
0
 // main thread
 private void setToConsumer(final ImageConsumer consumer, final ImageResult result) {
   if (consumer.currentLoader == this) {
     imagesManager.setResultImage(consumer, result, true);
   } else {
     if (imagesManager.debug) {
       Log.d(TAG, "Skip set for " + consumer);
     }
   }
 }
示例#2
0
  // main thread
  public boolean addTarget(final ImageConsumer imageHolder) {
    if (future.isCancelled()) {
      return false;
    } // we should start a new task

    imageHolder.onStart(this, request.url);

    synchronized (targets) {
      if (result != null) {
        imagesManager.setResultImage(imageHolder, result, false);
        imageHolder.onFinish(request.url, result);
      } else if (error != null) {
        imageHolder.onError(request.url, error);
      } else {
        imageHolder.currentLoader = this;
        targets.add(imageHolder);
      }
    }

    return true;
  }