From 3837ffedb11a9cd988d5c6f3ab0f9edab73a42ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Apitzsch?= Date: Mon, 26 Sep 2022 16:54:17 +0200 Subject: [PATCH] Fix display of names if contact contains organization data (#743) --- .../contacts/pro/helpers/ContactsHelper.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt index fdc677d3..acdc6134 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt @@ -722,8 +722,14 @@ class ContactsHelper(val context: Context) { var middleName = "" var surname = "" var suffix = "" - val mimetype = cursor.getStringValue(Data.MIMETYPE) + var mimetype = cursor.getStringValue(Data.MIMETYPE) + // if first line is an Organization type contact, go to next line + if (mimetype != StructuredName.CONTENT_ITEM_TYPE) { + if (cursor.moveToNext()) { + mimetype = cursor.getStringValue(Data.MIMETYPE) + } + } // ignore names at Organization type contacts if (mimetype == StructuredName.CONTENT_ITEM_TYPE) { prefix = cursor.getStringValue(StructuredName.PREFIX) ?: ""