/**
  * @return <b>true</b> - if current ImageAware is reused for displaying another image;
  *     <b>false</b> - otherwise
  */
 private boolean isViewReused() {
   String currentCacheKey = engine.getLoadingUriForView(imageAware);
   // Check whether memory cache key (image URI) for current ImageAware is actual.
   // If ImageAware is reused for another task then current task should be cancelled.
   boolean imageAwareWasReused = !memoryCacheKey.equals(currentCacheKey);
   if (imageAwareWasReused) {
     log(LOG_TASK_CANCELLED_IMAGEAWARE_REUSED);
     return true;
   }
   return false;
 }
  /**
   * Check whether the image URI of this task matches to image URI which is actual for current
   * ImageView at this moment and fire {@link ImageLoadingListener#onLoadingCancelled()} event if it
   * doesn't.
   */
  private boolean checkTaskIsNotActual() {
    String currentCacheKey = engine.getLoadingUriForView(imageView);
    // Check whether memory cache key (image URI) for current ImageView is actual.
    // If ImageView is reused for another task then current task should be cancelled.
    boolean imageViewWasReused = !memoryCacheKey.equals(currentCacheKey);
    if (imageViewWasReused) {
      handler.post(
          new Runnable() {
            @Override
            public void run() {
              listener.onLoadingCancelled();
            }
          });
    }

    if (imageViewWasReused) log(LOG_TASK_CANCELLED, memoryCacheKey);
    return imageViewWasReused;
  }
Пример #3
0
 /** Returns URI of image which is loading at this moment into passed {@link ImageView} */
 public String getLoadingUriForView(ImageView imageView) {
   return engine.getLoadingUriForView(imageView);
 }
 /**
  * Returns URI of image which is loading at this moment into passed {@link
  * android.widget.ImageView ImageView}
  */
 public String getLoadingUriForView(ImageView imageView) {
   return engine.getLoadingUriForView(new ImageViewAware(imageView));
 }
 /**
  * Returns URI of image which is loading at this moment into passed {@link
  * com.nostra13.universalimageloader.core.imageaware.ImageAware ImageAware}
  */
 public String getLoadingUriForView(ImageAware imageAware) {
   return engine.getLoadingUriForView(imageAware);
 }