Skip to content

Commit 749bbe5

Browse files
committed
fix #604, show the phone number type at the number picker
1 parent 8016f01 commit 749bbe5

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ContactActivity.kt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -111,23 +111,6 @@ abstract class ContactActivity : SimpleActivity() {
111111
}
112112
}
113113

114-
fun getPhoneNumberTypeText(type: Int, label: String): String {
115-
return if (type == BaseTypes.TYPE_CUSTOM) {
116-
label
117-
} else {
118-
getString(when (type) {
119-
Phone.TYPE_MOBILE -> R.string.mobile
120-
Phone.TYPE_HOME -> R.string.home
121-
Phone.TYPE_WORK -> R.string.work
122-
Phone.TYPE_MAIN -> R.string.main_number
123-
Phone.TYPE_FAX_WORK -> R.string.work_fax
124-
Phone.TYPE_FAX_HOME -> R.string.home_fax
125-
Phone.TYPE_PAGER -> R.string.pager
126-
else -> R.string.other
127-
})
128-
}
129-
}
130-
131114
fun getEmailTypeText(type: Int, label: String): String {
132115
return if (type == BaseTypes.TYPE_CUSTOM) {
133116
label

app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Activity.kt

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package com.simplemobiletools.contacts.pro.extensions
22

33
import android.content.Intent
44
import android.net.Uri
5+
import android.provider.ContactsContract.CommonDataKinds.BaseTypes
6+
import android.provider.ContactsContract.CommonDataKinds.Phone
57
import com.simplemobiletools.commons.activities.BaseSimpleActivity
68
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
79
import 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

Comments
 (0)