mirror of
				https://github.com/SimpleMobileTools/Simple-Contacts.git
				synced 2025-06-05 21:59:27 +02:00 
			
		
		
		
	Merge pull request #875 from Naveen3Singh/add_extension
Export formatted name as well as structured name
This commit is contained in:
		| @@ -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' | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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") | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user