mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
add handling for StartCall intent
This commit is contained in:
@ -0,0 +1,23 @@
|
||||
package com.simplemobiletools.contacts.extensions
|
||||
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import com.simplemobiletools.commons.R
|
||||
import com.simplemobiletools.commons.extensions.toast
|
||||
import com.simplemobiletools.commons.helpers.PERMISSION_CALL_PHONE
|
||||
import com.simplemobiletools.contacts.activities.SimpleActivity
|
||||
|
||||
fun SimpleActivity.startCallIntent(recipient: String) {
|
||||
handlePermission(PERMISSION_CALL_PHONE) {
|
||||
if (it) {
|
||||
Intent(Intent.ACTION_CALL).apply {
|
||||
data = Uri.fromParts("tel", recipient, null)
|
||||
if (resolveActivity(packageManager) != null) {
|
||||
startActivity(this)
|
||||
} else {
|
||||
toast(R.string.no_app_found)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user