Show forward icon in front of conversation last message if it has been forwarded

This commit is contained in:
Sylvain Berfini 2024-11-13 17:14:06 +01:00
parent a96940b94a
commit f74976f563
2 changed files with 19 additions and 2 deletions

View file

@ -77,6 +77,8 @@ class ConversationModel @WorkerThread constructor(val chatRoom: ChatRoom) {
val lastMessageIcon = MutableLiveData<Int>()
val isLastMessageForwarded = MutableLiveData<Boolean>()
val isLastMessageOutgoing = MutableLiveData<Boolean>()
val dateTime = MutableLiveData<String>()
@ -290,6 +292,7 @@ class ConversationModel @WorkerThread constructor(val chatRoom: ChatRoom) {
if (isOutgoing) {
lastMessageIcon.postValue(LinphoneUtils.getChatIconResId(message.state))
}
isLastMessageForwarded.postValue(message.isForward)
}
@WorkerThread

View file

@ -93,10 +93,24 @@
android:visibility="@{model.lastMessageTextSender.length() > 0 ? View.VISIBLE : View.GONE}"
textFont="@{model.isBeingDeleted || model.unreadMessageCount > 0 || model.isComposing ? NotoSansFont.NotoSansBold : NotoSansFont.NotoSansRegular}"
app:layout_constraintStart_toStartOf="@id/title"
app:layout_constraintEnd_toStartOf="@id/last_message_or_composing"
app:layout_constraintEnd_toStartOf="@id/last_message_forward"
app:layout_constraintTop_toBottomOf="@id/title"
app:layout_constraintBottom_toTopOf="@id/separator"/>
<ImageView
android:id="@+id/last_message_forward"
android:layout_width="@dimen/small_icon_size"
android:layout_height="@dimen/small_icon_size"
android:layout_marginStart="@{model.lastMessageTextSender.length() > 0 ? @dimen/five : @dimen/zero}"
android:layout_marginEnd="5dp"
android:layout_marginTop="3dp"
android:src="@drawable/forward"
android:visibility="@{model.isLastMessageForwarded ? View.VISIBLE : View.GONE, default=gone}"
app:layout_constraintStart_toEndOf="@id/last_message_sender"
app:layout_constraintEnd_toStartOf="@id/last_message_or_composing"
app:layout_constraintTop_toTopOf="@id/last_message_or_composing"
app:layout_constraintBottom_toBottomOf="@id/last_message_or_composing"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:id="@+id/last_message_or_composing"
@ -109,7 +123,7 @@
android:textSize="14sp"
android:textColor="?attr/color_main2_400"
textFont="@{model.isBeingDeleted || model.unreadMessageCount > 0 || model.isComposing ? NotoSansFont.NotoSansBold : NotoSansFont.NotoSansRegular}"
app:layout_constraintStart_toEndOf="@id/last_message_sender"
app:layout_constraintStart_toEndOf="@id/last_message_forward"
app:layout_constraintEnd_toStartOf="@id/right_border"
app:layout_constraintTop_toTopOf="@id/last_message_sender"
app:layout_constraintBottom_toBottomOf="@id/last_message_sender" />