Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Movie ListView re-use image downloading problem. #415

Closed
JakeWharton opened this issue Dec 21, 2014 · 3 comments
Closed

Movie ListView re-use image downloading problem. #415

JakeWharton opened this issue Dec 21, 2014 · 3 comments
Labels
bug Something isn't working

Comments

@JakeWharton
Copy link
Contributor

2014-11-09 14 41 40
2014-11-09 04 14 04

Notice "Yoga Hosers" and "Clerks III" (maybe it's only Kevin Smith movies that have this problem!). This only happens when scrolling fast and the image for the original movie to which the poster belongs is not in the memory cache.

@JakeWharton
Copy link
Contributor Author

Neither of these movies have posters. I forgot to mention that.

@JakeWharton
Copy link
Contributor Author

Looks like the problem is in MoviesAdapter:

        if (!TextUtils.isEmpty(movie.poster_path)) {
            ServiceUtils.getPicasso(getContext())
                    .load(mImageBaseUrl + movie.poster_path)
                    .into(holder.poster);
        } else {
            // clear image
            holder.poster.setImageDrawable(null);
        }

You need to always call Picasso so that it knows the view was re-used.

The quick fix is to call ServiceUtils.getPicasso(getContext()).cancelRequest(holder.poster) in the else block. If movie.poster_path is null when a poster is not present, you can simply remove the if altogether. Picasso handles null URLs just fine.

@UweTrottmann UweTrottmann added the bug Something isn't working label Dec 24, 2014
@UweTrottmann UweTrottmann added this to the SeriesGuide 21 milestone Dec 24, 2014
@UweTrottmann
Copy link
Owner

Thanks for reporting and providing a fix!

P.S. Sorry for the late response, was a little under the weather the last
few days.

On Sun, Dec 21, 2014 at 10:42 AM, Jake Wharton notifications@github.com
wrote:

Looks like the problem is in MoviesAdapter:

    if (!TextUtils.isEmpty(movie.poster_path)) {
        ServiceUtils.getPicasso(getContext())
                .load(mImageBaseUrl + movie.poster_path)
                .into(holder.poster);
    } else {
        // clear image
        holder.poster.setImageDrawable(null);
    }

You need to always call Picasso so that it knows the view was re-used.

The quick fix is to call
ServiceUtils.getPicasso(getContext()).cancelRequest(holder.poster) in the
else block. If movie.poster_path is null when a poster is not present,
you can simply remove the if altogether. Picasso handles null URLs just
fine.


Reply to this email directly or view it on GitHub
#415 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants