-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed API: Added params to ImageLoadingListener callbacks
(String imageUri, Object extra) (#130) Introduced DisplayImageOptions.extraForListener(Object extra)
- Loading branch information
Showing
7 changed files
with
128 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 9 additions & 9 deletions
18
library/src/com/nostra13/universalimageloader/core/assist/FailReason.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package com.nostra13.universalimageloader.core.assist; | ||
|
||
/** | ||
* Presents the reason why image loading and displaying was failed | ||
* | ||
* @author Sergey Tarasevich (nostra13[at]gmail[dot]com) | ||
*/ | ||
public enum FailReason { | ||
IO_ERROR, OUT_OF_MEMORY, UNKNOWN | ||
package com.nostra13.universalimageloader.core.assist; | ||
|
||
/** | ||
* Presents the reason why image loading and displaying was failed | ||
* | ||
* @author Sergey Tarasevich (nostra13[at]gmail[dot]com) | ||
*/ | ||
public enum FailReason { | ||
IO_ERROR, OUT_OF_MEMORY, UNKNOWN | ||
} |
82 changes: 55 additions & 27 deletions
82
library/src/com/nostra13/universalimageloader/core/assist/ImageLoadingListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,55 @@ | ||
package com.nostra13.universalimageloader.core.assist; | ||
|
||
import android.graphics.Bitmap; | ||
import android.widget.ImageView; | ||
|
||
/** | ||
* Listener for image loading process.<br /> | ||
* You can use {@link SimpleImageLoadingListener} for implementing only needed methods. | ||
* | ||
* @author Sergey Tarasevich (nostra13[at]gmail[dot]com) | ||
* @see SimpleImageLoadingListener | ||
* @see FailReason | ||
*/ | ||
public interface ImageLoadingListener { | ||
|
||
/** Is called when image loading task was started */ | ||
void onLoadingStarted(); | ||
|
||
/** Is called when an error was occurred during image loading */ | ||
void onLoadingFailed(FailReason failReason); | ||
|
||
/** Is called when image is loaded successfully and displayed in {@link ImageView} */ | ||
void onLoadingComplete(Bitmap loadedImage); | ||
|
||
/** Is called when image loading task was cancelled because {@link ImageView} was reused in newer task */ | ||
void onLoadingCancelled(); | ||
} | ||
package com.nostra13.universalimageloader.core.assist; | ||
|
||
import android.graphics.Bitmap; | ||
import android.widget.ImageView; | ||
|
||
import com.nostra13.universalimageloader.core.DisplayImageOptions; | ||
|
||
/** | ||
* Listener for image loading process.<br /> | ||
* You can use {@link SimpleImageLoadingListener} for implementing only needed methods. | ||
* | ||
* @author Sergey Tarasevich (nostra13[at]gmail[dot]com) | ||
* @see SimpleImageLoadingListener | ||
* @see FailReason | ||
*/ | ||
public interface ImageLoadingListener { | ||
|
||
/** | ||
* Is called when image loading task was started | ||
* | ||
* @param imageUri Loading image URI | ||
* @param extra Auxiliary object which was passed to {@link DisplayImageOptions.Builder#extraForListener(Object) | ||
* DisplayImageOptions.extraForListener(Object)} | ||
*/ | ||
void onLoadingStarted(String imageUri, Object extra); | ||
|
||
/** | ||
* Is called when an error was occurred during image loading | ||
* | ||
* @param imageUri Loading image URI | ||
* @param extra Auxiliary object which was passed to {@link DisplayImageOptions.Builder#extraForListener(Object) | ||
* DisplayImageOptions.extraForListener(Object)} | ||
* @param failReason {@linkplain FailReason The reason} why image loading was failed | ||
*/ | ||
void onLoadingFailed(String imageUri, Object extra, FailReason failReason); | ||
|
||
/** | ||
* Is called when image is loaded successfully (and displayed in {@link ImageView} if one was specified) | ||
* | ||
* @param imageUri Loaded image URI | ||
* @param extra Auxiliary object which was passed to {@link DisplayImageOptions.Builder#extraForListener(Object) | ||
* DisplayImageOptions.extraForListener(Object)} | ||
* @param loadedImage Bitmap of loaded and decoded image | ||
*/ | ||
void onLoadingComplete(String imageUri, Object extra, Bitmap loadedImage); | ||
|
||
/** | ||
* Is called when image loading task was cancelled because {@link ImageView} was reused in newer task | ||
* | ||
* @param imageUri Loading image URI | ||
* @param extra Auxiliary object which was passed to {@link DisplayImageOptions.Builder#extraForListener(Object) | ||
* DisplayImageOptions.extraForListener(Object)} | ||
*/ | ||
void onLoadingCancelled(String imageUri, Object extra); | ||
} |
62 changes: 31 additions & 31 deletions
62
library/src/com/nostra13/universalimageloader/core/assist/SimpleImageLoadingListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
package com.nostra13.universalimageloader.core.assist; | ||
|
||
import android.graphics.Bitmap; | ||
|
||
/** | ||
* A convenience class to extend when you only want to listen for a subset of all the image loading events. This | ||
* implements all methods in the {@link ImageLoadingListener} but does nothing. | ||
* | ||
* @author Sergey Tarasevich (nostra13[at]gmail[dot]com) | ||
*/ | ||
public class SimpleImageLoadingListener implements ImageLoadingListener { | ||
@Override | ||
public void onLoadingStarted() { | ||
// Empty implementation | ||
} | ||
|
||
@Override | ||
public void onLoadingFailed(FailReason failReason) { | ||
// Empty implementation | ||
} | ||
|
||
@Override | ||
public void onLoadingComplete(Bitmap loadedImage) { | ||
// Empty implementation | ||
} | ||
|
||
@Override | ||
public void onLoadingCancelled() { | ||
// Empty implementation | ||
} | ||
} | ||
package com.nostra13.universalimageloader.core.assist; | ||
|
||
import android.graphics.Bitmap; | ||
|
||
/** | ||
* A convenient class to extend when you only want to listen for a subset of all the image loading events. This | ||
* implements all methods in the {@link ImageLoadingListener} but does nothing. | ||
* | ||
* @author Sergey Tarasevich (nostra13[at]gmail[dot]com) | ||
*/ | ||
public class SimpleImageLoadingListener implements ImageLoadingListener { | ||
@Override | ||
public void onLoadingStarted(String imageUri, Object extra) { | ||
// Empty implementation | ||
} | ||
|
||
@Override | ||
public void onLoadingFailed(String imageUri, Object extra, FailReason failReason) { | ||
// Empty implementation | ||
} | ||
|
||
@Override | ||
public void onLoadingComplete(String imageUri, Object extra, Bitmap loadedImage) { | ||
// Empty implementation | ||
} | ||
|
||
@Override | ||
public void onLoadingCancelled(String imageUri, Object extra) { | ||
// Empty implementation | ||
} | ||
} |