diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a0c5d40e..493e25c2 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -53,6 +53,13 @@ + + + + + + + + android:parentActivityName=".activities.SettingsActivity" /> + @@ -121,7 +129,7 @@ + android:taskAffinity="com.klinker.android.messaging.MMS_RECEIVED" /> diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/NewMessageActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/NewMessageActivity.kt index 396fac75..1ed8b86b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/NewMessageActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/NewMessageActivity.kt @@ -11,6 +11,7 @@ import com.simplemobiletools.smsmessenger.extensions.config import com.simplemobiletools.smsmessenger.extensions.getAvailableContacts import com.simplemobiletools.smsmessenger.extensions.getThreadId import com.simplemobiletools.smsmessenger.helpers.THREAD_ID +import com.simplemobiletools.smsmessenger.helpers.THREAD_TEXT import com.simplemobiletools.smsmessenger.helpers.THREAD_TITLE import com.simplemobiletools.smsmessenger.models.Contact import kotlinx.android.synthetic.main.activity_new_message.* @@ -63,14 +64,14 @@ class NewMessageActivity : SimpleActivity() { new_message_confirm.applyColorFilter(config.textColor) new_message_confirm.setOnClickListener { val number = new_message_to.value - launchThreadActivity(number, number) + launchThreadActivity(number, number, "") } } 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, "") + launchThreadActivity(number, "", "") return true } return false @@ -79,16 +80,19 @@ class NewMessageActivity : SimpleActivity() { private fun setupAdapter(contacts: ArrayList) { ContactsAdapter(this, contacts, suggestions_list, null) { hideKeyboard() - launchThreadActivity((it as Contact).phoneNumber, it.name) + + val text = intent.getStringExtra(Intent.EXTRA_TEXT) ?: "" + launchThreadActivity((it as Contact).phoneNumber, it.name, text) }.apply { suggestions_list.adapter = this } } - private fun launchThreadActivity(phoneNumber: String, name: String) { + private fun launchThreadActivity(phoneNumber: String, name: String, text: String) { Intent(this, ThreadActivity::class.java).apply { putExtra(THREAD_ID, getThreadId(phoneNumber).toInt()) putExtra(THREAD_TITLE, name) + putExtra(THREAD_TEXT, text) startActivity(this) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt index 93789885..70282f04 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt @@ -169,6 +169,8 @@ class ThreadActivity : SimpleActivity() { } } } + + thread_type_message.setText(intent.getStringExtra(THREAD_TEXT)) } private fun blockNumber() { diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt index c36dada1..afc143fe 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt @@ -5,6 +5,7 @@ import org.greenrobot.eventbus.EventBus const val THREAD_ID = "thread_id" const val THREAD_TITLE = "thread_title" +const val THREAD_TEXT = "thread_text" // view types for the thread list view const val THREAD_DATE_TIME = 1