handle the SEND_TO intent properly

This commit is contained in:
tibbi 2020-04-11 23:00:10 +02:00
parent 7f441218d2
commit e966b7bccd
1 changed files with 13 additions and 0 deletions

View File

@ -34,6 +34,10 @@ class NewMessageActivity : SimpleActivity() {
}
private fun initContacts() {
if (isThirdPartyIntent()) {
return
}
getAvailableContacts {
allContacts = it
runOnUiThread {
@ -63,6 +67,15 @@ class NewMessageActivity : SimpleActivity() {
}
}
private fun isThirdPartyIntent(): Boolean {
if (intent.action == Intent.ACTION_SENDTO && intent.dataString != null) {
val number = intent.dataString!!.removePrefix("sms:").removePrefix("smsto:").removePrefix("mms").removePrefix("mmsto:").trim()
launchThreadActivity(number, "")
return true
}
return false
}
private fun setupAdapter(contacts: ArrayList<Contact>) {
ContactsAdapter(this, contacts, suggestions_list, null) {
hideKeyboard()