Stop using DisplayNameFormatter and reduce a query column
setDisplayName()'s 3rd param "highlightingEnabled" never becomes
true in the current implementation and thus using the entire class
seems less meaningful. After removing the formatter class, we can be
sure one of primary and alternative name column won't be needed and
can be conditionally removed.
Per the observation above, this change removes the column for Phone
UI. Note that this does *not* optimize People side yet, since it has
quite different and more complicated configuration there.
Other fixes:
- replace getMarqueeText() with setMarqueeText(), since the former
implicitly requires unconditional "new String()", while the latter
doesn't.
- Use SpannableString instead of SpannableStringBuilder. Our prefix
highlighter is already using SpannableString, and we can expect
less GC by using exactly same classes for constructing spanned
CharSequence.
- Group query constants like I5ad0876ce469fbf86334e3f77b15cd240d9f761b
for cleaning our code and make it more consistent.
-- Legacy adapters aren't modified since they are legacy anyway. We
probably don't want to touch those files as much as possible.
TESTED:
- Phone UI and People UI work with display/sort order changes
- "(No name)" is shown correctly (mUnknownNameText is working)
- Prefix highlighting works correctly (in search screens)
- Pickers work with sort order change (primary/alternative)
- no performance regression at least (no visible performance improve
will occur)
Bug: 5550672
Change-Id: Ie69b74bbabcc7211cf2b107c93980172da2d744e
diff --git a/src/com/android/contacts/list/LegacyContactListAdapter.java b/src/com/android/contacts/list/LegacyContactListAdapter.java
index b21d484..dbdce5e 100644
--- a/src/com/android/contacts/list/LegacyContactListAdapter.java
+++ b/src/com/android/contacts/list/LegacyContactListAdapter.java
@@ -85,7 +85,7 @@
}
protected void bindName(final ContactListItemView view, Cursor cursor) {
- view.showDisplayName(cursor, PERSON_DISPLAY_NAME_COLUMN_INDEX, 0, false,
+ view.showDisplayName(cursor, PERSON_DISPLAY_NAME_COLUMN_INDEX,
getContactNameDisplayOrder());
view.showPhoneticName(cursor, PERSON_PHONETIC_NAME_COLUMN_INDEX);
}