From 484d9c5abd1e82c6eb47d1672686c54fc4636d8a Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 16 Jul 2020 21:46:13 +0200 Subject: [PATCH] fix #580, always show middle name after first name --- .../com/simplemobiletools/contacts/pro/models/Contact.kt | 9 +++------ build.gradle | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) 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 9ae4245a..83e0ff17 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 @@ -93,12 +93,9 @@ data class Contact(var id: Int, var prefix: String, var firstName: String, var m } fun getNameToDisplay(): String { - var firstPart = if (startWithSurname) surname else firstName - if (middleName.isNotEmpty()) { - firstPart += " $middleName" - } - - val lastPart = if (startWithSurname) firstName else surname + val firstMiddle = "$firstName $middleName".trim() + val firstPart = if (startWithSurname) surname else firstMiddle + val lastPart = if (startWithSurname) firstMiddle else surname val suffixComma = if (suffix.isEmpty()) "" else ", $suffix" val fullName = "$prefix $firstPart $lastPart$suffixComma".trim() return if (fullName.isEmpty()) { diff --git a/build.gradle b/build.gradle index d11fae6a..7c6d8857 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:4.0.0' + classpath 'com.android.tools.build:gradle:4.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong