mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
properly handle inserting contact emails via third party intents
This commit is contained in:
@ -54,7 +54,9 @@ class EditContactActivity : ContactActivity() {
|
|||||||
private var isSaving = false
|
private var isSaving = false
|
||||||
private var isThirdPartyIntent = false
|
private var isThirdPartyIntent = false
|
||||||
private var highlightLastPhoneNumber = false
|
private var highlightLastPhoneNumber = false
|
||||||
|
private var highlightLastEmail = false
|
||||||
private var numberViewToColor: EditText? = null
|
private var numberViewToColor: EditText? = null
|
||||||
|
private var emailViewToColor: EditText? = null
|
||||||
private var originalContactSource = ""
|
private var originalContactSource = ""
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
@ -183,6 +185,13 @@ class EditContactActivity : ContactActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val email = intent.getStringExtra("email")
|
||||||
|
if (email != null) {
|
||||||
|
val newEmail = Email(email, DEFAULT_EMAIL_TYPE, "")
|
||||||
|
contact!!.emails.add(newEmail)
|
||||||
|
highlightLastEmail = true
|
||||||
|
}
|
||||||
|
|
||||||
val firstName = intent.extras!!.get(KEY_NAME)
|
val firstName = intent.extras!!.get(KEY_NAME)
|
||||||
if (firstName != null) {
|
if (firstName != null) {
|
||||||
contact!!.firstName = firstName.toString()
|
contact!!.firstName = firstName.toString()
|
||||||
@ -265,7 +274,8 @@ class EditContactActivity : ContactActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateTextColors(contact_scrollview)
|
updateTextColors(contact_scrollview)
|
||||||
numberViewToColor?.setTextColor(getAdjustedPrimaryColor())
|
numberViewToColor?.setTextColor(adjustedPrimaryColor)
|
||||||
|
emailViewToColor?.setTextColor(adjustedPrimaryColor)
|
||||||
wasActivityInitialized = true
|
wasActivityInitialized = true
|
||||||
invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
}
|
}
|
||||||
@ -440,6 +450,9 @@ class EditContactActivity : ContactActivity() {
|
|||||||
emailHolder!!.apply {
|
emailHolder!!.apply {
|
||||||
contact_email.setText(email.value)
|
contact_email.setText(email.value)
|
||||||
setupEmailTypePicker(contact_email_type, email.type, email.label)
|
setupEmailTypePicker(contact_email_type, email.type, email.label)
|
||||||
|
if (highlightLastEmail && index == contact!!.emails.size - 1) {
|
||||||
|
emailViewToColor = contact_email
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user