From d32a57a18d8d909c01e7f4e242688355cc59bdfe Mon Sep 17 00:00:00 2001 From: sk Date: Mon, 16 Jan 2023 22:06:20 +0100 Subject: [PATCH] fix akkoma link previews not showing closes sk22#183 --- .../android/ui/displayitems/LinkCardStatusDisplayItem.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/LinkCardStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/LinkCardStatusDisplayItem.java index abfe546c1..42ac3b429 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/LinkCardStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/LinkCardStatusDisplayItem.java @@ -73,7 +73,12 @@ public class LinkCardStatusDisplayItem extends StatusDisplayItem{ photo.setImageDrawable(null); if(item.imgRequest!=null){ - crossfadeDrawable.setSize(card.width, card.height); + if (card.width > 0) { + // akkoma servers don't provide width and height + crossfadeDrawable.setSize(card.width, card.height); + } else { + crossfadeDrawable.setSize(itemView.getWidth(), itemView.getHeight()); + } crossfadeDrawable.setBlurhashDrawable(card.blurhashPlaceholder); crossfadeDrawable.setCrossfadeAlpha(item.status.spoilerRevealed ? 0f : 1f); photo.setImageDrawable(crossfadeDrawable);