private static ImageLoader create(
      Context context,
      ImageProvider imageProvider,
      ImageTaskExecutor imageTaskExecutor,
      ImageReSizer imageReSizer,
      ImageLoadHandler imageLoadHandler) {

    if (imageProvider == null) {
      imageProvider = getDefaultImageProvider(context);
    }

    if (imageTaskExecutor == null) {
      imageTaskExecutor = DefaultImageTaskExecutor.getInstance();
    }

    if (imageReSizer == null) {
      imageReSizer = DefaultImageReSizer.getInstance();
    }

    if (imageLoadHandler == null) {
      imageLoadHandler = new DefaultImageLoadHandler(context);
    }
    ImageLoader imageLoader =
        new ImageLoader(context, imageProvider, imageTaskExecutor, imageReSizer, imageLoadHandler);

    if (sImageDownloader != null) {
      imageLoader.setImageDownloader(sImageDownloader);
    }
    return imageLoader;
  }
Example #2
0
 @Override
 public void onCancel() {
   if (DEBUG) {
     CLog.d(LOG_TAG, MSG_TASK_CANCEL, this, mImageTask);
   }
   mImageLoader.getImageProvider().cancelTask(mImageTask);
   mImageTask.onLoadTaskCancel();
   mImageLoader.mLoadWorkList.remove(mImageTask.getIdentityKey());
 }