I switch from Picasso to Glade. Everything works fine, but I can't find a way to get the error callback. I want to get a Bitmap, transfer it and generate an Android Palette. Also, while errorDrawable can be provided to the load call, it will not display in onResourceReady when using SimpleTarget .
In Picasso, I did it like this:
target = new Target() { @Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { //handle Bitmap, generate Palette etc. } @Override public void onBitmapFailed(final Drawable errorDrawable) { // use errorDrawable to generate Palette } @Override public void onPrepareLoad(final Drawable placeHolderDrawable) { } }; int width = (int) DisplayUnitsConverter.dpToPx(this, 120); int height = (int) DisplayUnitsConverter.dpToPx(this, 40); Picasso.with(this).load(config.getPathToLogo()).resize(width, height).error(errorDrawableId).into(target);
My rolling code is as follows:
Glide.with(context) .load(config.getPathToLogo()) .asBitmap() .into(new SimpleTarget<Bitmap>(width, height) { @Override public void onResourceReady(Bitmap resource, GlideAnimation glideAnimation) {
Thanks.
source share