mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-01-10 22:54:39 +01:00
fix #769, import whole address from .vcf files
This commit is contained in:
parent
7d6c21c102
commit
9f0e736ec3
@ -83,7 +83,7 @@ class VcfImporter(val activity: SimpleActivity) {
|
||||
|
||||
val addresses = ArrayList<Address>()
|
||||
ezContact.addresses.forEach {
|
||||
val address = it.streetAddress
|
||||
var address = it.streetAddress ?: ""
|
||||
val type = getAddressTypeId(it.types.firstOrNull()?.value ?: HOME)
|
||||
val label = if (type == StructuredPostal.TYPE_CUSTOM) {
|
||||
it.types.firstOrNull()?.value ?: ""
|
||||
@ -91,7 +91,28 @@ class VcfImporter(val activity: SimpleActivity) {
|
||||
""
|
||||
}
|
||||
|
||||
if (address?.isNotEmpty() == true) {
|
||||
if (it.locality?.isNotEmpty() == true) {
|
||||
address += " ${it.locality} "
|
||||
}
|
||||
|
||||
if (it.region?.isNotEmpty() == true) {
|
||||
if (address.isNotEmpty()) {
|
||||
address = "${address.trim()}, "
|
||||
}
|
||||
address += "${it.region} "
|
||||
}
|
||||
|
||||
if (it.postalCode?.isNotEmpty() == true) {
|
||||
address += "${it.postalCode} "
|
||||
}
|
||||
|
||||
if (it.country?.isNotEmpty() == true) {
|
||||
address += "${it.country} "
|
||||
}
|
||||
|
||||
address = address.trim()
|
||||
|
||||
if (address.isNotEmpty()) {
|
||||
addresses.add(Address(address, type, label))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user