fix #377, properly export all fields to .vcf files

This commit is contained in:
tibbi 2019-06-14 22:48:48 +02:00
parent 687f9a0086
commit 99b04843e5
2 changed files with 5 additions and 6 deletions

View File

@ -527,13 +527,12 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
viewpager.currentItem = config.lastUsedViewPagerPage
}
ContactsHelper(this).getContacts {
ContactsHelper(this).getContacts { contacts ->
isGettingContacts = false
if (isDestroyed) {
return@getContacts
}
val contacts = it
if (refreshTabsMask and CONTACTS_TAB_MASK != 0) {
contacts_fragment?.refreshContacts(contacts)
}

View File

@ -28,11 +28,11 @@ class ContactsHelper(val context: Context) {
private val BATCH_SIZE = 100
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 {
val contacts = SparseArray<Contact>()
displayContactSources = context.getVisibleContactSources()
if (ignoredContactSources != null) {
if (ignoredContactSources.isNotEmpty()) {
displayContactSources = context.getAllContactSources().filter {
!ignoredContactSources.contains(it.getFullIdentifier())
}.map { it.getFullIdentifier() }.toMutableList() as ArrayList
@ -52,7 +52,7 @@ class ContactsHelper(val context: Context) {
val resultContacts = ArrayList<Contact>(contactsSize)
(0 until contactsSize).filter {
if (ignoredContactSources == null && showOnlyContactsWithNumbers) {
if (ignoredContactSources.isEmpty() && showOnlyContactsWithNumbers) {
contacts.valueAt(it).phoneNumbers.isNotEmpty()
} else {
true
@ -61,7 +61,7 @@ class ContactsHelper(val context: Context) {
contacts.valueAt(it)
}
if (ignoredContactSources == null && context.config.filterDuplicates) {
if (ignoredContactSources.isEmpty() && context.config.filterDuplicates) {
tempContacts = tempContacts.distinctBy {
it.getHashToCompare()
} as ArrayList<Contact>