mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-07-07 14:35:29 +01:00
Fix sender name/label overflowing beyond message bubble media width.
This commit is contained in:
@@ -213,6 +213,7 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||
private ConversationItemFooter footer;
|
||||
@Nullable private ConversationItemFooter stickerFooter;
|
||||
@Nullable private SenderNameWithLabelView senderWithLabelView;
|
||||
@Nullable private View groupSenderHolder;
|
||||
private AvatarImageView contactPhoto;
|
||||
private AlertView alertView;
|
||||
private ReactionsConversationView reactionsView;
|
||||
@@ -334,6 +335,7 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||
this.footer = findViewById(R.id.conversation_item_footer);
|
||||
this.stickerFooter = findViewById(R.id.conversation_item_sticker_footer);
|
||||
this.senderWithLabelView = findViewById(R.id.group_sender_name_with_label);
|
||||
this.groupSenderHolder = findViewById(R.id.group_sender_holder);
|
||||
this.alertView = findViewById(R.id.indicators_parent);
|
||||
this.contactPhoto = findViewById(R.id.contact_photo);
|
||||
this.contactPhotoHolder = findViewById(R.id.contact_photo_container);
|
||||
@@ -1214,6 +1216,7 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||
setSharedContactCorners(messageRecord, previousRecord, nextRecord, isGroupThread);
|
||||
|
||||
ViewUtil.updateLayoutParams(bodyText, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
ViewUtil.updateLayoutParamsIfNonNull(groupSenderHolder, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
footer.setVisibility(GONE);
|
||||
} else if (hasLinkPreview(messageRecord) && messageRequestAccepted) {
|
||||
linkPreviewStub.get().setVisibility(View.VISIBLE);
|
||||
@@ -1259,12 +1262,14 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||
setLinkPreviewCorners(messageRecord, previousRecord, nextRecord, isGroupThread, true);
|
||||
|
||||
ViewUtil.updateLayoutParams(bodyText, 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(requestManager, linkPreview, true, !isContentCondensed(), displayMode.getMessageMode() == ConversationItemDisplayMode.MessageMode.SCHEDULED);
|
||||
linkPreviewStub.get().setDownloadClickedListener(downloadClickListener);
|
||||
setLinkPreviewCorners(messageRecord, previousRecord, nextRecord, isGroupThread, false);
|
||||
ViewUtil.updateLayoutParams(bodyText, 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;
|
||||
@@ -1300,6 +1305,7 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||
}
|
||||
|
||||
ViewUtil.updateLayoutParams(bodyText, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
ViewUtil.updateLayoutParamsIfNonNull(groupSenderHolder, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
|
||||
footer.setPlaybackSpeedListener(new AudioPlaybackSpeedToggleListener());
|
||||
footer.setVisibility(VISIBLE);
|
||||
@@ -1328,6 +1334,7 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||
documentViewStub.get().setOnLongClickListener(passthroughClickListener);
|
||||
|
||||
ViewUtil.updateLayoutParams(bodyText, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
ViewUtil.updateLayoutParamsIfNonNull(groupSenderHolder, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
ViewUtil.setTopMargin(bodyText, 0);
|
||||
|
||||
footer.setVisibility(VISIBLE);
|
||||
@@ -1360,6 +1367,7 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||
stickerStub.get().setOnClickListener(passthroughClickListener);
|
||||
|
||||
ViewUtil.updateLayoutParams(bodyText, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
ViewUtil.updateLayoutParamsIfNonNull(groupSenderHolder, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
|
||||
footer.setVisibility(VISIBLE);
|
||||
} else if (hasNoBubble(messageRecord)) {
|
||||
@@ -1411,6 +1419,7 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||
setThumbnailCorners(messageRecord, previousRecord, nextRecord, isGroupThread);
|
||||
|
||||
ViewUtil.updateLayoutParams(bodyText, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
ViewUtil.updateLayoutParamsIfNonNull(groupSenderHolder, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
|
||||
footer.setVisibility(VISIBLE);
|
||||
|
||||
@@ -1495,6 +1504,7 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||
paymentViewStub.setVisibility(View.GONE);
|
||||
|
||||
ViewUtil.updateLayoutParams(bodyText, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
ViewUtil.updateLayoutParamsIfNonNull(groupSenderHolder, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
|
||||
footer.setVisibility(VISIBLE);
|
||||
|
||||
@@ -1965,8 +1975,6 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||
int senderColor = colorizer.getIncomingGroupSenderColor(getContext(), messageRecord.getFromRecipient());
|
||||
senderWithLabelView.setSender(senderName, senderColor);
|
||||
senderWithLabelView.setLabel(conversationMessage.getMemberLabel());
|
||||
} else {
|
||||
senderWithLabelView.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1978,17 +1986,17 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||
if (!previous.isPresent() || previous.get().isUpdate() || !current.getFromRecipient().equals(previous.get().getFromRecipient()) ||
|
||||
!DateUtils.isSameDay(previous.get().getTimestamp(), current.getTimestamp()) || !isWithinClusteringTime(current, previous.get()) || forceGroupHeader(current))
|
||||
{
|
||||
senderWithLabelView.setVisibility(VISIBLE);
|
||||
groupSenderHolder.setVisibility(VISIBLE);
|
||||
adjustMarginsForSenderVisibility(true);
|
||||
|
||||
if (hasWallpaper && hasNoBubble(current)) {
|
||||
senderWithLabelView.setBackgroundResource(R.drawable.wallpaper_bubble_background_tintable_11);
|
||||
senderWithLabelView.getBackground().setColorFilter(getDefaultBubbleColor(hasWallpaper), PorterDuff.Mode.MULTIPLY);
|
||||
groupSenderHolder.setBackgroundResource(R.drawable.wallpaper_bubble_background_tintable_11);
|
||||
groupSenderHolder.getBackground().setColorFilter(getDefaultBubbleColor(hasWallpaper), PorterDuff.Mode.MULTIPLY);
|
||||
} else {
|
||||
senderWithLabelView.setBackground(null);
|
||||
groupSenderHolder.setBackground(null);
|
||||
}
|
||||
} else {
|
||||
senderWithLabelView.setVisibility(GONE);
|
||||
groupSenderHolder.setVisibility(GONE);
|
||||
adjustMarginsForSenderVisibility(false);
|
||||
}
|
||||
|
||||
@@ -2000,8 +2008,8 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||
badgeImageView.setVisibility(GONE);
|
||||
}
|
||||
} else {
|
||||
if (senderWithLabelView != null) {
|
||||
senderWithLabelView.setVisibility(GONE);
|
||||
if (groupSenderHolder != null) {
|
||||
groupSenderHolder.setVisibility(GONE);
|
||||
}
|
||||
adjustMarginsForSenderVisibility(false);
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<org.thoughtcrime.securesms.conversation.ConversationItem xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:viewBindingIgnore="true"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/conversation_item"
|
||||
android:layout_width="match_parent"
|
||||
@@ -13,7 +12,8 @@
|
||||
android:nextFocusRight="@+id/embedded_text_editor"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="@dimen/conversation_individual_received_left_gutter"
|
||||
android:paddingEnd="@dimen/conversation_individual_right_gutter">
|
||||
android:paddingEnd="@dimen/conversation_individual_right_gutter"
|
||||
tools:viewBindingIgnore="true">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/reply_icon_wrapper"
|
||||
@@ -79,16 +79,24 @@
|
||||
tools:background="@drawable/message_bubble_background_received_alone"
|
||||
tools:backgroundTint="@color/signal_colorSurfaceVariant">
|
||||
|
||||
<org.thoughtcrime.securesms.conversation.v2.items.SenderNameWithLabelView
|
||||
android:id="@+id/group_sender_name_with_label"
|
||||
<FrameLayout
|
||||
android:id="@+id/group_sender_holder"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/message_bubble_top_image_margin"
|
||||
android:layout_marginBottom="@dimen/message_bubble_top_image_margin"
|
||||
android:paddingStart="@dimen/message_bubble_horizontal_padding"
|
||||
android:paddingEnd="@dimen/message_bubble_horizontal_padding"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
tools:visibility="visible">
|
||||
|
||||
<org.thoughtcrime.securesms.conversation.v2.items.SenderNameWithLabelView
|
||||
android:id="@+id/group_sender_name_with_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/message_bubble_horizontal_padding"
|
||||
android:paddingEnd="@dimen/message_bubble_horizontal_padding" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/story_reacted_label_holder"
|
||||
@@ -210,18 +218,18 @@
|
||||
android:textColor="@color/signal_text_primary"
|
||||
android:textColorLink="@color/signal_text_primary"
|
||||
app:emoji_maxLength="1000"
|
||||
app:emoji_renderSpoilers="true"
|
||||
app:measureLastLine="true"
|
||||
app:scaleEmojis="true"
|
||||
app:emoji_renderSpoilers="true"
|
||||
tools:text="Mango pickle lorem ipsum" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/poll"
|
||||
android:layout_width="wrap_content"
|
||||
android:maxWidth="@dimen/media_bubble_max_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="-4dp"
|
||||
android:layout="@layout/conversation_item_poll" />
|
||||
android:layout="@layout/conversation_item_poll"
|
||||
android:maxWidth="@dimen/media_bubble_max_width" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/conversation_item_join_button"
|
||||
@@ -283,15 +291,15 @@
|
||||
android:layout_height="36dp"
|
||||
android:layout_toStartOf="@id/quoted_indicator"
|
||||
android:gravity="center_vertical"
|
||||
android:visibility="gone"/>
|
||||
android:visibility="gone" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignEnd="@id/body_bubble"
|
||||
android:layout_alignTop="@id/body_bubble"
|
||||
android:layout_alignEnd="@id/body_bubble"
|
||||
android:layout_alignBottom="@id/body_bubble"
|
||||
android:layout_marginEnd="-42dp" >
|
||||
android:layout_marginEnd="-42dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/quoted_indicator"
|
||||
|
||||
@@ -100,15 +100,23 @@
|
||||
android:orientation="vertical"
|
||||
tools:backgroundTint="@color/conversation_blue">
|
||||
|
||||
<org.thoughtcrime.securesms.conversation.v2.items.SenderNameWithLabelView
|
||||
android:id="@+id/group_sender_name_with_label"
|
||||
<FrameLayout
|
||||
android:id="@+id/group_sender_holder"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="7dp"
|
||||
android:paddingStart="@dimen/message_bubble_horizontal_padding"
|
||||
android:paddingEnd="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginTop="@dimen/message_bubble_top_padding"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
tools:visibility="visible">
|
||||
|
||||
<org.thoughtcrime.securesms.conversation.v2.items.SenderNameWithLabelView
|
||||
android:id="@+id/group_sender_name_with_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/message_bubble_horizontal_padding"
|
||||
android:paddingEnd="@dimen/message_bubble_horizontal_padding" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||
android:id="@+id/conversation_item_body"
|
||||
|
||||
@@ -71,12 +71,13 @@
|
||||
|
||||
<org.thoughtcrime.securesms.conversation.v2.items.SenderNameWithLabelView
|
||||
android:id="@+id/group_sender_name_with_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/message_bubble_top_padding"
|
||||
android:paddingStart="@dimen/message_bubble_horizontal_padding"
|
||||
android:paddingEnd="@dimen/message_bubble_horizontal_padding"
|
||||
android:visibility="gone"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toTopOf="@id/conversation_item_content_spacer"
|
||||
app:layout_constraintEnd_toEndOf="@id/conversation_item_body"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
@@ -166,11 +167,11 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginBottom="@dimen/message_bubble_footer_bottom_padding"
|
||||
app:layout_constraintTop_toTopOf="@id/conversation_item_footer_date"
|
||||
android:src="@drawable/symbol_pin_filled_12"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/conversation_item_footer_date"
|
||||
app:layout_constraintEnd_toStartOf="@id/conversation_item_footer_date"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/symbol_pin_filled_12" />
|
||||
app:layout_constraintTop_toTopOf="@id/conversation_item_footer_date" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/conversation_item_footer_date"
|
||||
|
||||
Reference in New Issue
Block a user