Updated chat message long press menu

This commit is contained in:
Sylvain Berfini 2024-11-26 09:25:24 +01:00
parent 363ce834fa
commit 0b0d7ce85a
11 changed files with 59 additions and 18 deletions

View file

@ -775,6 +775,15 @@ open class ConversationFragment : SlidingPaneChildFragment() {
}
}
messageLongPressViewModel.showImdnInfoEvent.observe(viewLifecycleOwner) {
it.consume {
val model = messageLongPressViewModel.messageModel.value
if (model != null) {
showBottomSheetDialog(model, showDelivery = true)
}
}
}
messageLongPressViewModel.replyToMessageEvent.observe(viewLifecycleOwner) {
it.consume {
val model = messageLongPressViewModel.messageModel.value

View file

@ -54,6 +54,10 @@ class ChatMessageLongPressViewModel : GenericViewModel() {
val isMessageInError = MutableLiveData<Boolean>()
val showImdnInfoEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
val replyToMessageEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
@ -108,6 +112,12 @@ class ChatMessageLongPressViewModel : GenericViewModel() {
dismiss()
}
@UiThread
fun showInfo() {
showImdnInfoEvent.value = Event(true)
dismiss()
}
@UiThread
fun reply() {
Log.i("$TAG Replying to message")

View file

@ -1,9 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="28dp"
android:height="28dp"
android:viewportWidth="28"
android:viewportHeight="28">
android:width="22dp"
android:height="22dp"
android:viewportWidth="22"
android:viewportHeight="22">
<path
android:pathData="M25.422,14.19L17.089,22.523C16.973,22.64 16.824,22.719 16.662,22.751C16.501,22.784 16.333,22.767 16.181,22.704C16.028,22.641 15.898,22.534 15.807,22.397C15.715,22.26 15.666,22.098 15.666,21.934V17.791C9.718,18.128 5.64,21.986 4.496,23.208C4.316,23.399 4.08,23.53 3.822,23.58C3.564,23.63 3.296,23.598 3.058,23.487C2.819,23.377 2.622,23.194 2.493,22.964C2.364,22.735 2.311,22.471 2.342,22.21C2.728,18.849 4.569,15.617 7.525,13.109C9.98,11.026 12.964,9.704 15.666,9.472V5.267C15.666,5.102 15.715,4.941 15.807,4.804C15.898,4.667 16.028,4.56 16.181,4.497C16.333,4.434 16.501,4.417 16.662,4.449C16.824,4.482 16.973,4.561 17.089,4.678L25.422,13.011C25.5,13.088 25.561,13.18 25.603,13.281C25.645,13.382 25.667,13.491 25.667,13.6C25.667,13.71 25.645,13.818 25.603,13.92C25.561,14.021 25.5,14.113 25.422,14.19Z"
android:pathData="M19.975,11.149L13.427,17.697C13.336,17.788 13.219,17.851 13.092,17.876C12.965,17.902 12.833,17.889 12.713,17.839C12.594,17.789 12.491,17.705 12.419,17.598C12.347,17.49 12.309,17.363 12.309,17.234V13.979C7.636,14.244 4.432,17.274 3.532,18.235C3.391,18.385 3.206,18.488 3.003,18.527C2.8,18.567 2.59,18.541 2.403,18.454C2.215,18.368 2.06,18.224 1.959,18.044C1.858,17.863 1.816,17.656 1.84,17.45C2.143,14.81 3.59,12.271 5.912,10.3C7.841,8.663 10.186,7.624 12.309,7.443V4.139C12.309,4.009 12.347,3.882 12.419,3.775C12.491,3.667 12.594,3.583 12.713,3.533C12.833,3.484 12.965,3.471 13.092,3.496C13.219,3.521 13.336,3.584 13.427,3.675L19.975,10.223C20.035,10.284 20.084,10.356 20.117,10.435C20.15,10.515 20.167,10.6 20.167,10.686C20.167,10.772 20.15,10.857 20.117,10.937C20.084,11.016 20.035,11.089 19.975,11.149Z"
android:fillColor="#6C7A87"/>
</vector>

View file

@ -1,9 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="28dp"
android:height="28dp"
android:viewportWidth="28"
android:viewportHeight="28">
android:width="22dp"
android:height="22dp"
android:viewportWidth="22"
android:viewportHeight="22">
<path
android:pathData="M2.578,14.19L10.911,22.523C11.027,22.64 11.176,22.719 11.338,22.751C11.499,22.784 11.667,22.767 11.819,22.704C11.972,22.641 12.102,22.534 12.193,22.397C12.285,22.26 12.334,22.098 12.334,21.934V17.791C18.281,18.128 22.36,21.986 23.504,23.208C23.684,23.399 23.92,23.53 24.178,23.58C24.436,23.63 24.704,23.598 24.942,23.487C25.181,23.377 25.378,23.194 25.507,22.964C25.636,22.735 25.689,22.471 25.658,22.21C25.272,18.849 23.431,15.617 20.475,13.109C18.02,11.026 15.036,9.704 12.334,9.472V5.267C12.334,5.102 12.285,4.941 12.193,4.804C12.102,4.667 11.972,4.56 11.819,4.497C11.667,4.434 11.499,4.417 11.338,4.449C11.176,4.482 11.027,4.561 10.911,4.678L2.578,13.011C2.5,13.088 2.439,13.18 2.397,13.281C2.355,13.382 2.333,13.491 2.333,13.6C2.333,13.71 2.355,13.818 2.397,13.92C2.439,14.021 2.5,14.113 2.578,14.19Z"
android:pathData="M2.025,11.149L8.573,17.697C8.664,17.788 8.781,17.851 8.908,17.876C9.035,17.902 9.167,17.889 9.287,17.839C9.406,17.789 9.509,17.705 9.581,17.598C9.653,17.49 9.691,17.363 9.691,17.234V13.979C14.364,14.244 17.568,17.274 18.468,18.235C18.609,18.385 18.794,18.488 18.997,18.527C19.2,18.567 19.41,18.541 19.597,18.454C19.785,18.368 19.94,18.224 20.041,18.044C20.142,17.863 20.184,17.656 20.16,17.45C19.857,14.81 18.41,12.271 16.088,10.3C14.159,8.663 11.814,7.624 9.691,7.443V4.139C9.691,4.009 9.653,3.882 9.581,3.775C9.509,3.667 9.406,3.583 9.287,3.533C9.167,3.484 9.035,3.471 8.908,3.496C8.781,3.521 8.664,3.584 8.573,3.675L2.025,10.223C1.965,10.284 1.916,10.356 1.883,10.435C1.85,10.515 1.833,10.6 1.833,10.686C1.833,10.772 1.85,10.857 1.883,10.937C1.916,11.016 1.965,11.089 2.025,11.149Z"
android:fillColor="#6C7A87"/>
</vector>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
<corners android:radius="10dp" />
<solid android:color="?attr/color_grey_200"/>
</shape>

View file

@ -112,6 +112,20 @@
android:background="?attr/color_main2_200"
android:visibility="@{viewModel.isMessageInError &amp;&amp; viewModel.isMessageOutgoing ? View.VISIBLE : View.GONE, default=gone}"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/popup_menu_action_label_style"
android:id="@+id/action_info"
android:onClick="@{() -> viewModel.showInfo()}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/menu_show_imdn"
android:drawableEnd="@drawable/check" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/color_main2_200"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/popup_menu_action_label_style"
android:id="@+id/action_reply"

View file

@ -20,8 +20,8 @@
<ImageView
android:id="@+id/emojis_background"
android:layout_width="0dp"
android:layout_height="70dp"
android:src="@drawable/shape_squircle_white_background"
android:layout_height="50dp"
android:src="@drawable/shape_squircle_white_r50_background"
android:contentDescription="@null"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"

View file

@ -707,6 +707,7 @@
<string name="menu_delete_selected_item">Supprimer</string>
<string name="menu_invite">Inviter</string>
<string name="menu_resend_chat_message">Ré-envoyer</string>
<string name="menu_show_imdn">Info</string>
<string name="menu_reply_to_chat_message">Répondre</string>
<string name="menu_forward_chat_message">Transférer</string>
<string name="menu_copy_chat_message">Copier le texte</string>

View file

@ -81,7 +81,7 @@
<dimen name="chat_bubble_top_margin">8dp</dimen>
<dimen name="chat_bubble_grouped_bottom_margin">2dp</dimen>
<dimen name="chat_bubble_bottom_margin">8dp</dimen>
<dimen name="chat_bubble_long_press_emoji_reaction_size">30dp</dimen>
<dimen name="chat_bubble_long_press_emoji_reaction_size">25dp</dimen>
<dimen name="chat_bubble_grid_image_size">87dp</dimen>
<dimen name="chat_bubble_big_image_max_size">150dp</dimen>
<dimen name="chat_bubble_grid_file_width">152dp</dimen> <!-- 271 - 87 - 32 -->

View file

@ -745,6 +745,7 @@
<string name="menu_delete_selected_item">Delete</string>
<string name="menu_invite">Invite</string>
<string name="menu_resend_chat_message">Re-send</string>
<string name="menu_show_imdn">Info</string>
<string name="menu_reply_to_chat_message">Reply</string>
<string name="menu_forward_chat_message">Forward</string>
<string name="menu_copy_chat_message">Copy</string>

View file

@ -119,21 +119,27 @@
</style>
<style name="popup_menu_action_label_style">
<item name="android:fontFamily">@font/noto_sans</item>
<item name="android:textSize">14sp</item>
<item name="android:textSize">12sp</item>
<item name="android:textColor">?attr/color_main2_500</item>
<item name="android:maxLines">1</item>
<item name="android:ellipsize">end</item>
<item name="android:padding">15dp</item>
<item name="android:paddingStart">15dp</item>
<item name="android:paddingEnd">15dp</item>
<item name="android:paddingTop">10dp</item>
<item name="android:paddingBottom">10dp</item>
<item name="android:drawableTint">?attr/color_main2_500</item>
<item name="android:drawablePadding">8dp</item>
</style>
<style name="popup_menu_danger_action_label_style">
<item name="android:fontFamily">@font/noto_sans</item>
<item name="android:textSize">14sp</item>
<item name="android:textSize">12sp</item>
<item name="android:textColor">?attr/color_danger_500</item>
<item name="android:maxLines">1</item>
<item name="android:ellipsize">end</item>
<item name="android:padding">15dp</item>
<item name="android:paddingStart">15dp</item>
<item name="android:paddingEnd">15dp</item>
<item name="android:paddingTop">10dp</item>
<item name="android:paddingBottom">10dp</item>
<item name="android:drawableTint">?attr/color_danger_500</item>
<item name="android:drawablePadding">8dp</item>
</style>