Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowing to force the loading of the image on targets even if the same m... #39

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions library/src/com/bumptech/glide/Glide.java
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ public static class Request<T> {
private Downsampler downsampler = Downsampler.AT_LEAST;
private ArrayList<TransformationLoader<T>> transformationLoaders = new ArrayList<TransformationLoader<T>>();
private RequestListener<T> requestListener;
private boolean force;

private Request(T model) {
this(model, GLIDE.getFactory(model));
Expand Down Expand Up @@ -656,6 +657,16 @@ public Request<T> listener(RequestListener<T> requestListener) {
return this;
}

/**
* Calling this will force the image to be loaded regardless of weather it has been loaded before in the same
* target.
* @return This request.
*/
public Request<T> force() {
this.force = true;
return this;
}

/**
* Start loading the image into the view.
*
Expand Down Expand Up @@ -700,6 +711,9 @@ private void finish(Context context, Target target) {
this.target = target;

ImagePresenter<T> imagePresenter = getImagePresenter(target);
if (force) {
imagePresenter.clear();
}
imagePresenter.setModel(model);
}

Expand Down