@@ -2,6 +2,8 @@ package com.simplemobiletools.contacts.pro.extensions
22
33import android.content.Intent
44import android.net.Uri
5+ import android.provider.ContactsContract.CommonDataKinds.BaseTypes
6+ import android.provider.ContactsContract.CommonDataKinds.Phone
57import com.simplemobiletools.commons.activities.BaseSimpleActivity
68import com.simplemobiletools.commons.dialogs.RadioGroupDialog
79import com.simplemobiletools.commons.extensions.*
@@ -46,7 +48,7 @@ fun SimpleActivity.startCall(contact: Contact) {
4648 } else if (numbers.size > 1 ) {
4749 val items = ArrayList <RadioItem >()
4850 numbers.forEachIndexed { index, phoneNumber ->
49- items.add(RadioItem (index, phoneNumber.value, phoneNumber.value))
51+ items.add(RadioItem (index, " ${ phoneNumber.value} ( ${getPhoneNumberTypeText(phoneNumber.type, phoneNumber.label)} ) " , phoneNumber.value))
5052 }
5153
5254 RadioGroupDialog (this , items) {
@@ -110,3 +112,20 @@ fun SimpleActivity.callContact(contact: Contact) {
110112 toast(R .string.no_phone_number_found)
111113 }
112114}
115+
116+ fun SimpleActivity.getPhoneNumberTypeText (type : Int , label : String ): String {
117+ return if (type == BaseTypes .TYPE_CUSTOM ) {
118+ label
119+ } else {
120+ getString(when (type) {
121+ Phone .TYPE_MOBILE -> R .string.mobile
122+ Phone .TYPE_HOME -> R .string.home
123+ Phone .TYPE_WORK -> R .string.work
124+ Phone .TYPE_MAIN -> R .string.main_number
125+ Phone .TYPE_FAX_WORK -> R .string.work_fax
126+ Phone .TYPE_FAX_HOME -> R .string.home_fax
127+ Phone .TYPE_PAGER -> R .string.pager
128+ else -> R .string.other
129+ })
130+ }
131+ }
0 commit comments