diff --git a/app/src/main/res/layout/item_room_category.xml b/app/src/main/res/layout/item_room_category.xml index 29c12dfa62..f84f9c42f3 100644 --- a/app/src/main/res/layout/item_room_category.xml +++ b/app/src/main/res/layout/item_room_category.xml @@ -11,7 +11,7 @@ android:gravity="center_vertical" android:paddingLeft="16dp" android:paddingTop="8dp" - android:paddingRight="16dp" + android:paddingRight="8dp" android:paddingBottom="8dp" tools:background="@color/pale_grey"> diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/database/query/EventEntityQueries.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/database/query/EventEntityQueries.kt index 80e194e339..015a47acfe 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/database/query/EventEntityQueries.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/database/query/EventEntityQueries.kt @@ -51,10 +51,15 @@ internal fun EventEntity.Companion.where(realm: Realm, internal fun EventEntity.Companion.latestEvent(realm: Realm, roomId: String, + includedTypes: List = emptyList(), excludedTypes: List = emptyList()): EventEntity? { val query = ChunkEntity.findLastLiveChunkFromRoom(realm, roomId)?.events?.where() + if (includedTypes.isNotEmpty()) { + query?.`in`(EventEntityFields.TYPE, includedTypes.toTypedArray()) + } else if (excludedTypes.isNotEmpty()) { + query?.not()?.`in`(EventEntityFields.TYPE, excludedTypes.toTypedArray()) + } return query - ?.not()?.`in`(EventEntityFields.TYPE, excludedTypes.toTypedArray()) ?.sort(EventEntityFields.DISPLAY_INDEX) ?.findFirst() } diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/RoomSummaryUpdater.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/RoomSummaryUpdater.kt index 3e5fe1b198..4d69083219 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/RoomSummaryUpdater.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/RoomSummaryUpdater.kt @@ -58,7 +58,7 @@ internal class RoomSummaryUpdater(monarchy: Monarchy, val roomSummary = RoomSummaryEntity.where(realm, roomId).findFirst() ?: realm.createObject(roomId) - val lastEvent = EventEntity.latestEvent(realm, roomId) + val lastEvent = EventEntity.latestEvent(realm, roomId, includedTypes = listOf(EventType.MESSAGE)) val lastTopicEvent = EventEntity.where(realm, roomId, EventType.STATE_ROOM_TOPIC).last()?.asDomain() val otherRoomMembers = RoomMembers(realm, roomId).getLoaded().filterKeys { it != credentials.userId }