/** Check weather this imageTask has cache Drawable data. */ public boolean queryCache(ImageTask imageTask, CubeImageView imageView) { if (null == mImageProvider) { return false; } BitmapDrawable drawable = mImageProvider.getBitmapFromMemCache(imageTask); if (imageTask.getStatistics() != null) { imageTask.getStatistics().s0_afterCheckMemoryCache(drawable != null); } if (drawable == null) { return false; } if (DEBUG) { CLog.d( LOG_TAG, MSG_HIT_CACHE, imageTask, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); } imageTask.addImageView(imageView); imageTask.onLoadTaskFinish(drawable, mImageLoadHandler); return true; }
/** * 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); }