Code Monkey home page Code Monkey logo

Comments (4)

akohout avatar akohout commented on June 6, 2024

I was able to overcome this problem by using a custom Target when setting the loaded image in the CircleImageView:

Picasso.with(context)
                .load(url)
                .placeholder(placeholderId)
                .error(placeholderId)
                .into(new Target(){

                          @Override
                          public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
                              imageView.setImageDrawable(
                                      new
                                              BitmapDrawable
                                              (context.getResources(), bitmap));
                          }

                          @Override
                          public void onBitmapFailed(final Drawable errorDrawable) {
                              Log.d("TAG", "FAILED");
                          }

                          @Override
                          public void onPrepareLoad(final Drawable placeHolderDrawable) {
                              Log.d("TAG", "Prepare Load");
                          }
                      });

instead of just using

Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(imageView);

from circleimageview.

hdodenhof avatar hdodenhof commented on June 6, 2024

If you are using Picasso without the noFade() option, this is probably the same issue as #3. When Picasso finished loading, it replaces the placeholder in the ImageView with the actual image but with an alpha value of 0 and then starts fading it in. The fadein is handled within the PicassoDrawable and there is no way for the ImageView to realize it has to refresh. When you scroll the view out of the viewport and then back in, Picasso starts loading again, realizes that the image is cached in memory and skips the placeholder - that's why it work's in that case.

My suggested solution in #3 is exactly what you did. If you want to keep the fadein animation, you could place the necessary code in onBitmapLoaded instead of just using setImageDrawable there. If you don't want the animation anyways, another workaround would be using Picassos noFade option.

I'll probably update the README with these hints. Thanks!

from circleimageview.

akohout avatar akohout commented on June 6, 2024

Ok, thanks for the noFade tip - this seems to work better than my workaround.

+1 for writing it to the README file. Since your library works good with Picasso, you should directly inform users about it (so that they don't get frustrated with your lib).

from circleimageview.

vinc3m1 avatar vinc3m1 commented on June 6, 2024

Also see this issue for discussion upstream.

from circleimageview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.