From 44128f91457a08aaea8ef1a76a7d188d4fe57366 Mon Sep 17 00:00:00 2001 From: Stypox Date: Tue, 10 Aug 2021 09:46:32 +0200 Subject: [PATCH] Remove placeholder image while loading thumbnails --- .../org/schabi/newpipe/util/PicassoHelper.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/util/PicassoHelper.java b/app/src/main/java/org/schabi/newpipe/util/PicassoHelper.java index 173b45776..e15ecd277 100644 --- a/app/src/main/java/org/schabi/newpipe/util/PicassoHelper.java +++ b/app/src/main/java/org/schabi/newpipe/util/PicassoHelper.java @@ -157,9 +157,15 @@ public final class PicassoHelper { 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 + } } }