mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-04-25 14:58:42 +02:00
automatically choose the first group account, if only one is available
This commit is contained in:
parent
ac058c4e7b
commit
79d9e2045b
@ -47,13 +47,13 @@ class CreateNewGroupDialog(val activity: BaseSimpleActivity, val callback: (newG
|
|||||||
}
|
}
|
||||||
|
|
||||||
activity.runOnUiThread {
|
activity.runOnUiThread {
|
||||||
|
if (items.size == 1) {
|
||||||
|
createGroupUnder(name, contactSources.first(), this)
|
||||||
|
} else {
|
||||||
RadioGroupDialog(activity, items, titleId = R.string.create_group_under_account) {
|
RadioGroupDialog(activity, items, titleId = R.string.create_group_under_account) {
|
||||||
val contactSource = contactSources[it as Int]
|
val contactSource = contactSources[it as Int]
|
||||||
val newGroup = ContactsHelper(activity).createNewGroup(name, contactSource.name, contactSource.type)
|
createGroupUnder(name, contactSource, this)
|
||||||
if (newGroup != null) {
|
|
||||||
callback(newGroup)
|
|
||||||
}
|
}
|
||||||
dismiss()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,4 +61,12 @@ class CreateNewGroupDialog(val activity: BaseSimpleActivity, val callback: (newG
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun createGroupUnder(name: String, contactSource: ContactSource, dialog: AlertDialog) {
|
||||||
|
val newGroup = ContactsHelper(activity).createNewGroup(name, contactSource.name, contactSource.type)
|
||||||
|
if (newGroup != null) {
|
||||||
|
callback(newGroup)
|
||||||
|
}
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user