mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
automatically choose the first group account, if only one is available
This commit is contained in:
@ -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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user