From c6028708a4892a951f44f8b8d49d543158b6821c Mon Sep 17 00:00:00 2001 From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> Date: Sat, 17 Aug 2024 23:17:00 -0400 Subject: Fix embedded media type option not working. --- .../markdown/ImageAndGifEntry.java | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'app/src/main/java') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifEntry.java b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifEntry.java index aa053f4f..5f56faca 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifEntry.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifEntry.java @@ -131,18 +131,16 @@ public class ImageAndGifEntry extends MarkwonAdapter.Entry imageRequestBuilder; if (dataSavingMode) { - if (disableImagePreview || (node.mediaMetadata.isGIF && !canShowGif) || (!node.mediaMetadata.isGIF && !canShowImage)) { - holder.binding.imageWrapperRelativeLayoutMarkdownImageAndGifBlock.setVisibility(View.GONE); - holder.binding.captionTextViewMarkdownImageAndGifBlock.setVisibility(View.VISIBLE); - holder.binding.captionTextViewMarkdownImageAndGifBlock.setGravity(Gravity.NO_GRAVITY); - SpannableString spannableString = new SpannableString(node.mediaMetadata.caption == null ? node.mediaMetadata.original.url : node.mediaMetadata.caption); - spannableString.setSpan(new URLSpan(node.mediaMetadata.original.url), 0, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - holder.binding.captionTextViewMarkdownImageAndGifBlock.setText(spannableString); + if (disableImagePreview) { + showImageAsUrl(holder, node); return; } else { imageRequestBuilder = glide.load(node.mediaMetadata.downscaled.url).listener(holder.requestListener); holder.binding.imageViewMarkdownImageAndGifBlock.setRatio((float) node.mediaMetadata.downscaled.y / node.mediaMetadata.downscaled.x); } + } else if ((node.mediaMetadata.isGIF && !canShowGif) || (!node.mediaMetadata.isGIF && !canShowImage)) { + showImageAsUrl(holder, node); + return; } else { imageRequestBuilder = glide.load(node.mediaMetadata.original.url).listener(holder.requestListener); holder.binding.imageViewMarkdownImageAndGifBlock.setRatio((float) node.mediaMetadata.original.y / node.mediaMetadata.original.x); @@ -171,6 +169,15 @@ public class ImageAndGifEntry extends MarkwonAdapter.Entry