mirror of
				https://github.com/SimpleMobileTools/Simple-Contacts.git
				synced 2025-06-05 21:59:27 +02:00 
			
		
		
		
	show the contact nickname at the View screen if available
This commit is contained in:
		| @@ -198,7 +198,11 @@ class ViewContactActivity : ContactActivity() { | |||||||
|             contact_suffix.text = suffix |             contact_suffix.text = suffix | ||||||
|             contact_suffix.beVisibleIf(suffix.isNotEmpty() && showFields and SHOW_SUFFIX_FIELD != 0) |             contact_suffix.beVisibleIf(suffix.isNotEmpty() && showFields and SHOW_SUFFIX_FIELD != 0) | ||||||
|  |  | ||||||
|             if (contact_prefix.isGone() && contact_first_name.isGone() && contact_middle_name.isGone() && contact_surname.isGone() && contact_suffix.isGone()) { |             contact_nickname.text = nickname | ||||||
|  |             contact_nickname.beVisibleIf(nickname.isNotEmpty() && showFields and SHOW_NICKNAME_FIELD != 0) | ||||||
|  |  | ||||||
|  |             if (contact_prefix.isGone() && contact_first_name.isGone() && contact_middle_name.isGone() && contact_surname.isGone() && contact_suffix.isGone() | ||||||
|  |                     && contact_nickname.isGone()) { | ||||||
|                 contact_name_image.beInvisible() |                 contact_name_image.beInvisible() | ||||||
|                 (contact_photo.layoutParams as RelativeLayout.LayoutParams).bottomMargin = resources.getDimension(R.dimen.medium_margin).toInt() |                 (contact_photo.layoutParams as RelativeLayout.LayoutParams).bottomMargin = resources.getDimension(R.dimen.medium_margin).toInt() | ||||||
|             } |             } | ||||||
|   | |||||||
| @@ -240,6 +240,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet) | |||||||
|         (fragment_list.adapter as? ContactsAdapter)?.apply { |         (fragment_list.adapter as? ContactsAdapter)?.apply { | ||||||
|             val filtered = contactsIgnoringSearch.filter { |             val filtered = contactsIgnoringSearch.filter { | ||||||
|                 getProperText(it.getFullName(), shouldNormalize).contains(text, true) || |                 getProperText(it.getFullName(), shouldNormalize).contains(text, true) || | ||||||
|  |                         getProperText(it.nickname, shouldNormalize).contains(text, true) || | ||||||
|                         it.phoneNumbers.any { it.value.contains(text, true) } || |                         it.phoneNumbers.any { it.value.contains(text, true) } || | ||||||
|                         it.emails.any { it.value.contains(text, true) } || |                         it.emails.any { it.value.contains(text, true) } || | ||||||
|                         it.addresses.any { getProperText(it.value, shouldNormalize).contains(text, true) } || |                         it.addresses.any { getProperText(it.value, shouldNormalize).contains(text, true) } || | ||||||
|   | |||||||
| @@ -99,7 +99,7 @@ data class Contact(val id: Int, var prefix: String, var firstName: String, var m | |||||||
|         val newEmails = ArrayList<Email>() |         val newEmails = ArrayList<Email>() | ||||||
|         emails.mapTo(newEmails) { Email(it.value, 0) } |         emails.mapTo(newEmails) { Email(it.value, 0) } | ||||||
|  |  | ||||||
|         return copy(id = 0, prefix = "", firstName = getFullName().toLowerCase(), middleName = "", surname = "", suffix = "", photoUri = "", |         return copy(id = 0, prefix = "", firstName = getFullName().toLowerCase(), middleName = "", surname = "", suffix = "", nickname = "", photoUri = "", | ||||||
|                 phoneNumbers = newPhoneNumbers, events = ArrayList(), addresses = ArrayList(), emails = newEmails, source = "", starred = 0, |                 phoneNumbers = newPhoneNumbers, events = ArrayList(), addresses = ArrayList(), emails = newEmails, source = "", starred = 0, | ||||||
|                 contactId = 0, thumbnailUri = "", notes = "", groups = ArrayList(), websites = ArrayList(), organization = Organization("", "")).hashCode() |                 contactId = 0, thumbnailUri = "", notes = "", groups = ArrayList(), websites = ArrayList(), organization = Organization("", "")).hashCode() | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -166,6 +166,21 @@ | |||||||
|             android:singleLine="true" |             android:singleLine="true" | ||||||
|             android:textSize="@dimen/bigger_text_size"/> |             android:textSize="@dimen/bigger_text_size"/> | ||||||
|  |  | ||||||
|  |         <com.simplemobiletools.commons.views.MyTextView | ||||||
|  |             android:id="@+id/contact_nickname" | ||||||
|  |             android:layout_width="match_parent" | ||||||
|  |             android:layout_height="wrap_content" | ||||||
|  |             android:layout_below="@+id/contact_suffix" | ||||||
|  |             android:layout_centerVertical="true" | ||||||
|  |             android:layout_toRightOf="@+id/contact_name_image" | ||||||
|  |             android:lines="1" | ||||||
|  |             android:maxLines="1" | ||||||
|  |             android:paddingBottom="@dimen/normal_margin" | ||||||
|  |             android:paddingLeft="@dimen/small_margin" | ||||||
|  |             android:paddingTop="@dimen/normal_margin" | ||||||
|  |             android:singleLine="true" | ||||||
|  |             android:textSize="@dimen/bigger_text_size"/> | ||||||
|  |  | ||||||
|         <ImageView |         <ImageView | ||||||
|             android:id="@+id/contact_numbers_image" |             android:id="@+id/contact_numbers_image" | ||||||
|             android:layout_width="@dimen/contact_icons_size" |             android:layout_width="@dimen/contact_icons_size" | ||||||
| @@ -181,7 +196,7 @@ | |||||||
|             android:id="@+id/contact_numbers_holder" |             android:id="@+id/contact_numbers_holder" | ||||||
|             android:layout_width="match_parent" |             android:layout_width="match_parent" | ||||||
|             android:layout_height="wrap_content" |             android:layout_height="wrap_content" | ||||||
|             android:layout_below="@+id/contact_suffix" |             android:layout_below="@+id/contact_nickname" | ||||||
|             android:layout_toRightOf="@+id/contact_numbers_image" |             android:layout_toRightOf="@+id/contact_numbers_image" | ||||||
|             android:orientation="vertical" |             android:orientation="vertical" | ||||||
|             android:paddingLeft="@dimen/small_margin"/> |             android:paddingLeft="@dimen/small_margin"/> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user