mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
default number
This commit is contained in:
@ -44,13 +44,18 @@ fun SimpleActivity.startCall(contact: Contact) {
|
||||
if (numbers.size == 1) {
|
||||
startCallIntent(numbers.first().value)
|
||||
} else if (numbers.size > 1) {
|
||||
val items = ArrayList<RadioItem>()
|
||||
numbers.forEachIndexed { index, phoneNumber ->
|
||||
items.add(RadioItem(index, "${phoneNumber.value} (${getPhoneNumberTypeText(phoneNumber.type, phoneNumber.label)})", phoneNumber.value))
|
||||
}
|
||||
val primaryNumber = contact.phoneNumbers.find { it.isPrimary }
|
||||
if (primaryNumber != null) {
|
||||
startCallIntent(primaryNumber.value)
|
||||
} else {
|
||||
val items = ArrayList<RadioItem>()
|
||||
numbers.forEachIndexed { index, phoneNumber ->
|
||||
items.add(RadioItem(index, "${phoneNumber.value} (${getPhoneNumberTypeText(phoneNumber.type, phoneNumber.label)})", phoneNumber.value))
|
||||
}
|
||||
|
||||
RadioGroupDialog(this, items) {
|
||||
startCallIntent(it as String)
|
||||
RadioGroupDialog(this, items) {
|
||||
startCallIntent(it as String)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user