Skip to content

Commit

Permalink
Remove placeholder image while loading thumbnails
Browse files Browse the repository at this point in the history
  • Loading branch information
Stypox committed Aug 10, 2021
1 parent c2fc649 commit f21d8b2
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions app/src/main/java/org/schabi/newpipe/util/PicassoHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,15 @@ public String key() {


private static RequestCreator loadImageDefault(final String url, final int placeholderResId) {
return picassoInstance
.load((!shouldLoadImages || isBlank(url)) ? null : url)
.placeholder(placeholderResId)
.error(placeholderResId);
if (!shouldLoadImages || isBlank(url)) {
return picassoInstance
.load((String) null)
.placeholder(placeholderResId) // show placeholder when no image should load
.error(placeholderResId);
} else {
return picassoInstance
.load(url)
.error(placeholderResId); // don't show placeholder while loading, only on error
}
}
}

0 comments on commit f21d8b2

Please sign in to comment.