allow modifying contact prefix and suffix
This commit is contained in:
parent
4ec6142547
commit
3cfbe5f776
|
@ -242,9 +242,11 @@ class EditContactActivity : ContactActivity() {
|
|||
private fun setupEditContact() {
|
||||
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN)
|
||||
supportActionBar?.title = resources.getString(R.string.edit_contact)
|
||||
contact_prefix.setText(contact!!.prefix)
|
||||
contact_first_name.setText(contact!!.firstName)
|
||||
contact_middle_name.setText(contact!!.middleName)
|
||||
contact_surname.setText(contact!!.surname)
|
||||
contact_suffix.setText(contact!!.suffix)
|
||||
contact_source.text = getPublicContactSource(contact!!.source)
|
||||
|
||||
setupPhoneNumbers()
|
||||
|
@ -599,9 +601,11 @@ class EditContactActivity : ContactActivity() {
|
|||
contact!!.apply {
|
||||
val oldPhotoUri = photoUri
|
||||
|
||||
prefix = contact_prefix.value
|
||||
firstName = contact_first_name.value
|
||||
middleName = contact_middle_name.value
|
||||
surname = contact_surname.value
|
||||
suffix = contact_suffix.value
|
||||
photoUri = currentContactPhotoPath
|
||||
phoneNumbers = getFilledPhoneNumbers()
|
||||
emails = getFilledEmails()
|
||||
|
|
|
@ -690,9 +690,11 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
|
|||
val selection = "${ContactsContract.Data.RAW_CONTACT_ID} = ? AND ${ContactsContract.Data.MIMETYPE} = ?"
|
||||
val selectionArgs = arrayOf(contact.id.toString(), CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE)
|
||||
withSelection(selection, selectionArgs)
|
||||
withValue(CommonDataKinds.StructuredName.PREFIX, contact.prefix)
|
||||
withValue(CommonDataKinds.StructuredName.GIVEN_NAME, contact.firstName)
|
||||
withValue(CommonDataKinds.StructuredName.MIDDLE_NAME, contact.middleName)
|
||||
withValue(CommonDataKinds.StructuredName.FAMILY_NAME, contact.surname)
|
||||
withValue(CommonDataKinds.StructuredName.SUFFIX, contact.suffix)
|
||||
operations.add(build())
|
||||
}
|
||||
|
||||
|
@ -918,9 +920,11 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
|
|||
ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI).apply {
|
||||
withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0)
|
||||
withValue(ContactsContract.Data.MIMETYPE, CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE)
|
||||
withValue(CommonDataKinds.StructuredName.PREFIX, contact.prefix)
|
||||
withValue(CommonDataKinds.StructuredName.GIVEN_NAME, contact.firstName)
|
||||
withValue(CommonDataKinds.StructuredName.MIDDLE_NAME, contact.middleName)
|
||||
withValue(CommonDataKinds.StructuredName.FAMILY_NAME, contact.surname)
|
||||
withValue(CommonDataKinds.StructuredName.SUFFIX, contact.suffix)
|
||||
operations.add(build())
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
<ImageView
|
||||
android:id="@+id/contact_photo"
|
||||
android:layout_width="@dimen/contact_photo_size"
|
||||
android:layout_height="@dimen/contact_photo_size"/>
|
||||
android:layout_height="@dimen/contact_photo_size"
|
||||
android:layout_marginBottom="@dimen/normal_margin"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/contact_toggle_favorite"
|
||||
|
@ -82,7 +83,7 @@
|
|||
android:id="@+id/contact_name_image"
|
||||
android:layout_width="@dimen/contact_icons_size"
|
||||
android:layout_height="@dimen/contact_icons_size"
|
||||
android:layout_alignTop="@+id/contact_first_name"
|
||||
android:layout_below="@+id/contact_photo"
|
||||
android:paddingBottom="@dimen/small_margin"
|
||||
android:paddingEnd="@dimen/small_margin"
|
||||
android:paddingRight="@dimen/small_margin"
|
||||
|
@ -90,13 +91,29 @@
|
|||
android:src="@drawable/ic_person"/>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyEditText
|
||||
android:id="@+id/contact_first_name"
|
||||
android:id="@+id/contact_prefix"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/contact_photo"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginTop="@dimen/normal_margin"
|
||||
android:layout_toRightOf="@+id/contact_name_image"
|
||||
android:hint="@string/prefix"
|
||||
android:inputType="textCapWords"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="@dimen/bigger_text_size"/>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyEditText
|
||||
android:id="@+id/contact_first_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/contact_prefix"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginTop="@dimen/normal_margin"
|
||||
android:layout_toRightOf="@+id/contact_name_image"
|
||||
android:hint="@string/first_name"
|
||||
android:inputType="textCapWords"
|
||||
android:lines="1"
|
||||
|
@ -137,6 +154,22 @@
|
|||
android:textCursorDrawable="@null"
|
||||
android:textSize="@dimen/bigger_text_size"/>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyEditText
|
||||
android:id="@+id/contact_suffix"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/contact_surname"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginTop="@dimen/normal_margin"
|
||||
android:layout_toRightOf="@+id/contact_name_image"
|
||||
android:hint="@string/suffix"
|
||||
android:inputType="textCapWords"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="@dimen/bigger_text_size"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/contact_number_image"
|
||||
android:layout_width="@dimen/contact_icons_size"
|
||||
|
@ -152,7 +185,7 @@
|
|||
android:id="@+id/contact_numbers_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/contact_surname"
|
||||
android:layout_below="@+id/contact_suffix"
|
||||
android:layout_marginTop="@dimen/medium_margin"
|
||||
android:layout_toRightOf="@+id/contact_number_image"
|
||||
android:orientation="vertical">
|
||||
|
|
Loading…
Reference in New Issue