From 3e5bbd69c8add8c453317914f3e7c442f750de9b Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 24 May 2020 23:35:28 +0200 Subject: [PATCH] replace Dial intent with Call --- .../contacts/pro/extensions/Activity.kt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Activity.kt index 95a1155a..b56cd765 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Activity.kt @@ -1,5 +1,7 @@ package com.simplemobiletools.contacts.pro.extensions +import android.content.Intent +import android.net.Uri import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.extensions.* @@ -12,7 +14,16 @@ import com.simplemobiletools.contacts.pro.helpers.* import com.simplemobiletools.contacts.pro.models.Contact fun SimpleActivity.startCallIntent(recipient: String) { - launchCallIntent(recipient, null) + val action = Intent.ACTION_CALL + Intent(action).apply { + data = Uri.fromParts("tel", recipient, null) + + if (resolveActivity(packageManager) != null) { + startActivity(this) + } else { + toast(R.string.no_app_found) + } + } } fun SimpleActivity.tryStartCall(contact: Contact) {