Improve "was" fallback for Empty rooms.

This commit is contained in:
Benoit Marty 2021-04-07 15:24:00 +02:00
parent 923715aeb3
commit e811c53c44
1 changed files with 8 additions and 1 deletions

View File

@ -32,7 +32,14 @@ class VectorRoomDisplayNameFallbackProvider(
return if (leftMemberNames.isEmpty()) { return if (leftMemberNames.isEmpty()) {
context.getString(R.string.room_displayname_empty_room) context.getString(R.string.room_displayname_empty_room)
} else { } 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)
} }
} }