@@ -145,14 +145,19 @@ class NewConversationActivity : SimpleActivity() {
145145 val contact = it as SimpleContact
146146 val phoneNumbers = contact.phoneNumbers
147147 if (phoneNumbers.size > 1 ) {
148- val items = ArrayList <RadioItem >()
149- phoneNumbers.forEachIndexed { index, phoneNumber ->
150- val type = getPhoneNumberTypeText(phoneNumber.type, phoneNumber.label)
151- items.add(RadioItem (index, " ${phoneNumber.normalizedNumber} ($type )" , phoneNumber.normalizedNumber))
152- }
148+ val primaryNumber = contact.phoneNumbers.find { it.isPrimary }
149+ if (primaryNumber != null ) {
150+ launchThreadActivity(primaryNumber.value, contact.name)
151+ } else {
152+ val items = ArrayList <RadioItem >()
153+ phoneNumbers.forEachIndexed { index, phoneNumber ->
154+ val type = getPhoneNumberTypeText(phoneNumber.type, phoneNumber.label)
155+ items.add(RadioItem (index, " ${phoneNumber.normalizedNumber} ($type )" , phoneNumber.normalizedNumber))
156+ }
153157
154- RadioGroupDialog (this , items) {
155- launchThreadActivity(it as String , contact.name)
158+ RadioGroupDialog (this , items) {
159+ launchThreadActivity(it as String , contact.name)
160+ }
156161 }
157162 } else {
158163 launchThreadActivity(phoneNumbers.first().normalizedNumber, contact.name)
0 commit comments