aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-08-18 03:17:00 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-08-18 03:17:00 +0000
commitc6028708a4892a951f44f8b8d49d543158b6821c (patch)
tree9a5a32c3ae4b757cafa35ae4817239a99e588b20 /app/src/main
parent036417bdf1b3eb9279991a5dbf3e092ca46a63c8 (diff)
downloadinfinity-for-reddit-c6028708a4892a951f44f8b8d49d543158b6821c.tar
infinity-for-reddit-c6028708a4892a951f44f8b8d49d543158b6821c.tar.gz
infinity-for-reddit-c6028708a4892a951f44f8b8d49d543158b6821c.tar.bz2
infinity-for-reddit-c6028708a4892a951f44f8b8d49d543158b6821c.tar.lz
infinity-for-reddit-c6028708a4892a951f44f8b8d49d543158b6821c.tar.xz
infinity-for-reddit-c6028708a4892a951f44f8b8d49d543158b6821c.tar.zst
infinity-for-reddit-c6028708a4892a951f44f8b8d49d543158b6821c.zip
Fix embedded media type option not working.
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifEntry.java21
1 files changed, 14 insertions, 7 deletions
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<ImageAndGifBlock, Ima
RequestBuilder<Drawable> 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<ImageAndGifBlock, Ima
}
}
+ private void showImageAsUrl(@NonNull Holder holder, @NonNull ImageAndGifBlock node) {
+ 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);
+ }
+
@Override
public void onViewRecycled(@NonNull Holder holder) {
super.onViewRecycled(holder);