From db0fd21097c3ed66e9633c6aef745dbb0e0e2b3b Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Fri, 4 Sep 2020 14:58:45 +1000 Subject: [PATCH] Make text bubbles a bit smaller --- res/layout/conversation_item_received.xml | 42 +++++++++---------- res/layout/conversation_item_sent.xml | 36 ++++++++-------- res/layout/document_view.xml | 1 + res/layout/quote_view.xml | 3 +- .../conversation/ConversationItem.java | 11 ++--- 5 files changed, 48 insertions(+), 45 deletions(-) diff --git a/res/layout/conversation_item_received.xml b/res/layout/conversation_item_received.xml index 5b7d503cdf..063b5dd939 100644 --- a/res/layout/conversation_item_received.xml +++ b/res/layout/conversation_item_received.xml @@ -59,8 +59,8 @@ android:layout_height="wrap_content" android:layout_marginEnd="@dimen/massive_spacing" android:layout_marginStart="12dp" - android:paddingTop="@dimen/medium_spacing" - android:paddingBottom="@dimen/medium_spacing" + android:paddingTop="12dp" + android:paddingBottom="12dp" android:orientation="vertical" android:clipToPadding="false" android:clipChildren="false" @@ -71,9 +71,9 @@ android:id="@+id/group_sender_holder" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/message_bubble_horizontal_padding" - android:layout_marginBottom="@dimen/medium_spacing" - android:layout_marginEnd="@dimen/message_bubble_horizontal_padding" + android:layout_marginStart="12dp" + android:layout_marginBottom="12dp" + android:layout_marginEnd="12dp" android:orientation="horizontal" android:visibility="gone" tools:visibility="visible"> @@ -113,9 +113,9 @@ android:id="@+id/quote_view" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/large_spacing" - android:layout_marginBottom="@dimen/medium_spacing" - android:layout_marginEnd="@dimen/large_spacing" + android:layout_marginStart="20dp" + android:layout_marginBottom="12dp" + android:layout_marginEnd="20dp" android:visibility="gone" app:message_type="incoming" app:quote_colorPrimary="@color/text" @@ -127,7 +127,7 @@ android:layout="@layout/conversation_item_received_shared_contact" android:layout_width="@dimen/media_bubble_default_dimens" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/message_bubble_top_padding" + android:layout_marginTop="12dp" android:visibility="gone"/> + android:layout_marginStart="12dp" + android:layout_marginBottom="4dp" + android:layout_marginEnd="12dp" /> + android:layout_marginStart="12dp" + android:layout_marginEnd="12dp" /> + android:layout_marginStart="12dp" + android:layout_marginBottom="4dp" + android:layout_marginEnd="12dp" /> + android:layout_marginEnd="12dp" /> diff --git a/res/layout/quote_view.xml b/res/layout/quote_view.xml index 50b270b500..8b1fa969df 100644 --- a/res/layout/quote_view.xml +++ b/res/layout/quote_view.xml @@ -73,7 +73,7 @@ android:layout_height="wrap_content" style="@style/Signal.Text.Body" android:textColor="@color/text" - android:textSize="@dimen/medium_font_size" + android:textSize="@dimen/small_font_size" android:maxLines="1" android:ellipsize="end" tools:text="The-Amazing-Spider-Man.cba" /> @@ -99,6 +99,7 @@ android:layout_height="wrap_content" android:layout_marginTop="4dp" style="@style/Signal.Text.Body" + android:textSize="@dimen/small_font_size" android:ellipsize="end" android:maxLines="2" tools:text="With great power comes great responsibility." diff --git a/src/org/thoughtcrime/securesms/conversation/ConversationItem.java b/src/org/thoughtcrime/securesms/conversation/ConversationItem.java index ca3d10db17..385c0fa9ab 100644 --- a/src/org/thoughtcrime/securesms/conversation/ConversationItem.java +++ b/src/org/thoughtcrime/securesms/conversation/ConversationItem.java @@ -87,6 +87,7 @@ import org.thoughtcrime.securesms.jobs.SmsSendJob; import org.thoughtcrime.securesms.linkpreview.LinkPreview; import org.thoughtcrime.securesms.linkpreview.LinkPreviewUtil; import org.thoughtcrime.securesms.logging.Log; +import org.thoughtcrime.securesms.loki.utilities.GeneralUtilitiesKt; import org.thoughtcrime.securesms.loki.utilities.MentionUtilities; import org.thoughtcrime.securesms.loki.views.ProfilePictureView; import org.thoughtcrime.securesms.mms.GlideRequests; @@ -502,23 +503,23 @@ public class ConversationItem extends LinearLayout if (hasOnlyThumbnail(messageRecord)) { int topPadding = 0; if (groupSenderHolder.getVisibility() == VISIBLE) { - topPadding = (int)getResources().getDimension(R.dimen.medium_spacing); + topPadding = GeneralUtilitiesKt.toPx(12, getResources()); } int bottomPadding = 0; if (messageRecord.getBody().length() > 0) { - bodyTextLayoutParams.topMargin = (int)getResources().getDimension(R.dimen.medium_spacing); - bottomPadding = (int)getResources().getDimension(R.dimen.medium_spacing); + bodyTextLayoutParams.topMargin = GeneralUtilitiesKt.toPx(12, getResources()); + bottomPadding = GeneralUtilitiesKt.toPx(12, getResources()); } bodyBubble.setPadding(0, topPadding, 0, bottomPadding); } else { - bodyBubble.setPadding(0, (int)getResources().getDimension(R.dimen.medium_spacing), 0, (int)getResources().getDimension(R.dimen.medium_spacing)); + bodyBubble.setPadding(0, GeneralUtilitiesKt.toPx(12, getResources()), 0, GeneralUtilitiesKt.toPx(12, getResources())); } bodyText.setLayoutParams(bodyTextLayoutParams); LinearLayout.LayoutParams senderHolderLayoutParams = (LinearLayout.LayoutParams)groupSenderHolder.getLayoutParams(); if (groupSenderHolder.getVisibility() == VISIBLE && hasOnlyText(messageRecord)) { senderHolderLayoutParams.bottomMargin = (int)(getResources().getDisplayMetrics().density * 4); } else { - senderHolderLayoutParams.bottomMargin = (int)getResources().getDimension(R.dimen.medium_spacing); + senderHolderLayoutParams.bottomMargin = GeneralUtilitiesKt.toPx(12, getResources()); } groupSenderHolder.setLayoutParams(senderHolderLayoutParams); if (documentViewStub.resolved()) {