From e811c53c44d9b108e0a062c3498b952677a79427 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 7 Apr 2021 15:24:00 +0200 Subject: [PATCH] Improve "was" fallback for Empty rooms. --- .../room/VectorRoomDisplayNameFallbackProvider.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/app/features/room/VectorRoomDisplayNameFallbackProvider.kt b/vector/src/main/java/im/vector/app/features/room/VectorRoomDisplayNameFallbackProvider.kt index a5f1ff58d6..33e63434ce 100644 --- a/vector/src/main/java/im/vector/app/features/room/VectorRoomDisplayNameFallbackProvider.kt +++ b/vector/src/main/java/im/vector/app/features/room/VectorRoomDisplayNameFallbackProvider.kt @@ -32,7 +32,14 @@ class VectorRoomDisplayNameFallbackProvider( return if (leftMemberNames.isEmpty()) { context.getString(R.string.room_displayname_empty_room) } else { - context.getString(R.string.room_displayname_empty_room_was, leftMemberNames.joinToString()) + val was = when (val size = leftMemberNames.size) { + 1 -> getNameFor1member(leftMemberNames[0]) + 2 -> getNameFor2members(leftMemberNames[0], leftMemberNames[1]) + 3 -> getNameFor3members(leftMemberNames[0], leftMemberNames[1], leftMemberNames[2]) + 4 -> getNameFor4members(leftMemberNames[0], leftMemberNames[1], leftMemberNames[2], leftMemberNames[3]) + else -> getNameFor4membersAndMore(leftMemberNames[0], leftMemberNames[1], leftMemberNames[2], size - 3) + } + context.getString(R.string.room_displayname_empty_room_was, was) } }