mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
Added simple (limited) message preview
This commit is contained in:
parent
9061d5c972
commit
0ecc53f59c
1 changed files with 9 additions and 1 deletions
|
@ -18,7 +18,10 @@ package im.vector.riotredesign.features.home.room.list
|
||||||
|
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import com.airbnb.epoxy.TypedEpoxyController
|
import com.airbnb.epoxy.TypedEpoxyController
|
||||||
|
import im.vector.matrix.android.api.session.events.model.EventType
|
||||||
|
import im.vector.matrix.android.api.session.events.model.toModel
|
||||||
import im.vector.matrix.android.api.session.room.model.RoomSummary
|
import im.vector.matrix.android.api.session.room.model.RoomSummary
|
||||||
|
import im.vector.matrix.android.api.session.room.model.message.MessageContent
|
||||||
import im.vector.riotredesign.core.extensions.localDateTime
|
import im.vector.riotredesign.core.extensions.localDateTime
|
||||||
import im.vector.riotredesign.core.resources.DateProvider
|
import im.vector.riotredesign.core.resources.DateProvider
|
||||||
import im.vector.riotredesign.core.resources.StringProvider
|
import im.vector.riotredesign.core.resources.StringProvider
|
||||||
|
@ -90,7 +93,12 @@ class RoomSummaryController(private val stringProvider: StringProvider,
|
||||||
val currentData = DateProvider.currentLocalDateTime()
|
val currentData = DateProvider.currentLocalDateTime()
|
||||||
val isSameDay = date.toLocalDate() == currentData.toLocalDate()
|
val isSameDay = date.toLocalDate() == currentData.toLocalDate()
|
||||||
//TODO: get formatted
|
//TODO: get formatted
|
||||||
lastMessageFormatted = lastMessage.content?.toString() ?: ""
|
if (lastMessage.type == EventType.MESSAGE) {
|
||||||
|
val content = lastMessage.content?.toModel<MessageContent>()
|
||||||
|
lastMessageFormatted = content?.body ?: ""
|
||||||
|
} else {
|
||||||
|
lastMessageFormatted = lastMessage.type
|
||||||
|
}
|
||||||
lastMessageTime = if (isSameDay) {
|
lastMessageTime = if (isSameDay) {
|
||||||
timelineDateFormatter.formatMessageHour(date)
|
timelineDateFormatter.formatMessageHour(date)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue