mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-06-05 21:49:23 +02:00
updating commons, handle SimpleContact having multiple numbers
This commit is contained in:
@ -56,6 +56,6 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:5.29.13'
|
||||
implementation 'com.simplemobiletools:commons:5.29.16'
|
||||
implementation 'com.github.tibbi:IndicatorFastScroll:08f512858a'
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ class DialpadActivity : SimpleActivity() {
|
||||
})
|
||||
|
||||
ContactsAdapter(this, filtered, dialpad_list, null, text) {
|
||||
startCallIntent((it as SimpleContact).phoneNumber)
|
||||
startCallIntent((it as SimpleContact).phoneNumbers.first())
|
||||
}.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.phoneNumber
|
||||
number = selectedContact.phoneNumbers.first()
|
||||
}
|
||||
updateAdapter()
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ class ContactsAdapter(activity: SimpleActivity, var contacts: ArrayList<SimpleCo
|
||||
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.phoneNumber, null)
|
||||
data = Uri.fromParts("tel", contact.phoneNumbers.first(), null)
|
||||
}
|
||||
|
||||
val shortcut = ShortcutInfo.Builder(activity, contact.hashCode().toString())
|
||||
|
@ -76,7 +76,7 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
|
||||
val currAdapter = fragment_list.adapter
|
||||
if (currAdapter == null) {
|
||||
ContactsAdapter(activity as SimpleActivity, contacts, fragment_list, this, showDeleteButton = false) {
|
||||
activity?.launchCallIntent((it as SimpleContact).phoneNumber)
|
||||
activity?.launchCallIntent((it as SimpleContact).phoneNumbers.first())
|
||||
}.apply {
|
||||
fragment_list.adapter = this
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
||||
recents.filter { it.phoneNumber == it.name }.forEach { recent ->
|
||||
var wasNameFilled = false
|
||||
if (privateContacts.isNotEmpty()) {
|
||||
val privateContact = privateContacts.firstOrNull { it.phoneNumber == recent.phoneNumber }
|
||||
val privateContact = privateContacts.firstOrNull { it.phoneNumbers.first() == recent.phoneNumber }
|
||||
if (privateContact != null) {
|
||||
recent.name = privateContact.name
|
||||
wasNameFilled = true
|
||||
@ -58,7 +58,7 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
||||
}
|
||||
|
||||
if (!wasNameFilled) {
|
||||
val contact = contacts.firstOrNull { it.phoneNumber == recent.phoneNumber }
|
||||
val contact = contacts.firstOrNull { it.phoneNumbers.first() == recent.phoneNumber }
|
||||
if (contact != null) {
|
||||
recent.name = contact.name
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ class CallManager {
|
||||
val privateCursor = context.getMyContactsCursor().loadInBackground()
|
||||
ensureBackgroundThread {
|
||||
val privateContacts = MyContactsContentProvider.getSimpleContacts(context, privateCursor)
|
||||
val privateContact = privateContacts.firstOrNull { it.phoneNumber == callContact.number }
|
||||
val privateContact = privateContacts.firstOrNull { it.phoneNumbers.first() == callContact.number }
|
||||
if (privateContact != null) {
|
||||
callContact.name = privateContact.name
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ class RecentsHelper(private val context: Context) {
|
||||
val normalizedNumber = number.normalizePhoneNumber()
|
||||
if (normalizedNumber!!.length >= COMPARABLE_PHONE_NUMBER_LENGTH) {
|
||||
name = contacts.firstOrNull { contact ->
|
||||
val curNumber = contact.phoneNumber.normalizePhoneNumber()
|
||||
val curNumber = contact.phoneNumbers.first().normalizePhoneNumber()
|
||||
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
|
||||
|
Reference in New Issue
Block a user