Skip to content

Commit

Permalink
Check for presence but not equality of RequestListener in isEquivalentTo
Browse files Browse the repository at this point in the history
More progress toward #2270.
  • Loading branch information
sjudd committed Oct 13, 2017
1 parent 890454a commit 95caa05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions library/src/main/java/com/bumptech/glide/RequestBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,9 @@ private <Y extends Target<TranscodeType>> Y into(@NonNull Y target, RequestOptio
// restart the request, giving it another chance to complete. If the request is already
// running, we can let it continue running without interruption.
if (!Preconditions.checkNotNull(previous).isRunning()) {
// Use the previous request rather than the new one to allow for optimizations like skipping
// setting placeholders, tracking and untracking Targets, and obtaining View dimensions that
// are done in the individual Request.
previous.begin();
}
return target;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,11 @@ public boolean isEquivalentTo(Request o) {
&& Util.bothModelsNullEquivalentOrEquals(model, that.model)
&& transcodeClass.equals(that.transcodeClass)
&& requestOptions.equals(that.requestOptions)
&& priority == that.priority;
&& priority == that.priority
// We do not want to require that RequestListeners implement equals/hashcode, so we don't
// compare them using equals(). We can however, at least assert that the request listener
// is either present or not present in both requests.
&& requestListener != null ? that.requestListener != null : that.requestListener == null;
}
return false;
}
Expand Down

0 comments on commit 95caa05

Please sign in to comment.