Apply message bubble paddings to both top and bottom
Batch selecting messages now feels better. Fixes #8035.
This commit is contained in:
parent
79830049c4
commit
faea8fd2ec
5 changed files with 21 additions and 16 deletions
|
@ -9,7 +9,7 @@
|
||||||
android:id="@android:id/list"
|
android:id="@android:id/list"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:paddingBottom="24dp"
|
android:paddingBottom="16dp"
|
||||||
android:scrollbars="vertical"
|
android:scrollbars="vertical"
|
||||||
android:cacheColorHint="?conversation_background"
|
android:cacheColorHint="?conversation_background"
|
||||||
android:clipChildren="false"
|
android:clipChildren="false"
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingTop="20dp"
|
android:paddingTop="12dp"
|
||||||
android:paddingBottom="21dp"
|
android:paddingBottom="13dp"
|
||||||
android:paddingLeft="28dp"
|
android:paddingLeft="28dp"
|
||||||
android:paddingRight="28dp">
|
android:paddingRight="28dp">
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,8 @@
|
||||||
<dimen name="conversation_individual_right_gutter">16dp</dimen>
|
<dimen name="conversation_individual_right_gutter">16dp</dimen>
|
||||||
<dimen name="conversation_individual_left_gutter">16dp</dimen>
|
<dimen name="conversation_individual_left_gutter">16dp</dimen>
|
||||||
<dimen name="conversation_group_left_gutter">52dp</dimen>
|
<dimen name="conversation_group_left_gutter">52dp</dimen>
|
||||||
<dimen name="conversation_vertical_message_spacing_default">16dp</dimen>
|
<dimen name="conversation_vertical_message_spacing_default">8dp</dimen>
|
||||||
<dimen name="conversation_vertical_message_spacing_collapse">2dp</dimen>
|
<dimen name="conversation_vertical_message_spacing_collapse">1dp</dimen>
|
||||||
|
|
||||||
<dimen name="quote_corner_radius_large">10dp</dimen>
|
<dimen name="quote_corner_radius_large">10dp</dimen>
|
||||||
<dimen name="quote_corner_radius_bottom">4dp</dimen>
|
<dimen name="quote_corner_radius_bottom">4dp</dimen>
|
||||||
|
|
|
@ -215,7 +215,7 @@ public class ConversationItem extends LinearLayout
|
||||||
setGroupMessageStatus(messageRecord, recipient);
|
setGroupMessageStatus(messageRecord, recipient);
|
||||||
setAuthor(messageRecord, previousMessageRecord, nextMessageRecord, groupThread);
|
setAuthor(messageRecord, previousMessageRecord, nextMessageRecord, groupThread);
|
||||||
setQuote(messageRecord, previousMessageRecord, nextMessageRecord, groupThread);
|
setQuote(messageRecord, previousMessageRecord, nextMessageRecord, groupThread);
|
||||||
setMessageSpacing(context, messageRecord, nextMessageRecord);
|
setMessageSpacing(context, messageRecord, previousMessageRecord, nextMessageRecord, groupThread);
|
||||||
setFooter(messageRecord, nextMessageRecord, locale, groupThread);
|
setFooter(messageRecord, nextMessageRecord, locale, groupThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -771,19 +771,20 @@ public class ConversationItem extends LinearLayout
|
||||||
return isStartOfMessageCluster(current, previous, isGroupThread) && isEndOfMessageCluster(current, next, isGroupThread);
|
return isStartOfMessageCluster(current, previous, isGroupThread) && isEndOfMessageCluster(current, next, isGroupThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setMessageSpacing(@NonNull Context context, @NonNull MessageRecord current, @NonNull Optional<MessageRecord> next) {
|
private void setMessageSpacing(@NonNull Context context, @NonNull MessageRecord current, @NonNull Optional<MessageRecord> previous, @NonNull Optional<MessageRecord> next, boolean isGroupThread) {
|
||||||
int spacing = readDimen(context, R.dimen.conversation_vertical_message_spacing_collapse);
|
int spacingTop = readDimen(context, R.dimen.conversation_vertical_message_spacing_collapse);
|
||||||
|
int spacingBottom = spacingTop;
|
||||||
|
|
||||||
if (next.isPresent()) {
|
if (isStartOfMessageCluster(current, previous, isGroupThread)) {
|
||||||
boolean recipientsMatch = current.getRecipient().getAddress().equals(next.get().getRecipient().getAddress());
|
spacingTop = readDimen(context, R.dimen.conversation_vertical_message_spacing_default);
|
||||||
boolean outgoingMatch = current.isOutgoing() == next.get().isOutgoing();
|
|
||||||
|
|
||||||
if (!recipientsMatch || !outgoingMatch) {
|
|
||||||
spacing = 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) {
|
private int readDimen(@NonNull Context context, @DimenRes int dimenId) {
|
||||||
|
|
|
@ -233,6 +233,10 @@ public class ViewUtil {
|
||||||
view.requestLayout();
|
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) {
|
public static void setPaddingBottom(@NonNull View view, int padding) {
|
||||||
view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), padding);
|
view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), padding);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue