-
-
Save anonymous/ccef4ceff58275fcb51b70b8f2074207 to your computer and use it in GitHub Desktop.
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
void bind(String url, DrawableRequestBuilder<String> thumbnailRequest) { | |
target.setModel(url); // update target's cache | |
Glide.with(imageView.getContext()) | |
.load(url) | |
.diskCacheStrategy(DiskCacheStrategy.SOURCE) | |
.listener(new RequestListener<String, GlideDrawable>() { | |
@Override | |
public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) { | |
if (BuildConfig.DEBUG) | |
Log.e("IMAGE_EXCEPTION", "Exception " + e.toString()); | |
return false; | |
} | |
@Override | |
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) { | |
return false; | |
} | |
}) | |
// .placeholder(R.drawable.github_232_progress) | |
.thumbnail(thumbnailRequest) | |
.centerCrop() // needs explicit transformation, because we're using a custom target | |
.into(target) | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment