/** Recover the from the work list */ public void recoverWork() { if (DEBUG) { CLog.d(LOG_TAG, "work_status: recoverWork %s", this); } mExitTasksEarly = false; setPause(false); Iterator<Entry<String, LoadImageTask>> it = (Iterator<Entry<String, LoadImageTask>>) mLoadWorkList.entrySet().iterator(); while (it.hasNext()) { Entry<String, LoadImageTask> item = it.next(); LoadImageTask task = item.getValue(); task.restart(); mImageTaskExecutor.execute(task); } }
/** * Add the ImageTask into loading list. * * @param imageTask * @param imageView */ public void addImageTask(ImageTask imageTask, CubeImageView imageView) { if (!mHasBeenAddedToComponentManager) { CLog.w(LOG_TAG, "ImageLoader has not been add to a Component Manager.", this); } LoadImageTask runningTask = mLoadWorkList.get(imageTask.getIdentityKey()); if (runningTask != null) { if (imageView != null) { if (DEBUG) { CLog.d(LOG_TAG, MSG_ATTACK_TO_RUNNING_TASK, imageTask, runningTask.getImageTask()); } runningTask.getImageTask().addImageView(imageView); runningTask.getImageTask().notifyLoading(mImageLoadHandler, imageView); } return; } else { imageTask.addImageView(imageView); } imageTask.onLoading(mImageLoadHandler); LoadImageTask loadImageTask = createLoadImageTask(imageTask); mLoadWorkList.put(imageTask.getIdentityKey(), loadImageTask); mImageTaskExecutor.execute(loadImageTask); }