예제 #1
0
 /**
  * Detach the ImageView from the ImageTask.
  *
  * @param imageTask
  * @param imageView
  */
 public void detachImageViewFromImageTask(ImageTask imageTask, CubeImageView imageView) {
   imageTask.removeImageView(imageView);
   if (imageTask.isLoading()) {
     if (!imageTask.isPreLoad() && !imageTask.stillHasRelatedImageView()) {
       LoadImageTask task = mLoadWorkList.get(imageTask.getIdentityKey());
       if (task != null) {
         task.cancel();
       }
       if (DEBUG) {
         CLog.d(LOG_TAG, "%s previous work is cancelled.", imageTask);
       }
     }
   }
   if (!imageTask.stillHasRelatedImageView()) {
     imageTask.tryToRecycle();
   }
 }
예제 #2
0
  /** Drop all the work, clear the work list. */
  public void destroy() {
    if (DEBUG) {
      CLog.d(LOG_TAG, "work_status: destroy %s", this);
    }
    mExitTasksEarly = true;
    setPause(false);

    Iterator<Entry<String, LoadImageTask>> it =
        (Iterator<Entry<String, LoadImageTask>>) mLoadWorkList.entrySet().iterator();
    while (it.hasNext()) {
      Entry<String, LoadImageTask> item = it.next();
      final LoadImageTask task = item.getValue();
      it.remove();
      if (task != null) {
        task.cancel();
      }
    }
    mLoadWorkList.clear();
  }