|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
T - The type of the model being loaded.R - The type of resource being loaded.public interface RequestListener<T,R>
A class for monitoring the status of a request while images load.
| Method Summary | |
|---|---|
boolean |
onException(Exception e,
T model,
Target<R> target,
boolean isFirstResource)
Called when an exception occurs during a load. |
boolean |
onResourceReady(R resource,
T model,
Target<R> target,
boolean isFromMemoryCache,
boolean isFirstResource)
Called when a load completes successfully, immediately after Target.onResourceReady(Object, com.bumptech.glide.request.animation.GlideAnimation). |
| Method Detail |
|---|
boolean onException(Exception e,
T model,
Target<R> target,
boolean isFirstResource)
Glide.load() to avoid object churn.
It is safe to reload this or a different model or change what is displayed in the target at this point. For example:
public void onException(Exception e, T model, Target target, boolean isFirstResource) {
target.setPlaceholder(R.drawable.a_specific_error_for_my_exception);
Glide.load(model).into(target);
}
Note - if you want to reload this or any other model after an exception, you will need to include all relevant builder calls (like centerCrop, placeholder etc).
e - The exception, or null.model - The model we were trying to load when the exception occurred.target - The Target we were trying to load the image into.isFirstResource - True if this exception is for the first resource to load.
boolean onResourceReady(R resource,
T model,
Target<R> target,
boolean isFromMemoryCache,
boolean isFirstResource)
Target.onResourceReady(Object, com.bumptech.glide.request.animation.GlideAnimation).
resource - The resource that was loaded for the target.model - The specific model that was used to load the image.target - The target the model was loaded into.isFromMemoryCache - True if the load completed synchronously (useful for determining whether or not to
animate)isFirstResource - True if this is the first resource to in this load to be loaded into the target. For
example when loading a thumbnail and a fullsize image, this will be true for the first
image to load and false for the second.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||