From 4e292ae130b39317be0e995ab768e57fb28b6667 Mon Sep 17 00:00:00 2001 From: JamesL813 Date: Mon, 16 May 2022 21:48:41 -0400 Subject: [PATCH 1/7] initial commit --- .../kotlin/com/simplemobiletools/contacts/pro/models/Contact.kt | 2 +- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 3 insertions(+), 3 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 ae7c32dc..87525aec 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) surname else firstMiddle + val firstPart = if (startWithSurname) surname else firstMiddle //TODO val lastPart = if (startWithSurname) firstMiddle else surname val suffixComma = if (suffix.isEmpty()) "" else ", $suffix" val fullName = "$prefix $firstPart $lastPart$suffixComma".trim() diff --git a/build.gradle b/build.gradle index aada3166..1e0ad90c 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.1.2' + classpath 'com.android.tools.build:gradle:7.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 19fb4f1f..1dd21529 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip From 6f83def86220031ee23483a7a3aabd69125361be Mon Sep 17 00:00:00 2001 From: JamesL813 Date: Mon, 16 May 2022 21:52:48 -0400 Subject: [PATCH 2/7] Added a comme when displaying surname first: "Lastname, 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 87525aec..38191b6c 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) surname else firstMiddle //TODO + val firstPart = if (startWithSurname) if (surname.isNotEmpty()) "$surname," else "" else firstMiddle //TODO val lastPart = if (startWithSurname) firstMiddle else surname val suffixComma = if (suffix.isEmpty()) "" else ", $suffix" val fullName = "$prefix $firstPart $lastPart$suffixComma".trim() From bbf2c45c09fd56e079997da6d83ee72edc0c61b9 Mon Sep 17 00:00:00 2001 From: JamesL813 Date: Mon, 16 May 2022 21:53:29 -0400 Subject: [PATCH 3/7] Added a comme when displaying surname first: "Lastname, 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 38191b6c..302e7d1d 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 //TODO + val firstPart = if (startWithSurname) if (surname.isNotEmpty()) "$surname," else "" else firstMiddle val lastPart = if (startWithSurname) firstMiddle else surname val suffixComma = if (suffix.isEmpty()) "" else ", $suffix" val fullName = "$prefix $firstPart $lastPart$suffixComma".trim() From a9750cae4a62f46f4be604f4d5b007aac2539560 Mon Sep 17 00:00:00 2001 From: JamesL813 Date: Mon, 16 May 2022 21:57:31 -0400 Subject: [PATCH 4/7] Added a comme when displaying surname first: "Lastname, Firstname" --- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 1e0ad90c..aada3166 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.2.0' + classpath 'com.android.tools.build:gradle:7.1.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1dd21529..19fb4f1f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip From fcbbd7bd152fdc18c739d4645d2864f76197a862 Mon Sep 17 00:00:00 2001 From: JamesL813 Date: Mon, 16 May 2022 22:07:01 -0400 Subject: [PATCH 5/7] 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() From 8a6a51db044cb99345f52fb409dab30cc5384f3f Mon Sep 17 00:00:00 2001 From: JamesL813 Date: Tue, 17 May 2022 16:08:53 -0400 Subject: [PATCH 6/7] Separated line with brackets for readability --- .../com/simplemobiletools/contacts/pro/models/Contact.kt | 5 ++++- 1 file changed, 4 insertions(+), 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 8e89ceed..5fed25e7 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,10 @@ data class Contact( fun getNameToDisplay(): String { val firstMiddle = "$firstName $middleName".trim() - val firstPart = if (startWithSurname) if (surname.isNotEmpty() && firstMiddle.isNotEmpty()) "$surname," else surname 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() From 4c4b69b80fb8147d60d67b68bbf6e5643ee33cc2 Mon Sep 17 00:00:00 2001 From: JamesL813 Date: Tue, 17 May 2022 19:17:04 -0400 Subject: [PATCH 7/7] More lines for readability --- .../com/simplemobiletools/contacts/pro/models/Contact.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 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 5fed25e7..4011ccc5 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 @@ -110,8 +110,13 @@ data class Contact( val firstMiddle = "$firstName $middleName".trim() val firstPart = if (startWithSurname) { if (surname.isNotEmpty() && firstMiddle.isNotEmpty()) { - "$surname," } else { surname } - } else { firstMiddle } + "$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()