Skip to content

Commit 9ba1cad

Browse files
committed
lets combine the contact name to 1 line at the View Details screen
1 parent 8249f3b commit 9ba1cad

File tree

2 files changed

+8
-117
lines changed

2 files changed

+8
-117
lines changed

app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ViewContactActivity.kt

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -250,36 +250,11 @@ class ViewContactActivity : ContactActivity() {
250250
}
251251

252252
private fun setupNames() {
253-
contact!!.apply {
254-
contact_prefix.text = prefix
255-
contact_prefix.beVisibleIf(prefix.isNotEmpty() && showFields and SHOW_PREFIX_FIELD != 0)
256-
contact_prefix.copyOnLongClick(prefix)
257-
258-
contact_first_name.text = firstName
259-
contact_first_name.beVisibleIf(firstName.isNotEmpty() && showFields and SHOW_FIRST_NAME_FIELD != 0)
260-
contact_first_name.copyOnLongClick(firstName)
261-
262-
contact_middle_name.text = middleName
263-
contact_middle_name.beVisibleIf(middleName.isNotEmpty() && showFields and SHOW_MIDDLE_NAME_FIELD != 0)
264-
contact_middle_name.copyOnLongClick(middleName)
265-
266-
contact_surname.text = surname
267-
contact_surname.beVisibleIf(surname.isNotEmpty() && showFields and SHOW_SURNAME_FIELD != 0)
268-
contact_surname.copyOnLongClick(surname)
269-
270-
contact_suffix.text = suffix
271-
contact_suffix.beVisibleIf(suffix.isNotEmpty() && showFields and SHOW_SUFFIX_FIELD != 0)
272-
contact_suffix.copyOnLongClick(suffix)
273-
274-
contact_nickname.text = nickname
275-
contact_nickname.beVisibleIf(nickname.isNotEmpty() && showFields and SHOW_NICKNAME_FIELD != 0)
276-
contact_nickname.copyOnLongClick(nickname)
277-
278-
if (contact_prefix.isGone() && contact_first_name.isGone() && contact_middle_name.isGone() && contact_surname.isGone() && contact_suffix.isGone()
279-
&& contact_nickname.isGone()) {
280-
contact_name_image.beInvisible()
281-
}
282-
}
253+
val displayName = contact!!.getNameToDisplay()
254+
contact_name.text = displayName
255+
contact_name.copyOnLongClick(displayName)
256+
contact_name.beVisibleIf(displayName.isNotEmpty() && !contact!!.isABusinessContact())
257+
contact_name_image.beInvisibleIf(contact_name.isGone())
283258
}
284259

