diff --git a/app/src/main/java/org/linphone/ui/main/chat/model/MessageModel.kt b/app/src/main/java/org/linphone/ui/main/chat/model/MessageModel.kt index a9969774d..5bbdaf37e 100644 --- a/app/src/main/java/org/linphone/ui/main/chat/model/MessageModel.kt +++ b/app/src/main/java/org/linphone/ui/main/chat/model/MessageModel.kt @@ -117,6 +117,8 @@ class MessageModel @WorkerThread constructor( val reactions = MutableLiveData() + val ourReactionIndex = MutableLiveData() + val filesList = MutableLiveData>() val firstFileModel = MediatorLiveData() @@ -531,8 +533,23 @@ class MessageModel @WorkerThread constructor( reactionsList += " $count" } } - Log.d("$TAG Reactions for message [$id] are [$reactionsList]") + + val ourOwnReaction = chatMessage.ownReaction + if (ourOwnReaction != null) { + val index = when (ourOwnReaction.body) { + AppUtils.getString(R.string.emoji_thumbs_up) -> 0 + AppUtils.getString(R.string.emoji_love) -> 1 + AppUtils.getString(R.string.emoji_laughing) -> 2 + AppUtils.getString(R.string.emoji_surprised) -> 3 + AppUtils.getString(R.string.emoji_tear) -> 4 + else -> -1 + } + ourReactionIndex.postValue(index) + } else { + ourReactionIndex.postValue(-1) + } + reactions.postValue(reactionsList) } diff --git a/app/src/main/res/drawable/shape_empty.xml b/app/src/main/res/drawable/shape_empty.xml new file mode 100644 index 000000000..c3783b5ab --- /dev/null +++ b/app/src/main/res/drawable/shape_empty.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_squircle_gray_200_background.xml b/app/src/main/res/drawable/shape_squircle_gray_200_background.xml new file mode 100644 index 000000000..70bb1f978 --- /dev/null +++ b/app/src/main/res/drawable/shape_squircle_gray_200_background.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/chat_bubble_incoming.xml b/app/src/main/res/layout/chat_bubble_incoming.xml index 2fcf098f2..30222eaeb 100644 --- a/app/src/main/res/layout/chat_bubble_incoming.xml +++ b/app/src/main/res/layout/chat_bubble_incoming.xml @@ -291,7 +291,7 @@ android:background="@drawable/shape_chat_bubble_incoming_reactions_background" android:text="@{model.reactions, default=@string/emoji_love}" android:visibility="@{model.reactions.length() > 0 ? View.VISIBLE : View.GONE}" - app:layout_constraintEnd_toEndOf="@id/bubble" + app:layout_constraintStart_toStartOf="@id/bubble" app:layout_constraintTop_toBottomOf="@id/bubble" /> diff --git a/app/src/main/res/layout/chat_bubble_long_press_menu.xml b/app/src/main/res/layout/chat_bubble_long_press_menu.xml index f0e4b38d4..75ef2c9c7 100644 --- a/app/src/main/res/layout/chat_bubble_long_press_menu.xml +++ b/app/src/main/res/layout/chat_bubble_long_press_menu.xml @@ -26,12 +26,14 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginBottom="5dp" + android:layout_marginStart="10dp" + android:layout_marginEnd="10dp" android:visibility="@{viewModel.isChatRoomReadOnly ? View.GONE : View.VISIBLE}" layout="@layout/chat_emoji_reaction_picker" bind:model="@{viewModel.messageModel}" bind:pickEmojiClickListener="@{() -> viewModel.pickEmoji()}" app:layout_constraintHorizontal_bias="@{viewModel.horizontalBias, default=0}" - app:layout_constraintWidth_max="@dimen/dialog_max_width" + app:layout_constraintWidth_max="@dimen/emoji_list_max_width" app:layout_constraintBottom_toTopOf="@id/bubbles" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"/> @@ -40,8 +42,8 @@ android:id="@+id/bubbles" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" + android:layout_marginStart="10dp" + android:layout_marginEnd="10dp" android:layout_marginBottom="5dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" @@ -84,9 +86,9 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:orientation="vertical" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" - android:layout_marginBottom="60dp" + android:layout_marginStart="10dp" + android:layout_marginEnd="10dp" + android:layout_marginBottom="@dimen/screen_bottom_margin" android:background="@drawable/shape_squircle_white_background" app:layout_constraintWidth_max="250dp" app:layout_constraintHorizontal_bias="@{viewModel.horizontalBias, default=0}" diff --git a/app/src/main/res/layout/chat_emoji_reaction_picker.xml b/app/src/main/res/layout/chat_emoji_reaction_picker.xml index 13e8e8c44..cd823c49c 100644 --- a/app/src/main/res/layout/chat_emoji_reaction_picker.xml +++ b/app/src/main/res/layout/chat_emoji_reaction_picker.xml @@ -19,9 +19,7 @@ @@ -64,13 +71,16 @@ android:id="@+id/laughing" android:onClick="@{() -> model.sendReaction(@string/emoji_laughing)}" android:layout_width="wrap_content" - android:layout_height="0dp" - android:layout_marginStart="10dp" - android:layout_marginEnd="10dp" + android:layout_height="wrap_content" + android:layout_marginEnd="5dp" + android:paddingStart="10dp" + android:paddingEnd="10dp" + android:paddingBottom="3dp" android:text="@string/emoji_laughing" android:textSize="@dimen/chat_bubble_long_press_emoji_reaction_size" + android:background="@{model.ourReactionIndex == 2 ? @drawable/shape_squircle_gray_200_background : @drawable/shape_empty}" app:layout_constraintTop_toTopOf="@id/thumbs_up" - app:layout_constraintBottom_toBottomOf="@id/emojis_background" + app:layout_constraintBottom_toBottomOf="@id/thumbs_up" app:layout_constraintStart_toEndOf="@id/love" app:layout_constraintEnd_toStartOf="@id/surprised"/> @@ -79,13 +89,16 @@ android:id="@+id/surprised" android:onClick="@{() -> model.sendReaction(@string/emoji_surprised)}" android:layout_width="wrap_content" - android:layout_height="0dp" - android:layout_marginStart="10dp" - android:layout_marginEnd="10dp" + android:layout_height="wrap_content" + android:layout_marginEnd="5dp" + android:paddingStart="10dp" + android:paddingEnd="10dp" + android:paddingBottom="3dp" android:text="@string/emoji_surprised" android:textSize="@dimen/chat_bubble_long_press_emoji_reaction_size" + android:background="@{model.ourReactionIndex == 3 ? @drawable/shape_squircle_gray_200_background : @drawable/shape_empty}" app:layout_constraintTop_toTopOf="@id/thumbs_up" - app:layout_constraintBottom_toBottomOf="@id/emojis_background" + app:layout_constraintBottom_toBottomOf="@id/thumbs_up" app:layout_constraintStart_toEndOf="@id/laughing" app:layout_constraintEnd_toStartOf="@id/tear"/> @@ -94,29 +107,37 @@ android:id="@+id/tear" android:onClick="@{() -> model.sendReaction(@string/emoji_tear)}" android:layout_width="wrap_content" - android:layout_height="0dp" - android:layout_marginStart="10dp" - android:layout_marginEnd="10dp" + android:layout_height="wrap_content" + android:layout_marginEnd="5dp" + android:paddingStart="10dp" + android:paddingEnd="10dp" + android:paddingBottom="3dp" android:text="@string/emoji_tear" android:textSize="@dimen/chat_bubble_long_press_emoji_reaction_size" + android:background="@{model.ourReactionIndex == 4 ? @drawable/shape_squircle_gray_200_background : @drawable/shape_empty}" app:layout_constraintTop_toTopOf="@id/thumbs_up" - app:layout_constraintBottom_toBottomOf="@id/emojis_background" + app:layout_constraintBottom_toBottomOf="@id/thumbs_up" app:layout_constraintStart_toEndOf="@id/surprised" app:layout_constraintEnd_toStartOf="@id/plus"/> + app:layout_constraintBottom_toBottomOf="@id/thumbs_up" + app:tint="?attr/color_main2_500" /> diff --git a/app/src/main/res/values/dimen.xml b/app/src/main/res/values/dimen.xml index d567378c6..186240824 100644 --- a/app/src/main/res/values/dimen.xml +++ b/app/src/main/res/values/dimen.xml @@ -49,6 +49,7 @@ 400dp 400dp 400dp + 400dp 250dp 15dp 20dp @@ -93,7 +94,7 @@ 300dp 300dp 425dp - 300dp + 340dp 200dp