From fcbbd7bd152fdc18c739d4645d2864f76197a862 Mon Sep 17 00:00:00 2001 From: JamesL813 Date: Mon, 16 May 2022 22:07:01 -0400 Subject: [PATCH] Now works with only surname or only firstname --- .../kotlin/com/simplemobiletools/contacts/pro/models/Contact.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/models/Contact.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/models/Contact.kt index 302e7d1d..8e89ceed 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/models/Contact.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/models/Contact.kt @@ -108,7 +108,7 @@ data class Contact( fun getNameToDisplay(): String { val firstMiddle = "$firstName $middleName".trim() - val firstPart = if (startWithSurname) if (surname.isNotEmpty()) "$surname," else "" else firstMiddle + val firstPart = if (startWithSurname) if (surname.isNotEmpty() && firstMiddle.isNotEmpty()) "$surname," else surname else firstMiddle val lastPart = if (startWithSurname) firstMiddle else surname val suffixComma = if (suffix.isEmpty()) "" else ", $suffix" val fullName = "$prefix $firstPart $lastPart$suffixComma".trim()