mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-06-05 21:49:23 +02:00
use the new way of contact phone number fetching
This commit is contained in:
@ -235,7 +235,7 @@ class DialpadActivity : SimpleActivity() {
|
||||
})
|
||||
|
||||
ContactsAdapter(this, filtered, dialpad_list, null, text) {
|
||||
startCallIntent((it as SimpleContact).phoneNumbers.first())
|
||||
startCallIntent((it as SimpleContact).phoneNumbers.first().normalizedNumber)
|
||||
}.apply {
|
||||
dialpad_list.adapter = this
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ class ManageSpeedDialActivity : SimpleActivity(), RemoveSpeedDialListener {
|
||||
SelectContactDialog(this, allContacts) { selectedContact ->
|
||||
speedDialValues.first { it.id == clickedContact.id }.apply {
|
||||
displayName = selectedContact.name
|
||||
number = selectedContact.phoneNumbers.first()
|
||||
number = selectedContact.phoneNumbers.first().normalizedNumber
|
||||
}
|
||||
updateAdapter()
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ class ContactsAdapter(
|
||||
@SuppressLint("MissingPermission")
|
||||
private fun callContact(useSimOne: Boolean) {
|
||||
val number = getSelectedPhoneNumber() ?: return
|
||||
activity.callContactWithSim(number, useSimOne)
|
||||
activity.callContactWithSim(number.normalizedNumber, useSimOne)
|
||||
}
|
||||
|
||||
private fun removeDefaultSIM() {
|
||||
@ -193,7 +193,7 @@ class ContactsAdapter(
|
||||
activity.handlePermission(PERMISSION_CALL_PHONE) { hasPermission ->
|
||||
val action = if (hasPermission) Intent.ACTION_CALL else Intent.ACTION_DIAL
|
||||
val intent = Intent(action).apply {
|
||||
data = Uri.fromParts("tel", contact.phoneNumbers.first(), null)
|
||||
data = Uri.fromParts("tel", contact.phoneNumbers.first().normalizedNumber, null)
|
||||
}
|
||||
|
||||
val shortcut = ShortcutInfo.Builder(activity, contact.hashCode().toString())
|
||||
|
@ -98,15 +98,15 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
|
||||
private fun callContact(simpleContact: SimpleContact) {
|
||||
val phoneNumbers = simpleContact.phoneNumbers
|
||||
if (phoneNumbers.size <= 1) {
|
||||
activity?.launchCallIntent(phoneNumbers.first())
|
||||
activity?.launchCallIntent(phoneNumbers.first().normalizedNumber)
|
||||
} else {
|
||||
val items = ArrayList<RadioItem>()
|
||||
phoneNumbers.forEachIndexed { index, phoneNumber ->
|
||||
items.add(RadioItem(index, phoneNumber))
|
||||
items.add(RadioItem(index, phoneNumber.normalizedNumber))
|
||||
}
|
||||
|
||||
RadioGroupDialog(activity!!, items) {
|
||||
activity?.launchCallIntent(phoneNumbers[it as Int])
|
||||
activity?.launchCallIntent(phoneNumbers[it as Int].normalizedNumber)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
||||
}
|
||||
|
||||
if (!wasNameFilled) {
|
||||
val contact = contacts.firstOrNull { it.phoneNumbers.first() == recent.phoneNumber }
|
||||
val contact = contacts.firstOrNull { it.phoneNumbers.first().normalizedNumber == recent.phoneNumber }
|
||||
if (contact != null) {
|
||||
recent.name = contact.name
|
||||
}
|
||||
|
@ -90,8 +90,8 @@ class RecentsHelper(private val context: Context) {
|
||||
val normalizedNumber = number.normalizePhoneNumber()
|
||||
if (normalizedNumber!!.length >= COMPARABLE_PHONE_NUMBER_LENGTH) {
|
||||
name = contacts.firstOrNull { contact ->
|
||||
val curNumber = contact.phoneNumbers.first().normalizePhoneNumber()
|
||||
if (curNumber!!.length >= COMPARABLE_PHONE_NUMBER_LENGTH) {
|
||||
val curNumber = contact.phoneNumbers.first().normalizedNumber
|
||||
if (curNumber.length >= COMPARABLE_PHONE_NUMBER_LENGTH) {
|
||||
if (curNumber.substring(curNumber.length - COMPARABLE_PHONE_NUMBER_LENGTH) == normalizedNumber.substring(normalizedNumber.length - COMPARABLE_PHONE_NUMBER_LENGTH)) {
|
||||
contactsNumbersMap[number] = contact.name
|
||||
return@firstOrNull true
|
||||
|
Reference in New Issue
Block a user