add some support for SimpleContact contains multiple phone numbers
This commit is contained in:
parent
f3973a20d7
commit
842908a21e
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<String>
|
||||
SimpleContact(contact.id, contact.id, contact.getNameToDisplay(), contact.photoUri, phoneNumbers)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue