From e9121bbc8339c791e6a7be26e5b6af15d7254475 Mon Sep 17 00:00:00 2001 From: Floens Date: Mon, 27 Mar 2017 23:26:50 +0200 Subject: [PATCH] Apply spoiler setting before creating PostImage. Fixes the disable spoiler setting not doing anything. Make it so that the info tab still shows that the image is spoilered, and that the image viewer correctly handles it. Closes #300 --- .../src/main/java/org/floens/chan/core/model/Post.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Clover/app/src/main/java/org/floens/chan/core/model/Post.java b/Clover/app/src/main/java/org/floens/chan/core/model/Post.java index 3847bcdd..f3fb1f5c 100644 --- a/Clover/app/src/main/java/org/floens/chan/core/model/Post.java +++ b/Clover/app/src/main/java/org/floens/chan/core/model/Post.java @@ -165,7 +165,8 @@ public class Post { imageUrl = ChanUrls.getImageUrl(board, Long.toString(tim), ext); filename = Parser.unescapeEntities(filename, false); - if (spoiler) { + boolean spoilerImage = spoiler && !ChanSettings.revealImageSpoilers.get(); + if (spoilerImage) { Board b = Chan.getBoardManager().getBoardByCode(board); if (b != null && b.customSpoilers >= 0) { thumbnailUrl = ChanUrls.getCustomSpoilerUrl(board, random.nextInt(b.customSpoilers) + 1); @@ -176,17 +177,13 @@ public class Post { thumbnailUrl = ChanUrls.getThumbnailUrl(board, Long.toString(tim)); } - image = new PostImage(String.valueOf(tim), thumbnailUrl, imageUrl, filename, ext, imageWidth, imageHeight, spoiler, fileSize); + image = new PostImage(String.valueOf(tim), thumbnailUrl, imageUrl, filename, ext, imageWidth, imageHeight, spoilerImage, fileSize); } if (!TextUtils.isEmpty(country)) { countryUrl = ChanUrls.getCountryFlagUrl(country); } - if (ChanSettings.revealImageSpoilers.get()) { - spoiler = false; - } - ChanParser.getInstance().parse(this); repliesTo = Collections.unmodifiableSet(repliesTo);