diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java index ea5bb5547..3d34de788 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java @@ -1027,6 +1027,11 @@ public abstract class BaseStatusListFragment exten media.rebind(); } + PreviewlessMediaGridStatusDisplayItem.Holder previewLessMedia=findHolderOfType(itemID, PreviewlessMediaGridStatusDisplayItem.Holder.class); + if (previewLessMedia!=null) { + previewLessMedia.rebind(); + } + for(int i=0;i viewPool; private final List attachments; + private final Map> translatedAttachments = new HashMap<>(); private final ArrayList requests=new ArrayList<>(); public final Status status; public String sensitiveTitle; @@ -115,6 +123,25 @@ public class PreviewlessMediaGridStatusDisplayItem extends StatusDisplayItem{ c.view.setOnClickListener(clickListener); c.view.setTag(i); controllers.add(c); + + if (item.status.translation != null){ + if(item.status.translationState==Status.TranslationState.SHOWN){ + if(!item.translatedAttachments.containsKey(att.id)){ + Optional translatedAttachment=Arrays.stream(item.status.translation.mediaAttachments).filter(mediaAttachment->mediaAttachment.id.equals(att.id)).findFirst(); + translatedAttachment.ifPresent(mediaAttachment->{ + item.translatedAttachments.put(mediaAttachment.id, new Pair<>(att.description, mediaAttachment.description)); + att.description=mediaAttachment.description; + }); + }else{ + //SAFETY: must be non-null, as we check if the map contains the attachment before + att.description=Objects.requireNonNull(item.translatedAttachments.get(att.id)).second; + } + }else{ + if (item.translatedAttachments.containsKey(att.id)) { + att.description=Objects.requireNonNull(item.translatedAttachments.get(att.id)).first; + } + } + } c.bind(att, item.status); i++; }