285260
private fun setupPhoneNumbers() {

app/src/main/res/layout/activity_view_contact.xml

Lines changed: 3 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
android:src="@drawable/ic_person_vector" />
105105

106106
<com.simplemobiletools.commons.views.MyTextView
107-
android:id="@+id/contact_prefix"
107+
android:id="@+id/contact_name"
108108
android:layout_width="match_parent"
109109
android:layout_height="wrap_content"
110110
android:layout_below="@+id/contact_photo"
@@ -117,91 +117,7 @@
117117
android:paddingTop="@dimen/normal_margin"
118118
android:paddingEnd="@dimen/normal_margin"
119119
android:paddingBottom="@dimen/normal_margin"
120-
android:singleLine="true"
121-
android:textSize="@dimen/bigger_text_size" />
122-
123-
<com.simplemobiletools.commons.views.MyTextView
124-
android:id="@+id/contact_first_name"
125-
android:layout_width="match_parent"
126-
android:layout_height="wrap_content"
127-
android:layout_below="@+id/contact_prefix"
128-
android:layout_centerVertical="true"
129-
android:layout_toEndOf="@+id/contact_name_image"
130-
android:background="?attr/selectableItemBackground"
131-
android:lines="1"
132-
android:maxLines="1"
133-
android:paddingStart="@dimen/small_margin"
134-
android:paddingTop="@dimen/normal_margin"
135-
android:paddingEnd="@dimen/normal_margin"
136-
android:paddingBottom="@dimen/normal_margin"
137-
android:singleLine="true"
138-
android:textSize="@dimen/bigger_text_size" />
139-
140-
<com.simplemobiletools.commons.views.MyTextView
141-
android:id="@+id/contact_middle_name"
142-
android:layout_width="match_parent"
143-
android:layout_height="wrap_content"
144-
android:layout_below="@+id/contact_first_name"
145-
android:layout_centerVertical="true"
146-
android:layout_toEndOf="@+id/contact_name_image"
147-
android:background="?attr/selectableItemBackground"
148-
android:lines="1"
149-
android:maxLines="1"
150-
android:paddingStart="@dimen/small_margin"
151-
android:paddingTop="@dimen/normal_margin"
152-
android:paddingEnd="@dimen/normal_margin"
153-
android:paddingBottom="@dimen/normal_margin"
154-
android:singleLine="true"
155-
android:textSize="@dimen/bigger_text_size" />
156-
157-
<com.simplemobiletools.commons.views.MyTextView
158-
android:id="@+id/contact_surname"
159-
android:layout_width="match_parent"
160-
android:layout_height="wrap_content"
161-
android:layout_below="@+id/contact_middle_name"
162-
android:layout_centerVertical="true"
163-
android:layout_toEndOf="@+id/contact_name_image"
164-
android:background="?attr/selectableItemBackground"
165-
android:lines="1"
166-
android:maxLines="1"
167-
android:paddingStart="@dimen/small_margin"
168-
android:paddingTop="@dimen/normal_margin"
169-
android:paddingEnd="@dimen/normal_margin"
170-
android:paddingBottom="@dimen/normal_margin"
171-
android:singleLine="true"
172-
android:textSize="@dimen/bigger_text_size" />
173-
174-
<com.simplemobiletools.commons.views.MyTextView
175-
android:id="@+id/contact_suffix"
176-
android:layout_width="match_parent"
177-
android:layout_height="wrap_content"
178-
android:layout_below="@+id/contact_surname"
179-
android:layout_centerVertical="true"
180-
android:layout_toEndOf="@+id/contact_name_image"
181-
android:background="?attr/selectableItemBackground"
182-
android:lines="1"
183-
android:maxLines="1"
184-
android:paddingStart="@dimen/small_margin"
185-
android:paddingTop="@dimen/normal_margin"
186-
android:paddingEnd="@dimen/normal_margin"
187-
android:paddingBottom="@dimen/normal_margin"
188-
android:singleLine="true"
189-
android:textSize="@dimen/bigger_text_size" />
190-
191-
<com.simplemobiletools.commons.views.MyTextView
192-
android:id="@+id/contact_nickname"
193-
android:layout_width="match_parent"
194-
android:layout_height="wrap_content"
195-
android:layout_below="@+id/contact_suffix"
196-
android:layout_centerVertical="true"
197-
android:layout_toEndOf="@+id/contact_name_image"
198-
android:background="?attr/selectableItemBackground"
199-
android:lines="1"
200-
android:maxLines="1"
201-
android:paddingStart="@dimen/small_margin"
202-
android:paddingTop="@dimen/normal_margin"
203-
android:paddingEnd="@dimen/normal_margin"
204-
android:paddingBottom="@dimen/normal_margin"
120+
android:tooltipText="John Doe"
205121
android:singleLine="true"
206122
android:textSize="@dimen/bigger_text_size" />
207123

@@ -329,7 +245,7 @@
329245
android:id="@+id/contact_numbers_holder"
330246
android:layout_width="match_parent"
331247
android:layout_height="wrap_content"
332-
android:layout_below="@+id/contact_nickname"
248+
android:layout_below="@+id/contact_name"
333249
android:layout_toEndOf="@+id/contact_numbers_image"
334250
android:orientation="vertical"
335251
android:visibility="gone" />

0 commit comments

Comments
 (0)