From a46accfcc00d82f3aab13f8f0e82a8741c1a8ef2 Mon Sep 17 00:00:00 2001 From: Lucio Maciel Date: Thu, 29 Jul 2021 16:47:28 -0300 Subject: [PATCH] Fix link preview margins --- .../securesms/conversation/ConversationItem.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationItem.java b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationItem.java index 01c01526e7..e2a0a922fc 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationItem.java +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationItem.java @@ -817,12 +817,17 @@ public final class ConversationItem extends RelativeLayout implements BindableCo ViewUtil.updateLayoutParams(bodyFooterContainer, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); ViewUtil.updateLayoutParamsIfNonNull(groupSenderHolder, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + ViewUtil.setTopMargin(linkPreviewStub.get(), 0); } else { linkPreviewStub.get().setLinkPreview(glideRequests, linkPreview, true); linkPreviewStub.get().setDownloadClickedListener(downloadClickListener); setLinkPreviewCorners(messageRecord, previousRecord, nextRecord, isGroupThread, false); ViewUtil.updateLayoutParams(bodyFooterContainer, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); ViewUtil.updateLayoutParamsIfNonNull(groupSenderHolder, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); + + //noinspection ConstantConditions + int topMargin = isGroupThread && isStartOfMessageCluster(messageRecord, previousRecord, isGroupThread) && !messageRecord.isOutgoing() ? readDimen(R.dimen.message_bubble_top_padding) : 0; + ViewUtil.setTopMargin(linkPreviewStub.get(), topMargin); } linkPreviewStub.get().setOnClickListener(linkPreviewClickListener); @@ -1207,10 +1212,6 @@ public final class ConversationItem extends RelativeLayout implements BindableCo if (mediaThumbnailStub.resolved()) { ViewUtil.setTopMargin(mediaThumbnailStub.require(), topMargin); } - - if (linkPreviewStub.resolved()) { - ViewUtil.setTopMargin(linkPreviewStub.get(), 0); - } } }