renaming getFullName() to getNameToDisplay()
This commit is contained in:
parent
457110e869
commit
952cce20c0
|
@ -244,7 +244,7 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
|
|||
private fun setupView(view: View, contact: Contact) {
|
||||
view.apply {
|
||||
contact_frame?.isSelected = selectedKeys.contains(contact.id)
|
||||
val fullName = contact.getFullName()
|
||||
val fullName = contact.getNameToDisplay()
|
||||
contact_name.text = if (textToHighlight.isEmpty()) fullName else fullName.highlightTextPart(textToHighlight, adjustedPrimaryColor)
|
||||
contact_name.setTextColor(textColor)
|
||||
contact_name.setPadding(if (showContactThumbnails) smallPadding else bigPadding, smallPadding, smallPadding, 0)
|
||||
|
|
|
@ -92,7 +92,7 @@ class SelectContactsAdapter(val activity: SimpleActivity, val contacts: List<Con
|
|||
contact_checkbox.setColors(config.textColor, context.getAdjustedPrimaryColor(), config.backgroundColor)
|
||||
val textColor = config.textColor
|
||||
|
||||
contact_name.text = contact.getFullName()
|
||||
contact_name.text = contact.getNameToDisplay()
|
||||
contact_name.setTextColor(textColor)
|
||||
contact_name.setPadding(if (showContactThumbnails) smallPadding else bigPadding, smallPadding, smallPadding, 0)
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ fun SimpleActivity.startCallIntent(recipient: String) {
|
|||
|
||||
fun SimpleActivity.tryStartCall(contact: Contact) {
|
||||
if (config.showCallConfirmation) {
|
||||
CallConfirmationDialog(this, contact.getFullName()) {
|
||||
CallConfirmationDialog(this, contact.getNameToDisplay()) {
|
||||
startCall(contact)
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -239,7 +239,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
|||
val shouldNormalize = text.normalizeString() == text
|
||||
(fragment_list.adapter as? ContactsAdapter)?.apply {
|
||||
val filtered = contactsIgnoringSearch.filter {
|
||||
getProperText(it.getFullName(), shouldNormalize).contains(text, true) ||
|
||||
getProperText(it.getNameToDisplay(), shouldNormalize).contains(text, true) ||
|
||||
getProperText(it.nickname, shouldNormalize).contains(text, true) ||
|
||||
it.doesContainPhoneNumber(text) ||
|
||||
it.emails.any { it.value.contains(text, true) } ||
|
||||
|
@ -254,7 +254,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
|||
Contact.sorting = config.sorting
|
||||
Contact.startWithSurname = config.startNameWithSurname
|
||||
filtered.sort()
|
||||
filtered.sortBy { !getProperText(it.getFullName(), shouldNormalize).startsWith(text, true) }
|
||||
filtered.sortBy { !getProperText(it.getNameToDisplay(), shouldNormalize).startsWith(text, true) }
|
||||
|
||||
if (filtered.isEmpty() && this@MyViewPagerFragment is FavoritesFragment) {
|
||||
fragment_placeholder.text = activity.getString(R.string.no_items_found)
|
||||
|
|
|
@ -62,7 +62,7 @@ class ContactsHelper(val activity: Activity) {
|
|||
it.getHashToCompare()
|
||||
} as ArrayList<Contact>
|
||||
|
||||
tempContacts.groupBy { "${it.getFullName().toLowerCase()}${it.emails}" }.values.forEach {
|
||||
tempContacts.groupBy { "${it.getNameToDisplay().toLowerCase()}${it.emails}" }.values.forEach {
|
||||
if (it.size == 1) {
|
||||
resultContacts.add(it.first())
|
||||
} else {
|
||||
|
|
|
@ -139,7 +139,7 @@ class VcfImporter(val activity: SimpleActivity) {
|
|||
targetContactSource, starred, contactId, thumbnailUri, photo, notes, groups, organization, websites, cleanPhoneNumbers, IMs)
|
||||
|
||||
// if there is no N and ORG fields at the given contact, only FN, treat it as an organization
|
||||
if (contact.getFullName().isEmpty() && contact.organization.isEmpty() && ezContact.formattedName.value.isNotEmpty()) {
|
||||
if (contact.getNameToDisplay().isEmpty() && contact.organization.isEmpty() && ezContact.formattedName.value.isNotEmpty()) {
|
||||
contact.organization.company = ezContact.formattedName.value
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ data class Contact(val id: Int, var prefix: String, var firstName: String, var m
|
|||
-1
|
||||
} else {
|
||||
if (firstString.toLowerCase() == secondString.toLowerCase()) {
|
||||
getFullName().compareTo(other.getFullName(), true)
|
||||
getNameToDisplay().compareTo(other.getNameToDisplay(), true)
|
||||
} else {
|
||||
firstString.compareTo(secondString, true)
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ data class Contact(val id: Int, var prefix: String, var firstName: String, var m
|
|||
else -> surname
|
||||
}
|
||||
|
||||
fun getFullName(): String {
|
||||
fun getNameToDisplay(): String {
|
||||
var firstPart = if (startWithSurname) surname else firstName
|
||||
if (middleName.isNotEmpty()) {
|
||||
firstPart += " $middleName"
|
||||
|
@ -110,7 +110,7 @@ data class Contact(val id: Int, var prefix: String, var firstName: String, var m
|
|||
val newEmails = ArrayList<Email>()
|
||||
emails.mapTo(newEmails) { Email(it.value, 0, "") }
|
||||
|
||||
return copy(id = 0, prefix = "", firstName = getFullName().toLowerCase(), middleName = "", surname = "", suffix = "", nickname = "", photoUri = "",
|
||||
return copy(id = 0, prefix = "", firstName = getNameToDisplay().toLowerCase(), middleName = "", surname = "", suffix = "", nickname = "", photoUri = "",
|
||||
phoneNumbers = ArrayList(), events = ArrayList(), addresses = ArrayList(), emails = newEmails, source = "", starred = 0,
|
||||
contactId = 0, thumbnailUri = "", notes = "", groups = ArrayList(), websites = ArrayList(), organization = Organization("", ""),
|
||||
IMs = ArrayList()).toString()
|
||||
|
|
Loading…
Reference in New Issue