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