diff --git a/res/layout/conversation_fragment.xml b/res/layout/conversation_fragment.xml index ab905ae024..1dd360c9fb 100644 --- a/res/layout/conversation_fragment.xml +++ b/res/layout/conversation_fragment.xml @@ -9,7 +9,7 @@ android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="match_parent" - android:paddingBottom="24dp" + android:paddingBottom="16dp" android:scrollbars="vertical" android:cacheColorHint="?conversation_background" android:clipChildren="false" diff --git a/res/layout/conversation_item_header.xml b/res/layout/conversation_item_header.xml index 464c855a15..f2716d03bf 100644 --- a/res/layout/conversation_item_header.xml +++ b/res/layout/conversation_item_header.xml @@ -5,8 +5,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" - android:paddingTop="20dp" - android:paddingBottom="21dp" + android:paddingTop="12dp" + android:paddingBottom="13dp" android:paddingLeft="28dp" android:paddingRight="28dp"> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 7cefb75cf6..ab206463d5 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -37,8 +37,8 @@ 16dp 16dp 52dp - 16dp - 2dp + 8dp + 1dp 10dp 4dp diff --git a/src/org/thoughtcrime/securesms/ConversationItem.java b/src/org/thoughtcrime/securesms/ConversationItem.java index ad9280f6a0..a68af4025e 100644 --- a/src/org/thoughtcrime/securesms/ConversationItem.java +++ b/src/org/thoughtcrime/securesms/ConversationItem.java @@ -215,7 +215,7 @@ public class ConversationItem extends LinearLayout setGroupMessageStatus(messageRecord, recipient); setAuthor(messageRecord, previousMessageRecord, nextMessageRecord, groupThread); setQuote(messageRecord, previousMessageRecord, nextMessageRecord, groupThread); - setMessageSpacing(context, messageRecord, nextMessageRecord); + setMessageSpacing(context, messageRecord, previousMessageRecord, nextMessageRecord, groupThread); setFooter(messageRecord, nextMessageRecord, locale, groupThread); } @@ -771,19 +771,20 @@ public class ConversationItem extends LinearLayout return isStartOfMessageCluster(current, previous, isGroupThread) && isEndOfMessageCluster(current, next, isGroupThread); } - private void setMessageSpacing(@NonNull Context context, @NonNull MessageRecord current, @NonNull Optional next) { - int spacing = readDimen(context, R.dimen.conversation_vertical_message_spacing_collapse); + private void setMessageSpacing(@NonNull Context context, @NonNull MessageRecord current, @NonNull Optional previous, @NonNull Optional next, boolean isGroupThread) { + int spacingTop = readDimen(context, R.dimen.conversation_vertical_message_spacing_collapse); + int spacingBottom = spacingTop; - if (next.isPresent()) { - boolean recipientsMatch = current.getRecipient().getAddress().equals(next.get().getRecipient().getAddress()); - boolean outgoingMatch = current.isOutgoing() == next.get().isOutgoing(); - - if (!recipientsMatch || !outgoingMatch) { - spacing = readDimen(context, R.dimen.conversation_vertical_message_spacing_default); - } + if (isStartOfMessageCluster(current, previous, isGroupThread)) { + spacingTop = readDimen(context, R.dimen.conversation_vertical_message_spacing_default); } - ViewUtil.setPaddingBottom(this, spacing); + if (isEndOfMessageCluster(current, next, isGroupThread)) { + spacingBottom = readDimen(context, R.dimen.conversation_vertical_message_spacing_default); + } + + ViewUtil.setPaddingTop(this, spacingTop); + ViewUtil.setPaddingBottom(this, spacingBottom); } private int readDimen(@NonNull Context context, @DimenRes int dimenId) { diff --git a/src/org/thoughtcrime/securesms/util/ViewUtil.java b/src/org/thoughtcrime/securesms/util/ViewUtil.java index 8f606103c3..9880270128 100644 --- a/src/org/thoughtcrime/securesms/util/ViewUtil.java +++ b/src/org/thoughtcrime/securesms/util/ViewUtil.java @@ -233,6 +233,10 @@ public class ViewUtil { view.requestLayout(); } + public static void setPaddingTop(@NonNull View view, int padding) { + view.setPadding(view.getPaddingLeft(), padding, view.getPaddingRight(), view.getPaddingBottom()); + } + public static void setPaddingBottom(@NonNull View view, int padding) { view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), padding); }