mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
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 {
|
init {
|
||||||
ContactsHelper(activity).getContactSources {
|
ContactsHelper(activity).getContactSources {
|
||||||
|
if (it.isEmpty()) {
|
||||||
|
return@getContactSources
|
||||||
|
}
|
||||||
|
|
||||||
val selectedSources = activity.config.displayContactSources
|
val selectedSources = activity.config.displayContactSources
|
||||||
activity.runOnUiThread {
|
activity.runOnUiThread {
|
||||||
view.filter_contact_sources_list.adapter = FilterContactSourcesAdapter(activity, it, selectedSources)
|
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)
|
cursor = activity.contentResolver.query(uri, projection, null, null, null)
|
||||||
if (cursor?.moveToFirst() == true) {
|
if (cursor?.moveToFirst() == true) {
|
||||||
do {
|
do {
|
||||||
val name = cursor.getStringValue(ContactsContract.RawContacts.ACCOUNT_NAME)
|
val name = cursor.getStringValue(ContactsContract.RawContacts.ACCOUNT_NAME) ?: continue
|
||||||
accounts.add(name)
|
accounts.add(name)
|
||||||
} while (cursor.moveToNext())
|
} while (cursor.moveToNext())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user