diff --git a/app/build.gradle b/app/build.gradle index d301aa17..ba50f42e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -57,7 +57,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.29.15' + implementation 'com.simplemobiletools:commons:5.29.16' implementation 'joda-time:joda-time:2.10.1' implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.5' implementation 'com.github.tibbi:IndicatorFastScroll:08f512858a' diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/contentproviders/MyContactsContentProvider.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/contentproviders/MyContactsContentProvider.kt index 87af748a..7ba33608 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/contentproviders/MyContactsContentProvider.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/contentproviders/MyContactsContentProvider.kt @@ -5,6 +5,7 @@ import android.content.ContentValues import android.database.Cursor import android.database.MatrixCursor import android.net.Uri +import com.google.gson.Gson import com.simplemobiletools.commons.helpers.MyContactsContentProvider import com.simplemobiletools.contacts.pro.extensions.config import com.simplemobiletools.contacts.pro.helpers.LocalContactsHelper @@ -21,16 +22,17 @@ class MyContactsContentProvider : ContentProvider() { MyContactsContentProvider.COL_CONTACT_ID, MyContactsContentProvider.COL_NAME, MyContactsContentProvider.COL_PHOTO_URI, - MyContactsContentProvider.COL_PHONE_NUMBER) + MyContactsContentProvider.COL_PHONE_NUMBERS) ) LocalContactsHelper(context!!).getPrivateSimpleContactsSync(selection == MyContactsContentProvider.FAVORITES_ONLY).forEach { + val phoneNumbers = Gson().toJson(it.phoneNumbers) matrixCursor.newRow() .add(MyContactsContentProvider.COL_RAW_ID, it.rawId) .add(MyContactsContentProvider.COL_CONTACT_ID, it.contactId) .add(MyContactsContentProvider.COL_NAME, it.name) .add(MyContactsContentProvider.COL_PHOTO_URI, it.photoUri) - .add(MyContactsContentProvider.COL_PHONE_NUMBER, it.phoneNumber) + .add(MyContactsContentProvider.COL_PHONE_NUMBERS, phoneNumbers) } return matrixCursor diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/LocalContactsHelper.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/LocalContactsHelper.kt index 1e088e4e..3519ab02 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/LocalContactsHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/LocalContactsHelper.kt @@ -157,7 +157,8 @@ class LocalContactsHelper(val context: Context) { return if (contact == null || contact.phoneNumbers.isEmpty()) { null } else { - SimpleContact(contact.id, contact.id, contact.getNameToDisplay(), contact.photoUri, contact.phoneNumbers.first().value) + val phoneNumbers = contact.phoneNumbers.map { it.value }.toMutableList() as ArrayList + SimpleContact(contact.id, contact.id, contact.getNameToDisplay(), contact.photoUri, phoneNumbers) } }