try calling contact directly from the dialpad screen, do not trigger edit/view
This commit is contained in:
parent
6718fb9a20
commit
284a5fb35f
2 changed files with 11 additions and 9 deletions
|
@ -11,8 +11,8 @@ import com.simplemobiletools.commons.helpers.isLollipopPlus
|
||||||
import com.simplemobiletools.contacts.R
|
import com.simplemobiletools.contacts.R
|
||||||
import com.simplemobiletools.contacts.adapters.ContactsAdapter
|
import com.simplemobiletools.contacts.adapters.ContactsAdapter
|
||||||
import com.simplemobiletools.contacts.extensions.afterTextChanged
|
import com.simplemobiletools.contacts.extensions.afterTextChanged
|
||||||
|
import com.simplemobiletools.contacts.extensions.callContact
|
||||||
import com.simplemobiletools.contacts.extensions.config
|
import com.simplemobiletools.contacts.extensions.config
|
||||||
import com.simplemobiletools.contacts.extensions.contactClicked
|
|
||||||
import com.simplemobiletools.contacts.helpers.ContactsHelper
|
import com.simplemobiletools.contacts.helpers.ContactsHelper
|
||||||
import com.simplemobiletools.contacts.helpers.LOCATION_DIALPAD
|
import com.simplemobiletools.contacts.helpers.LOCATION_DIALPAD
|
||||||
import com.simplemobiletools.contacts.helpers.PHONE_NUMBER_PATTERN
|
import com.simplemobiletools.contacts.helpers.PHONE_NUMBER_PATTERN
|
||||||
|
@ -103,7 +103,7 @@ class DialpadActivity : SimpleActivity() {
|
||||||
} as ArrayList<Contact>
|
} as ArrayList<Contact>
|
||||||
|
|
||||||
ContactsAdapter(this, filtered, null, LOCATION_DIALPAD, null, dialpad_list, dialpad_fastscroller) {
|
ContactsAdapter(this, filtered, null, LOCATION_DIALPAD, null, dialpad_list, dialpad_fastscroller) {
|
||||||
contactClicked(it as Contact)
|
callContact(it as Contact)
|
||||||
}.apply {
|
}.apply {
|
||||||
addVerticalDividers(true)
|
addVerticalDividers(true)
|
||||||
dialpad_list.adapter = this
|
dialpad_list.adapter = this
|
||||||
|
|
|
@ -203,14 +203,16 @@ fun Activity.getVisibleContactSources(): ArrayList<String> {
|
||||||
|
|
||||||
fun SimpleActivity.contactClicked(contact: Contact) {
|
fun SimpleActivity.contactClicked(contact: Contact) {
|
||||||
when (config.onContactClick) {
|
when (config.onContactClick) {
|
||||||
ON_CLICK_CALL_CONTACT -> {
|
ON_CLICK_CALL_CONTACT -> callContact(contact)
|
||||||
if (contact.phoneNumbers.isNotEmpty()) {
|
|
||||||
tryStartCall(contact)
|
|
||||||
} else {
|
|
||||||
toast(R.string.no_phone_number_found)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ON_CLICK_VIEW_CONTACT -> viewContact(contact)
|
ON_CLICK_VIEW_CONTACT -> viewContact(contact)
|
||||||
ON_CLICK_EDIT_CONTACT -> editContact(contact)
|
ON_CLICK_EDIT_CONTACT -> editContact(contact)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun SimpleActivity.callContact(contact: Contact) {
|
||||||
|
if (contact.phoneNumbers.isNotEmpty()) {
|
||||||
|
tryStartCall(contact)
|
||||||
|
} else {
|
||||||
|
toast(R.string.no_phone_number_found)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue