add a helper function for getting contact sources synchronously

This commit is contained in:
tibbi
2018-04-30 23:41:46 +02:00
parent 24248699bc
commit 22a4cca1fe

View File

@ -637,10 +637,14 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
fun getContactSources(callback: (ArrayList<ContactSource>) -> Unit) { fun getContactSources(callback: (ArrayList<ContactSource>) -> Unit) {
Thread { Thread {
callback(getContactSourcesSync())
}.start()
}
private fun getContactSourcesSync(): ArrayList<ContactSource> {
val sources = getDeviceContactSources() val sources = getDeviceContactSources()
sources.add(ContactSource(activity.getString(R.string.phone_storage_hidden), SMT_PRIVATE)) sources.add(ContactSource(activity.getString(R.string.phone_storage_hidden), SMT_PRIVATE))
callback(ArrayList(sources)) return ArrayList(sources)
}.start()
} }
private fun getDeviceContactSources(): LinkedHashSet<ContactSource> { private fun getDeviceContactSources(): LinkedHashSet<ContactSource> {