Skip to content

Instantly share code, notes, and snippets.

@rezaiyan
Created October 2, 2017 06:43
Show Gist options
  • Save rezaiyan/cfd87a0a88c13839617340c910623b7d to your computer and use it in GitHub Desktop.
Save rezaiyan/cfd87a0a88c13839617340c910623b7d to your computer and use it in GitHub Desktop.
Load image with glide sample
Glide.with(context).load(Api.getPosterPath(holder.movie.getPosterPath()))
.asBitmap()
.diskCacheStrategy(DiskCacheStrategy.RESULT)
.into(new BitmapImageViewTarget(holder.poster)
{
@Override
public void onResourceReady(Bitmap bitmap, GlideAnimation anim)
{
super.onResourceReady(bitmap, anim);
Palette.from(bitmap).generate(new Palette.PaletteAsyncListener()
{
@Override
public void onGenerated(Palette palette)
{
holder.titleBackground.setBackgroundColor(palette.getVibrantColor(context
.getResources().getColor(R.color.black_translucent_60)));
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment