Commit 52a43534 by zhangchengbo

fix:添加呼叫直接拨打电话

parent 9f95a89f
......@@ -43,6 +43,7 @@ import com.simplemobiletools.commons.dialogs.WritePermissionDialog.WritePermissi
import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.models.*
import com.simplemobiletools.commons.views.MyTextView
import freemarker.template.utility.Constants
import java.io.*
import java.util.TreeSet
......@@ -538,9 +539,7 @@ fun Activity.launchViewContactIntent(uri: Uri) {
}
fun BaseSimpleActivity.launchCallIntent(recipient: String, handle: PhoneAccountHandle? = null) {
handlePermission(PERMISSION_CALL_PHONE) {
val action = if (it) Intent.ACTION_CALL else Intent.ACTION_DIAL
Intent(action).apply {
Intent(Intent.ACTION_CALL).apply {
this.data = Uri.fromParts("tel", recipient, null)
if (handle != null) {
......@@ -548,18 +547,18 @@ fun BaseSimpleActivity.launchCallIntent(recipient: String, handle: PhoneAccountH
}
if (isDefaultDialer()) {
val packageName = "com.secspace.dialer"
val className = "com.secspace.dialer.activities.DialerActivity"
val packageName = Const.PACKAGE_DIALER
val className = Const.PACKAGE_DIALER_ACTIVITY
this.setClassName(packageName, className)
}
launchActivityIntent(this)
}
}
}
fun Activity.launchSendSMSIntent(recipient: String) {
Intent(Intent.ACTION_SENDTO).apply {
data = Uri.fromParts("smsto", recipient, null)
putExtra(Const.THREAD_TITLE, recipient)
launchActivityIntent(this)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment