Skip to content

Commit

Permalink
Relax request listener type requirements.
Browse files Browse the repository at this point in the history
Progress toward bumptech#213.
  • Loading branch information
sjudd committed Oct 23, 2014
1 parent a61f3e9 commit 688909e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ public BitmapRequestBuilder<ModelType, TranscodeType> error(Drawable drawable) {
*/
@Override
public BitmapRequestBuilder<ModelType, TranscodeType> listener(
RequestListener<ModelType, TranscodeType> requestListener) {
RequestListener<? super ModelType, TranscodeType> requestListener) {
super.listener(requestListener);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,8 @@ public DrawableRequestBuilder<ModelType> error(Drawable drawable) {
* {@inheritDoc}
*/
@Override
public DrawableRequestBuilder<ModelType> listener(RequestListener<ModelType, GlideDrawable> requestListener) {
public DrawableRequestBuilder<ModelType> listener(
RequestListener<? super ModelType, GlideDrawable> requestListener) {
super.listener(requestListener);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class GenericRequestBuilder<ModelType, DataType, ResourceType, TranscodeT
private boolean isModelSet;
private int placeholderId;
private int errorId;
private RequestListener<ModelType, TranscodeType> requestListener;
private RequestListener<? super ModelType, TranscodeType> requestListener;
private Float thumbSizeMultiplier;
private GenericRequestBuilder<?, ?, ?, TranscodeType> thumbnailRequestBuilder;
private Float sizeMultiplier = 1f;
Expand Down Expand Up @@ -474,7 +474,7 @@ public GenericRequestBuilder<ModelType, DataType, ResourceType, TranscodeType> e
* @return This request builder.
*/
public GenericRequestBuilder<ModelType, DataType, ResourceType, TranscodeType> listener(
RequestListener<ModelType, TranscodeType> requestListener) {
RequestListener<? super ModelType, TranscodeType> requestListener) {
this.requestListener = requestListener;

return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public GifRequestBuilder<ModelType> error(Drawable drawable) {
*/
@Override
public GifRequestBuilder<ModelType> listener(
RequestListener<ModelType, GifDrawable> requestListener) {
RequestListener<? super ModelType, GifDrawable> requestListener) {
super.listener(requestListener);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private enum Status {
private boolean isMemoryCacheable;
private Priority priority;
private Target<R> target;
private RequestListener<A, R> requestListener;
private RequestListener<? super A, R> requestListener;
private float sizeMultiplier;
private Engine engine;
private GlideAnimationFactory<R> animationFactory;
Expand Down Expand Up @@ -96,7 +96,7 @@ public static <A, T, Z, R> GenericRequest<A, T, Z, R> obtain(
int placeholderResourceId,
Drawable errorDrawable,
int errorResourceId,
RequestListener<A, R> requestListener,
RequestListener<? super A, R> requestListener,
RequestCoordinator requestCoordinator,
Engine engine,
Transformation<Z> transformation,
Expand Down Expand Up @@ -168,7 +168,7 @@ private void init(
int placeholderResourceId,
Drawable errorDrawable,
int errorResourceId,
RequestListener<A, R> requestListener,
RequestListener<? super A, R> requestListener,
RequestCoordinator requestCoordinator,
Engine engine,
Transformation<Z> transformation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ public void onClick(View view) {
.transcode(new BitmapToGlideDrawableTranscoder(this), GlideDrawable.class)
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
)
.listener(new RequestListener<String, GlideDrawable>() {
.listener(new RequestListener<Object, GlideDrawable>() {
@Override
public boolean onException(Exception e, String model, Target<GlideDrawable> target,
public boolean onException(Exception e, Object model, Target<GlideDrawable> target,
boolean isFirstResource) {
return false;
}

@Override
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target,
public boolean onResourceReady(GlideDrawable resource, Object model, Target<GlideDrawable> target,
boolean isFromMemoryCache, boolean isFirstResource) {
if (resource instanceof GifDrawable) {
gifDrawable = (GifDrawable) resource;
Expand Down

0 comments on commit 688909e

Please sign in to comment.