lets combine the contact name to 1 line at the View Details screen

This commit is contained in:
tibbi 2021-01-10 16:33:55 +01:00
parent 8249f3bca7
commit 9ba1cadae1
2 changed files with 8 additions and 117 deletions

View File

@ -250,36 +250,11 @@ class ViewContactActivity : ContactActivity() {
}
private fun setupNames() {
contact!!.apply {
contact_prefix.text = prefix
contact_prefix.beVisibleIf(prefix.isNotEmpty() && showFields and SHOW_PREFIX_FIELD != 0)
contact_prefix.copyOnLongClick(prefix)
contact_first_name.text = firstName
contact_first_name.beVisibleIf(firstName.isNotEmpty() && showFields and SHOW_FIRST_NAME_FIELD != 0)
contact_first_name.copyOnLongClick(firstName)
contact_middle_name.text = middleName
contact_middle_name.beVisibleIf(middleName.isNotEmpty() && showFields and SHOW_MIDDLE_NAME_FIELD != 0)
contact_middle_name.copyOnLongClick(middleName)
contact_surname.text = surname
contact_surname.beVisibleIf(surname.isNotEmpty() && showFields and SHOW_SURNAME_FIELD != 0)
contact_surname.copyOnLongClick(surname)
contact_suffix.text = suffix
contact_suffix.beVisibleIf(suffix.isNotEmpty() && showFields and SHOW_SUFFIX_FIELD != 0)
contact_suffix.copyOnLongClick(suffix)
contact_nickname.text = nickname
contact_nickname.beVisibleIf(nickname.isNotEmpty() && showFields and SHOW_NICKNAME_FIELD != 0)
contact_nickname.copyOnLongClick(nickname)
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()
}
}
val displayName = contact!!.getNameToDisplay()
contact_name.text = displayName
contact_name.copyOnLongClick(displayName)
contact_name.beVisibleIf(displayName.isNotEmpty() && !contact!!.isABusinessContact())
contact_name_image.beInvisibleIf(contact_name.isGone())
}
private fun setupPhoneNumbers() {

View File

@ -104,7 +104,7 @@
android:src="@drawable/ic_person_vector" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_prefix"
android:id="@+id/contact_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/contact_photo"
@ -117,91 +117,7 @@
android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin"
android:singleLine="true"
android:textSize="@dimen/bigger_text_size" />
<com.simplemobiletools.commons.views.MyTextView
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_toEndOf="@+id/contact_name_image"
android:background="?attr/selectableItemBackground"
android:lines="1"
android:maxLines="1"
android:paddingStart="@dimen/small_margin"
android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin"
android:singleLine="true"
android:textSize="@dimen/bigger_text_size" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_middle_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/contact_first_name"
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/contact_name_image"
android:background="?attr/selectableItemBackground"
android:lines="1"
android:maxLines="1"
android:paddingStart="@dimen/small_margin"
android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin"
android:singleLine="true"
android:textSize="@dimen/bigger_text_size" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_surname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/contact_middle_name"
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/contact_name_image"
android:background="?attr/selectableItemBackground"
android:lines="1"
android:maxLines="1"
android:paddingStart="@dimen/small_margin"
android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin"
android:singleLine="true"
android:textSize="@dimen/bigger_text_size" />
<com.simplemobiletools.commons.views.MyTextView
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_toEndOf="@+id/contact_name_image"
android:background="?attr/selectableItemBackground"
android:lines="1"
android:maxLines="1"
android:paddingStart="@dimen/small_margin"
android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin"
android:singleLine="true"
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_toEndOf="@+id/contact_name_image"
android:background="?attr/selectableItemBackground"
android:lines="1"
android:maxLines="1"
android:paddingStart="@dimen/small_margin"
android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin"
android:tooltipText="John Doe"
android:singleLine="true"
android:textSize="@dimen/bigger_text_size" />
@ -329,7 +245,7 @@
android:id="@+id/contact_numbers_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/contact_nickname"
android:layout_below="@+id/contact_name"
android:layout_toEndOf="@+id/contact_numbers_image"
android:orientation="vertical"
android:visibility="gone" />