Merge pull request #875 from Naveen3Singh/add_extension

Export formatted name as well as structured name
This commit is contained in:
Tibor Kaputa 2022-09-01 11:59:58 +02:00 committed by GitHub
commit c38bb2a759
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 10 deletions

View File

@ -63,7 +63,7 @@ android {
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:f6ddbdf19b'
implementation 'com.github.SimpleMobileTools:Simple-Commons:141660c8f9'
implementation 'com.googlecode.ez-vcard:ez-vcard:0.11.3'
implementation 'com.github.tibbi:IndicatorFastScroll:4524cd0b61'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'

View File

@ -27,7 +27,6 @@ import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.letterBackgroundColors
import com.simplemobiletools.commons.models.RadioItem
import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.extensions.sendEmailIntent
import com.simplemobiletools.contacts.pro.extensions.shareContacts
import com.simplemobiletools.contacts.pro.helpers.ContactsHelper
import com.simplemobiletools.contacts.pro.models.Contact

View File

@ -11,7 +11,9 @@ import android.os.Looper
import android.provider.ContactsContract
import androidx.core.content.FileProvider
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.helpers.PERMISSION_READ_CONTACTS
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_CONTACTS
import com.simplemobiletools.commons.helpers.SimpleContactsHelper
import com.simplemobiletools.contacts.pro.BuildConfig
import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.databases.ContactsDatabase
@ -40,13 +42,6 @@ fun Context.getEmptyContact(): Contact {
)
}
fun Context.sendEmailIntent(recipient: String) {
Intent(Intent.ACTION_SENDTO).apply {
data = Uri.fromParts(KEY_MAILTO, recipient, null)
launchActivityIntent(this)
}
}
fun Context.sendAddressIntent(address: String) {
val location = Uri.encode(address)
val uri = Uri.parse("geo:0,0?q=$location")

View File

@ -51,6 +51,12 @@ class VcfExporter {
val cards = ArrayList<VCard>()
for (contact in contacts) {
val card = VCard()
val formattedName = arrayOf(contact.prefix, contact.firstName, contact.middleName, contact.surname, contact.suffix)
.filter { it.isNotEmpty() }
.joinToString(separator = " ")
card.formattedName = FormattedName(formattedName)
StructuredName().apply {
prefixes.add(contact.prefix)
given = contact.firstName