use the contacts name at sharing, if we share only one
This commit is contained in:
parent
68082ab9ed
commit
8511cfd25a
4 changed files with 11 additions and 4 deletions
|
@ -57,7 +57,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:5.34.6'
|
||||
implementation 'com.simplemobiletools:commons:5.34.7'
|
||||
implementation 'joda-time:joda-time:2.10.3'
|
||||
implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.5'
|
||||
implementation 'com.github.tibbi:IndicatorFastScroll:c3de1d040a'
|
||||
|
|
|
@ -80,7 +80,13 @@ fun SimpleActivity.showContactSourcePicker(currentSource: String, callback: (new
|
|||
}
|
||||
|
||||
fun BaseSimpleActivity.shareContacts(contacts: ArrayList<Contact>) {
|
||||
val file = getTempFile()
|
||||
val filename = if (contacts.size == 1) {
|
||||
"${contacts.first().getNameToDisplay()}.vcf"
|
||||
} else {
|
||||
DEFAULT_FILE_NAME
|
||||
}
|
||||
|
||||
val file = getTempFile(filename)
|
||||
if (file == null) {
|
||||
toast(R.string.unknown_error_occurred)
|
||||
return
|
||||
|
|
|
@ -264,7 +264,7 @@ fun Context.sendEmailToContacts(contacts: ArrayList<Contact>) {
|
|||
}
|
||||
}
|
||||
|
||||
fun Context.getTempFile(): File? {
|
||||
fun Context.getTempFile(filename: String = DEFAULT_FILE_NAME): File? {
|
||||
val folder = File(cacheDir, "contacts")
|
||||
if (!folder.exists()) {
|
||||
if (!folder.mkdir()) {
|
||||
|
@ -273,7 +273,7 @@ fun Context.getTempFile(): File? {
|
|||
}
|
||||
}
|
||||
|
||||
return File(folder, "contacts.vcf")
|
||||
return File(folder, filename)
|
||||
}
|
||||
|
||||
fun Context.addContactsToGroup(contacts: ArrayList<Contact>, groupId: Long) {
|
||||
|
|
|
@ -29,6 +29,7 @@ const val IS_FROM_SIMPLE_CONTACTS = "is_from_simple_contacts"
|
|||
const val ADD_NEW_CONTACT_NUMBER = "add_new_contact_number"
|
||||
const val FIRST_CONTACT_ID = 1000000
|
||||
const val FIRST_GROUP_ID = 10000L
|
||||
const val DEFAULT_FILE_NAME = "contacts.vcf"
|
||||
|
||||
// extras used at third party intents
|
||||
const val KEY_NAME = "name"
|
||||
|
|
Loading…
Reference in a new issue