mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Added chat message re-send action on long press if outgoing and in NotDelivered state
This commit is contained in:
parent
a1374d228e
commit
80994ffafb
4 changed files with 45 additions and 3 deletions
|
|
@ -532,6 +532,12 @@ class ConversationFragment : GenericFragment() {
|
|||
emojiSheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED
|
||||
}
|
||||
|
||||
layout.setResendClickListener {
|
||||
Log.i("$TAG Re-sending chat message in error state")
|
||||
chatMessageModel.resend()
|
||||
dialog.dismiss()
|
||||
}
|
||||
|
||||
layout.setReplyClickListener {
|
||||
Log.i("$TAG Updating sending area to reply to selected message")
|
||||
sendMessageViewModel.replyToMessage(chatMessageModel)
|
||||
|
|
|
|||
|
|
@ -84,6 +84,8 @@ class ChatMessageModel @WorkerThread constructor(
|
|||
|
||||
val isOutgoing = chatMessage.isOutgoing
|
||||
|
||||
val isInError = chatMessage.state == ChatMessage.State.NotDelivered
|
||||
|
||||
val statusIcon = MutableLiveData<Int>()
|
||||
|
||||
val text = MutableLiveData<Spannable>()
|
||||
|
|
@ -238,6 +240,14 @@ class ChatMessageModel @WorkerThread constructor(
|
|||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun resend() {
|
||||
coreContext.postOnCoreThread {
|
||||
Log.i("$TAG Re-sending message with ID [$id]")
|
||||
chatMessage.send()
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun joinConference() {
|
||||
coreContext.postOnCoreThread {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@
|
|||
|
||||
<data>
|
||||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="resendClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="replyClickListener"
|
||||
type="View.OnClickListener" />
|
||||
|
|
@ -160,7 +163,7 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/reply"
|
||||
app:layout_constraintBottom_toTopOf="@id/bottom_barrier"
|
||||
model="@{model}"
|
||||
layout="@layout/chat_bubble_outgoing"/>
|
||||
|
||||
|
|
@ -174,7 +177,7 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/reply"
|
||||
app:layout_constraintBottom_toTopOf="@id/bottom_barrier"
|
||||
model="@{model}"
|
||||
layout="@layout/chat_bubble_incoming"/>
|
||||
|
||||
|
|
@ -183,9 +186,31 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:background="@color/gray_main2_200"
|
||||
app:layout_constraintTop_toTopOf="@id/reply"
|
||||
app:layout_constraintTop_toTopOf="@id/bottom_barrier"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/bottom_barrier"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="top"
|
||||
app:constraint_referenced_ids="reply, resend" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/context_menu_action_label_style"
|
||||
android:id="@+id/resend"
|
||||
android:onClick="@{resendClickListener}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/menu_resend_chat_message"
|
||||
android:background="@drawable/menu_item_background"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:drawableStart="@drawable/paper_plane_tilt"
|
||||
android:visibility="@{model.isInError && model.isOutgoing ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintBottom_toTopOf="@id/reply"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/context_menu_action_label_style"
|
||||
android:id="@+id/reply"
|
||||
|
|
|
|||
|
|
@ -293,6 +293,7 @@
|
|||
<string name="menu_delete_history">Delete history</string>
|
||||
<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_reply_to_chat_message">Reply</string>
|
||||
<string name="menu_forward_chat_message">Forward</string>
|
||||
<string name="menu_copy_chat_message">Copy</string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue