do not show filter contact source dialog if theres no available sources
This commit is contained in:
parent
98424ebd20
commit
22b4dd0a19
|
@ -15,6 +15,10 @@ class FilterContactSourcesDialog(val activity: SimpleActivity, val callback: ()
|
|||
|
||||
init {
|
||||
ContactsHelper(activity).getContactSources {
|
||||
if (it.isEmpty()) {
|
||||
return@getContactSources
|
||||
}
|
||||
|
||||
val selectedSources = activity.config.displayContactSources
|
||||
activity.runOnUiThread {
|
||||
view.filter_contact_sources_list.adapter = FilterContactSourcesAdapter(activity, it, selectedSources)
|
||||
|
|
|
@ -231,7 +231,7 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
|
|||
cursor = activity.contentResolver.query(uri, projection, null, null, null)
|
||||
if (cursor?.moveToFirst() == true) {
|
||||
do {
|
||||
val name = cursor.getStringValue(ContactsContract.RawContacts.ACCOUNT_NAME)
|
||||
val name = cursor.getStringValue(ContactsContract.RawContacts.ACCOUNT_NAME) ?: continue
|
||||
accounts.add(name)
|
||||
} while (cursor.moveToNext())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue