From 8858deb42fba3fd98be35c2d58faa3a7b85ab7ea Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 16 Oct 2023 10:20:53 +0200 Subject: [PATCH] Improved incoming bubble layout --- .../chat/adapter/ConversationEventAdapter.kt | 8 +-- .../main/res/layout/chat_bubble_incoming.xml | 69 +++++++------------ app/src/main/res/values/dimen.xml | 2 + 3 files changed, 29 insertions(+), 50 deletions(-) diff --git a/app/src/main/java/org/linphone/ui/main/chat/adapter/ConversationEventAdapter.kt b/app/src/main/java/org/linphone/ui/main/chat/adapter/ConversationEventAdapter.kt index 1032e5a7e..0e7d8b4c5 100644 --- a/app/src/main/java/org/linphone/ui/main/chat/adapter/ConversationEventAdapter.kt +++ b/app/src/main/java/org/linphone/ui/main/chat/adapter/ConversationEventAdapter.kt @@ -149,14 +149,12 @@ class ConversationEventAdapter( private class EventLogDiffCallback : DiffUtil.ItemCallback() { override fun areItemsTheSame(oldItem: EventLogModel, newItem: EventLogModel): Boolean { - return if (oldItem.isEvent && newItem.isEvent) { - oldItem.notifyId == newItem.notifyId - } else if (!oldItem.isEvent && !newItem.isEvent) { + return if (!oldItem.isEvent && !newItem.isEvent) { val oldData = (oldItem.model as ChatMessageModel) val newData = (newItem.model as ChatMessageModel) - oldData.id.isNotEmpty() && oldData.id == newData.id + oldData.time == newData.time && oldData.isOutgoing == newData.isOutgoing } else { - false + oldItem.notifyId == newItem.notifyId } } diff --git a/app/src/main/res/layout/chat_bubble_incoming.xml b/app/src/main/res/layout/chat_bubble_incoming.xml index 4ea506cca..0ab7cac46 100644 --- a/app/src/main/res/layout/chat_bubble_incoming.xml +++ b/app/src/main/res/layout/chat_bubble_incoming.xml @@ -19,8 +19,9 @@ android:onLongClick="@{onLongClickListener}" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="@{model.isGroupedWithPreviousOne ? @dimen/chat_bubble_grouped_top_margin : @dimen/chat_bubble_top_margin, default=@dimen/chat_bubble_top_margin}" - android:layout_marginStart="16dp"> + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" + android:layout_marginTop="@{model.isGroupedWithPreviousOne ? @dimen/chat_bubble_grouped_top_margin : @dimen/chat_bubble_top_margin, default=@dimen/chat_bubble_top_margin}"> + + + app:layout_constraintEnd_toEndOf="@id/background_end_barrier" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent"/> - - - - - - - - - + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintStart_toEndOf="@id/avatar" + app:layout_constraintEnd_toEndOf="parent"/> + app:layout_constraintStart_toStartOf="@id/text_message"/> 4dp 16dp 110dp + 12dp + 5dp \ No newline at end of file