Skip to content

Instantly share code, notes, and snippets.

@vsay01
Created May 13, 2018 13:41
Show Gist options
  • Save vsay01/7341e0f78f3330af91106bf42cb2e93a to your computer and use it in GitHub Desktop.
Save vsay01/7341e0f78f3330af91106bf42cb2e93a to your computer and use it in GitHub Desktop.
Glide.with(mContext)
.load(imageURL)
.asBitmap()
.transcode(new PaletteBitmapTranscoder(mContext), PaletteBitmap.class)
.fitCenter()
.placeholder(R.drawable.placeholder)
.error(R.drawable.placeholder_error)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(new ImageViewTarget<PaletteBitmap>(holder.imageView) {
@Override
protected void setResource(PaletteBitmap resource) {
super.view.setImageBitmap(resource.bitmap);
Palette p = resource.palette;
holder.mPaletteColor = p.getMutedColor(ContextCompat.getColor(mContext, R.color.default));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment