mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
fix #604, show the phone number type at the number picker
This commit is contained in:
@ -111,23 +111,6 @@ abstract class ContactActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getPhoneNumberTypeText(type: Int, label: String): String {
|
|
||||||
return if (type == BaseTypes.TYPE_CUSTOM) {
|
|
||||||
label
|
|
||||||
} else {
|
|
||||||
getString(when (type) {
|
|
||||||
Phone.TYPE_MOBILE -> R.string.mobile
|
|
||||||
Phone.TYPE_HOME -> R.string.home
|
|
||||||
Phone.TYPE_WORK -> R.string.work
|
|
||||||
Phone.TYPE_MAIN -> R.string.main_number
|
|
||||||
Phone.TYPE_FAX_WORK -> R.string.work_fax
|
|
||||||
Phone.TYPE_FAX_HOME -> R.string.home_fax
|
|
||||||
Phone.TYPE_PAGER -> R.string.pager
|
|
||||||
else -> R.string.other
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getEmailTypeText(type: Int, label: String): String {
|
fun getEmailTypeText(type: Int, label: String): String {
|
||||||
return if (type == BaseTypes.TYPE_CUSTOM) {
|
return if (type == BaseTypes.TYPE_CUSTOM) {
|
||||||
label
|
label
|
||||||
|
@ -2,6 +2,8 @@ package com.simplemobiletools.contacts.pro.extensions
|
|||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
import android.provider.ContactsContract.CommonDataKinds.BaseTypes
|
||||||
|
import android.provider.ContactsContract.CommonDataKinds.Phone
|
||||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||||
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
@ -46,7 +48,7 @@ fun SimpleActivity.startCall(contact: Contact) {
|
|||||||
} else if (numbers.size > 1) {
|
} else if (numbers.size > 1) {
|
||||||
val items = ArrayList<RadioItem>()
|
val items = ArrayList<RadioItem>()
|
||||||
numbers.forEachIndexed { index, phoneNumber ->
|
numbers.forEachIndexed { index, phoneNumber ->
|
||||||
items.add(RadioItem(index, phoneNumber.value, phoneNumber.value))
|
items.add(RadioItem(index, "${phoneNumber.value} (${getPhoneNumberTypeText(phoneNumber.type, phoneNumber.label)})", phoneNumber.value))
|
||||||
}
|
}
|
||||||
|
|
||||||
RadioGroupDialog(this, items) {
|
RadioGroupDialog(this, items) {
|
||||||
@ -110,3 +112,20 @@ fun SimpleActivity.callContact(contact: Contact) {
|
|||||||
toast(R.string.no_phone_number_found)
|
toast(R.string.no_phone_number_found)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun SimpleActivity.getPhoneNumberTypeText(type: Int, label: String): String {
|
||||||
|
return if (type == BaseTypes.TYPE_CUSTOM) {
|
||||||
|
label
|
||||||
|
} else {
|
||||||
|
getString(when (type) {
|
||||||
|
Phone.TYPE_MOBILE -> R.string.mobile
|
||||||
|
Phone.TYPE_HOME -> R.string.home
|
||||||
|
Phone.TYPE_WORK -> R.string.work
|
||||||
|
Phone.TYPE_MAIN -> R.string.main_number
|
||||||
|
Phone.TYPE_FAX_WORK -> R.string.work_fax
|
||||||
|
Phone.TYPE_FAX_HOME -> R.string.home_fax
|
||||||
|
Phone.TYPE_PAGER -> R.string.pager
|
||||||
|
else -> R.string.other
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user