mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
fix #377, properly export all fields to .vcf files
This commit is contained in:
@ -527,13 +527,12 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||||||
viewpager.currentItem = config.lastUsedViewPagerPage
|
viewpager.currentItem = config.lastUsedViewPagerPage
|
||||||
}
|
}
|
||||||
|
|
||||||
ContactsHelper(this).getContacts {
|
ContactsHelper(this).getContacts { contacts ->
|
||||||
isGettingContacts = false
|
isGettingContacts = false
|
||||||
if (isDestroyed) {
|
if (isDestroyed) {
|
||||||
return@getContacts
|
return@getContacts
|
||||||
}
|
}
|
||||||
|
|
||||||
val contacts = it
|
|
||||||
if (refreshTabsMask and CONTACTS_TAB_MASK != 0) {
|
if (refreshTabsMask and CONTACTS_TAB_MASK != 0) {
|
||||||
contacts_fragment?.refreshContacts(contacts)
|
contacts_fragment?.refreshContacts(contacts)
|
||||||
}
|
}
|
||||||
|
@ -28,11 +28,11 @@ class ContactsHelper(val context: Context) {
|
|||||||
private val BATCH_SIZE = 100
|
private val BATCH_SIZE = 100
|
||||||
private var displayContactSources = ArrayList<String>()
|
private var displayContactSources = ArrayList<String>()
|
||||||
|
|
||||||
fun getContacts(ignoredContactSources: HashSet<String>? = null, callback: (ArrayList<Contact>) -> Unit) {
|
fun getContacts(ignoredContactSources: HashSet<String> = HashSet(), callback: (ArrayList<Contact>) -> Unit) {
|
||||||
Thread {
|
Thread {
|
||||||
val contacts = SparseArray<Contact>()
|
val contacts = SparseArray<Contact>()
|
||||||
displayContactSources = context.getVisibleContactSources()
|
displayContactSources = context.getVisibleContactSources()
|
||||||
if (ignoredContactSources != null) {
|
if (ignoredContactSources.isNotEmpty()) {
|
||||||
displayContactSources = context.getAllContactSources().filter {
|
displayContactSources = context.getAllContactSources().filter {
|
||||||
!ignoredContactSources.contains(it.getFullIdentifier())
|
!ignoredContactSources.contains(it.getFullIdentifier())
|
||||||
}.map { it.getFullIdentifier() }.toMutableList() as ArrayList
|
}.map { it.getFullIdentifier() }.toMutableList() as ArrayList
|
||||||
@ -52,7 +52,7 @@ class ContactsHelper(val context: Context) {
|
|||||||
val resultContacts = ArrayList<Contact>(contactsSize)
|
val resultContacts = ArrayList<Contact>(contactsSize)
|
||||||
|
|
||||||
(0 until contactsSize).filter {
|
(0 until contactsSize).filter {
|
||||||
if (ignoredContactSources == null && showOnlyContactsWithNumbers) {
|
if (ignoredContactSources.isEmpty() && showOnlyContactsWithNumbers) {
|
||||||
contacts.valueAt(it).phoneNumbers.isNotEmpty()
|
contacts.valueAt(it).phoneNumbers.isNotEmpty()
|
||||||
} else {
|
} else {
|
||||||
true
|
true
|
||||||
@ -61,7 +61,7 @@ class ContactsHelper(val context: Context) {
|
|||||||
contacts.valueAt(it)
|
contacts.valueAt(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ignoredContactSources == null && context.config.filterDuplicates) {
|
if (ignoredContactSources.isEmpty() && context.config.filterDuplicates) {
|
||||||
tempContacts = tempContacts.distinctBy {
|
tempContacts = tempContacts.distinctBy {
|
||||||
it.getHashToCompare()
|
it.getHashToCompare()
|
||||||
} as ArrayList<Contact>
|
} as ArrayList<Contact>
|
||||||
|
Reference in New Issue
Block a user