mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-04-02 12:40:25 +02:00
properly handle default contact numbers at calling
This commit is contained in:
parent
8c4a78e298
commit
ef4653512a
@ -61,6 +61,6 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:b45fde5669'
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:fd1fde1dbd'
|
||||
implementation 'com.github.tibbi:IndicatorFastScroll:4524cd0b61'
|
||||
}
|
||||
|
@ -144,14 +144,19 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
|
||||
if (phoneNumbers.size <= 1) {
|
||||
activity?.launchCallIntent(phoneNumbers.first().normalizedNumber)
|
||||
} else {
|
||||
val items = ArrayList<RadioItem>()
|
||||
phoneNumbers.forEachIndexed { index, phoneNumber ->
|
||||
val type = context.getPhoneNumberTypeText(phoneNumber.type, phoneNumber.label)
|
||||
items.add(RadioItem(index, "${phoneNumber.normalizedNumber} ($type)", phoneNumber.normalizedNumber))
|
||||
}
|
||||
val primaryNumber = simpleContact.phoneNumbers.find { it.isPrimary }
|
||||
if (primaryNumber != null) {
|
||||
activity?.launchCallIntent(primaryNumber.value)
|
||||
} else {
|
||||
val items = ArrayList<RadioItem>()
|
||||
phoneNumbers.forEachIndexed { index, phoneNumber ->
|
||||
val type = context.getPhoneNumberTypeText(phoneNumber.type, phoneNumber.label)
|
||||
items.add(RadioItem(index, "${phoneNumber.normalizedNumber} ($type)", phoneNumber.normalizedNumber))
|
||||
}
|
||||
|
||||
RadioGroupDialog(activity!!, items) {
|
||||
activity?.launchCallIntent(it as String)
|
||||
RadioGroupDialog(activity!!, items) {
|
||||
activity?.launchCallIntent(it as String)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user