Fixed chat room list cell UI glitch during last update time computation

This commit is contained in:
Sylvain Berfini 2022-06-13 15:15:04 +02:00
parent 312ae2eaf0
commit f118ccf049
3 changed files with 4 additions and 8 deletions

View file

@ -130,7 +130,7 @@ class ChatRoomData(private val chatRoom: ChatRoom) : ContactDataInterface {
if (chatRoom.participants.isNotEmpty()) {
chatRoom.participants[0].address
} else {
Log.e("[Chat Room] $chatRoom doesn't have any participant in state ${chatRoom.state}!")
Log.e("[Chat Room] $chatRoom doesn't have any participant (state ${chatRoom.state})!")
null
}
}
@ -141,6 +141,7 @@ class ChatRoomData(private val chatRoom: ChatRoom) : ContactDataInterface {
private fun formatLastMessage(msg: ChatMessage?) {
val lastUpdateTime = chatRoom.lastUpdateTime
lastUpdate.value = "00:00"
coroutineScope.launch {
withContext(Dispatchers.IO) {
lastUpdate.postValue(TimestampUtils.toString(lastUpdateTime, true))

View file

@ -295,7 +295,7 @@ class ChatRoomViewModel(val chatRoom: ChatRoom) : ViewModel(), ContactDataInterf
if (chatRoom.participants.isNotEmpty()) {
chatRoom.participants[0].address
} else {
Log.e("[Chat Room] $chatRoom doesn't have any participant in state ${chatRoom.state}!")
Log.e("[Chat Room] $chatRoom doesn't have any participant (state ${chatRoom.state})!")
null
}
}

View file

@ -38,18 +38,13 @@
style="@style/toolbar_small_title_font"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.6"
android:layout_weight="0.8"
android:gravity="center"
android:padding="15dp"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/chat_room_devices_fragment_title" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2" />
</LinearLayout>
<androidx.core.widget.NestedScrollView