Improved display of emoji reactions above chat messages

This commit is contained in:
Sylvain Berfini 2023-09-05 17:09:25 +02:00
parent 555e2a1330
commit 1e552a94bf
4 changed files with 18 additions and 5 deletions

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/chat_bubble_incoming_color"/>
<stroke android:width="1dp" android:color="@color/white_color" />
<corners android:radius="@dimen/chat_message_round_corner_radius"/>
</shape>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/chat_bubble_outgoing_color"/>
<stroke android:width="1dp" android:color="@color/white_color" />
<corners android:radius="@dimen/chat_message_round_corner_radius"/>
</shape>

View file

@ -200,22 +200,23 @@
<LinearLayout
android:onClick="@{() -> data.showReactionsList()}"
android:visibility="@{data.reactions.size() > 0 ? View.VISIBLE : View.GONE, default=gone}"
android:id="@+id/reactions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/chat_bubble_outgoing_full"
backgroundImage="@{data.backgroundRes, default=@drawable/chat_bubble_outgoing_full}"
android:background="@{data.chatMessage.outgoing ? @drawable/chat_bubble_outgoing_reactions : @drawable/chat_bubble_incoming_reactions, default=@drawable/chat_bubble_outgoing_reactions}"
android:padding="2dp"
android:layout_marginTop="-10dp"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
android:layout_below="@id/background"
android:layout_alignLeft="@{data.chatMessage.outgoing || selectionListViewModel.isEditionEnabled ? 0 : @id/background}"
android:layout_alignRight="@{data.chatMessage.outgoing || selectionListViewModel.isEditionEnabled ? @id/background : 0}"
android:orientation="horizontal"
android:gravity="center_vertical"
entries="@{data.reactions}"
layout="@{@layout/chat_message_reaction}" />
layout="@{@layout/chat_message_reaction}"/>
<TextView
android:id="@+id/time"

View file

@ -32,7 +32,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="@{data.contact.name ?? data.displayName}"
android:text="@{data.contact.name ?? data.displayName, default=`John Doe`}"
app:layout_constraintStart_toEndOf="@id/avatar"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
@ -43,7 +43,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:text="@{data.reaction}"
android:text="@{data.reaction, default=@string/emoji_love}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>