diff --git a/src/main/java/com/budiyev/android/imageloader/ImageLoader.java b/src/main/java/com/budiyev/android/imageloader/ImageLoader.java index f9a7f4f..a753355 100644 --- a/src/main/java/com/budiyev/android/imageloader/ImageLoader.java +++ b/src/main/java/com/budiyev/android/imageloader/ImageLoader.java @@ -106,7 +106,8 @@ private ImageLoader(@NonNull Context context, @NonNull BitmapLoader bitmapLoa */ @MainThread public void load(@NonNull T data, @NonNull ImageView view) { - load(new StringDataDescriptor<>(data), view); + load(new StringDataDescriptor<>(data), view, mLoadCallback, mDisplayCallback, + mErrorCallback); } /** @@ -117,6 +118,41 @@ public void load(@NonNull T data, @NonNull ImageView view) { */ @MainThread public void load(@NonNull DataDescriptor descriptor, @NonNull ImageView view) { + load(descriptor, view, mLoadCallback, mDisplayCallback, mErrorCallback); + } + + /** + * Load image into view from specified {@code data}, using default {@link DataDescriptor}, + * {@code data}'s toString() method will be used for key generation, any characters allowed, + * override callbacks, specified in builder + * + * @param data Source data + * @param view Image view + * @param loadCallback Load callback + * @param displayCallback Display callback + * @param errorCallback Error callback + */ + @MainThread + public void load(@NonNull T data, @NonNull ImageView view, + @Nullable LoadCallback loadCallback, @Nullable DisplayCallback displayCallback, + @Nullable ErrorCallback errorCallback) { + load(new StringDataDescriptor<>(data), view, loadCallback, displayCallback, errorCallback); + } + + /** + * Load image into view from specified {@link DataDescriptor}, + * override callbacks, specified in builder + * + * @param descriptor Source data descriptor + * @param view Image view + * @param loadCallback Load callback + * @param displayCallback Display callback + * @param errorCallback Error callback + */ + @MainThread + public void load(@NonNull DataDescriptor descriptor, @NonNull ImageView view, + @Nullable LoadCallback loadCallback, @Nullable DisplayCallback displayCallback, + @Nullable ErrorCallback errorCallback) { Bitmap image = null; String key = descriptor.getKey(); ImageCache memoryImageCache = mMemoryCache; @@ -138,8 +174,8 @@ public void load(@NonNull DataDescriptor descriptor, @NonNull ImageView view) Drawable placeholder = mPlaceholderProvider.get(context, descriptor.getData()); LoadImageAction action = new LoadImageAction<>(context, mMainThreadHandler, mExecutor, mPauseLock, - mBitmapLoader, mBitmapProcessor, mMemoryCache, mStorageCache, mLoadCallback, - mDisplayCallback, mErrorCallback, mFadeEnabled, mFadeDuration, descriptor, + mBitmapLoader, mBitmapProcessor, mMemoryCache, mStorageCache, loadCallback, + displayCallback, errorCallback, mFadeEnabled, mFadeDuration, descriptor, view, placeholder); view.setImageDrawable(new PlaceholderDrawable(placeholder, action)); action.execute();