automatically choose the first group account, if only one is available
This commit is contained in:
parent
ac058c4e7b
commit
79d9e2045b
1 changed files with 14 additions and 6 deletions
|
|
@ -47,13 +47,13 @@ class CreateNewGroupDialog(val activity: BaseSimpleActivity, val callback: (newG
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.runOnUiThread {
|
activity.runOnUiThread {
|
||||||
RadioGroupDialog(activity, items, titleId = R.string.create_group_under_account) {
|
if (items.size == 1) {
|
||||||
val contactSource = contactSources[it as Int]
|
createGroupUnder(name, contactSources.first(), this)
|
||||||
val newGroup = ContactsHelper(activity).createNewGroup(name, contactSource.name, contactSource.type)
|
} else {
|
||||||
if (newGroup != null) {
|
RadioGroupDialog(activity, items, titleId = R.string.create_group_under_account) {
|
||||||
callback(newGroup)
|
val contactSource = contactSources[it as Int]
|
||||||
|
createGroupUnder(name, contactSource, this)
|
||||||
}
|
}
|
||||||
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…
Reference in a new issue