Loading src/com/android/contacts/common/ContactTileLoaderFactory.java +4 −2 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ public final class ContactTileLoaderFactory { // contacts._id because the query is performed on the data table. In order to obtain the // contact id for strequent items, we thus have to use Phone.contact_id instead. public final static int CONTACT_ID_FOR_DATA = 10; public final static int DISPLAY_NAME_ALTERNATIVE = 11; private static final String[] COLUMNS = new String[] { Contacts._ID, // ..........................................0 Loading @@ -68,7 +69,7 @@ public final class ContactTileLoaderFactory { @VisibleForTesting public static final String[] COLUMNS_PHONE_ONLY = new String[] { Contacts._ID, // ..........................................0 Contacts.DISPLAY_NAME, // .................................1 Contacts.DISPLAY_NAME_PRIMARY, // .........................1 Contacts.STARRED, // ......................................2 Contacts.PHOTO_URI, // ....................................3 Contacts.LOOKUP_KEY, // ...................................4 Loading @@ -77,7 +78,8 @@ public final class ContactTileLoaderFactory { Phone.LABEL, // ...........................................7 Phone.IS_SUPER_PRIMARY, //.................................8 Contacts.PINNED, // .......................................9 Phone.CONTACT_ID //........................................10 Phone.CONTACT_ID, //.......................................10 Contacts.DISPLAY_NAME_ALTERNATIVE, // .....................11 }; private static final String STARRED_ORDER = Contacts.DISPLAY_NAME+" COLLATE NOCASE ASC"; Loading src/com/android/contacts/common/list/ContactEntry.java +29 −1 Original line number Diff line number Diff line Loading @@ -19,12 +19,31 @@ package com.android.contacts.common.list; import android.graphics.drawable.Drawable; import android.net.Uri; import android.provider.ContactsContract.PinnedPositions; import android.text.TextUtils; import com.android.contacts.common.preference.ContactsPreferences; /** * Class to hold contact information */ public class ContactEntry { public String name; private static final int UNSET_DISPLAY_ORDER_PREFERENCE = -1; /** * Primary name for a Contact */ public String namePrimary; /** * Alternative name for a Contact, e.g. last name first */ public String nameAlternative; /** * The user's preference on name display order, last name first or first time first. * {@see ContactsPreferences} */ public int nameDisplayOrder = UNSET_DISPLAY_ORDER_PREFERENCE; public String status; public String phoneLabel; public String phoneNumber; Loading @@ -38,4 +57,13 @@ public class ContactEntry { public boolean isDefaultNumber = false; public static final ContactEntry BLANK_ENTRY = new ContactEntry(); public String getPreferredDisplayName() { if (nameDisplayOrder == UNSET_DISPLAY_ORDER_PREFERENCE || nameDisplayOrder == ContactsPreferences.DISPLAY_ORDER_PRIMARY || TextUtils.isEmpty(nameAlternative)) { return namePrimary; } return nameAlternative; } } No newline at end of file src/com/android/contacts/common/list/ContactTileAdapter.java +1 −1 Original line number Diff line number Diff line Loading @@ -243,7 +243,7 @@ public class ContactTileAdapter extends BaseAdapter { ContactEntry contact = new ContactEntry(); String name = cursor.getString(mNameIndex); contact.name = (name != null) ? name : mResources.getString(R.string.missing_name); contact.namePrimary = (name != null) ? name : mResources.getString(R.string.missing_name); contact.status = cursor.getString(mStatusIndex); contact.photoUri = (photoUri != null ? Uri.parse(photoUri) : null); contact.lookupKey = lookupKey; Loading src/com/android/contacts/common/list/ContactTileView.java +7 −6 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ public abstract class ContactTileView extends FrameLayout { public void loadFromContact(ContactEntry entry) { if (entry != null) { mName.setText(getNameForView(entry.name)); mName.setText(getNameForView(entry)); mLookupUri = entry.lookupUri; if (mStatus != null) { Loading Loading @@ -125,7 +125,8 @@ public abstract class ContactTileView extends FrameLayout { setVisibility(View.VISIBLE); if (mPhotoManager != null) { DefaultImageRequest request = getDefaultImageRequest(entry.name, entry.lookupKey); DefaultImageRequest request = getDefaultImageRequest(entry.namePrimary, entry.lookupKey); configureViewForImage(entry.photoUri == null); if (mPhoto != null) { mPhotoManager.loadPhoto(mPhoto, entry.photoUri, getApproximateImageSize(), Loading @@ -145,9 +146,9 @@ public abstract class ContactTileView extends FrameLayout { } if (mPushState != null) { mPushState.setContentDescription(entry.name); mPushState.setContentDescription(entry.namePrimary); } else if (mQuickContact != null) { mQuickContact.setContentDescription(entry.name); mQuickContact.setContentDescription(entry.namePrimary); } } else { setVisibility(View.INVISIBLE); Loading Loading @@ -178,8 +179,8 @@ public abstract class ContactTileView extends FrameLayout { * Returns the string that should actually be displayed as the contact's name. Subclasses * can override this to return formatted versions of the name - i.e. first name only. */ protected String getNameForView(String name) { return name; protected String getNameForView(ContactEntry contactEntry) { return contactEntry.namePrimary; } /** Loading Loading
src/com/android/contacts/common/ContactTileLoaderFactory.java +4 −2 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ public final class ContactTileLoaderFactory { // contacts._id because the query is performed on the data table. In order to obtain the // contact id for strequent items, we thus have to use Phone.contact_id instead. public final static int CONTACT_ID_FOR_DATA = 10; public final static int DISPLAY_NAME_ALTERNATIVE = 11; private static final String[] COLUMNS = new String[] { Contacts._ID, // ..........................................0 Loading @@ -68,7 +69,7 @@ public final class ContactTileLoaderFactory { @VisibleForTesting public static final String[] COLUMNS_PHONE_ONLY = new String[] { Contacts._ID, // ..........................................0 Contacts.DISPLAY_NAME, // .................................1 Contacts.DISPLAY_NAME_PRIMARY, // .........................1 Contacts.STARRED, // ......................................2 Contacts.PHOTO_URI, // ....................................3 Contacts.LOOKUP_KEY, // ...................................4 Loading @@ -77,7 +78,8 @@ public final class ContactTileLoaderFactory { Phone.LABEL, // ...........................................7 Phone.IS_SUPER_PRIMARY, //.................................8 Contacts.PINNED, // .......................................9 Phone.CONTACT_ID //........................................10 Phone.CONTACT_ID, //.......................................10 Contacts.DISPLAY_NAME_ALTERNATIVE, // .....................11 }; private static final String STARRED_ORDER = Contacts.DISPLAY_NAME+" COLLATE NOCASE ASC"; Loading
src/com/android/contacts/common/list/ContactEntry.java +29 −1 Original line number Diff line number Diff line Loading @@ -19,12 +19,31 @@ package com.android.contacts.common.list; import android.graphics.drawable.Drawable; import android.net.Uri; import android.provider.ContactsContract.PinnedPositions; import android.text.TextUtils; import com.android.contacts.common.preference.ContactsPreferences; /** * Class to hold contact information */ public class ContactEntry { public String name; private static final int UNSET_DISPLAY_ORDER_PREFERENCE = -1; /** * Primary name for a Contact */ public String namePrimary; /** * Alternative name for a Contact, e.g. last name first */ public String nameAlternative; /** * The user's preference on name display order, last name first or first time first. * {@see ContactsPreferences} */ public int nameDisplayOrder = UNSET_DISPLAY_ORDER_PREFERENCE; public String status; public String phoneLabel; public String phoneNumber; Loading @@ -38,4 +57,13 @@ public class ContactEntry { public boolean isDefaultNumber = false; public static final ContactEntry BLANK_ENTRY = new ContactEntry(); public String getPreferredDisplayName() { if (nameDisplayOrder == UNSET_DISPLAY_ORDER_PREFERENCE || nameDisplayOrder == ContactsPreferences.DISPLAY_ORDER_PRIMARY || TextUtils.isEmpty(nameAlternative)) { return namePrimary; } return nameAlternative; } } No newline at end of file
src/com/android/contacts/common/list/ContactTileAdapter.java +1 −1 Original line number Diff line number Diff line Loading @@ -243,7 +243,7 @@ public class ContactTileAdapter extends BaseAdapter { ContactEntry contact = new ContactEntry(); String name = cursor.getString(mNameIndex); contact.name = (name != null) ? name : mResources.getString(R.string.missing_name); contact.namePrimary = (name != null) ? name : mResources.getString(R.string.missing_name); contact.status = cursor.getString(mStatusIndex); contact.photoUri = (photoUri != null ? Uri.parse(photoUri) : null); contact.lookupKey = lookupKey; Loading
src/com/android/contacts/common/list/ContactTileView.java +7 −6 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ public abstract class ContactTileView extends FrameLayout { public void loadFromContact(ContactEntry entry) { if (entry != null) { mName.setText(getNameForView(entry.name)); mName.setText(getNameForView(entry)); mLookupUri = entry.lookupUri; if (mStatus != null) { Loading Loading @@ -125,7 +125,8 @@ public abstract class ContactTileView extends FrameLayout { setVisibility(View.VISIBLE); if (mPhotoManager != null) { DefaultImageRequest request = getDefaultImageRequest(entry.name, entry.lookupKey); DefaultImageRequest request = getDefaultImageRequest(entry.namePrimary, entry.lookupKey); configureViewForImage(entry.photoUri == null); if (mPhoto != null) { mPhotoManager.loadPhoto(mPhoto, entry.photoUri, getApproximateImageSize(), Loading @@ -145,9 +146,9 @@ public abstract class ContactTileView extends FrameLayout { } if (mPushState != null) { mPushState.setContentDescription(entry.name); mPushState.setContentDescription(entry.namePrimary); } else if (mQuickContact != null) { mQuickContact.setContentDescription(entry.name); mQuickContact.setContentDescription(entry.namePrimary); } } else { setVisibility(View.INVISIBLE); Loading Loading @@ -178,8 +179,8 @@ public abstract class ContactTileView extends FrameLayout { * Returns the string that should actually be displayed as the contact's name. Subclasses * can override this to return formatted versions of the name - i.e. first name only. */ protected String getNameForView(String name) { return name; protected String getNameForView(ContactEntry contactEntry) { return contactEntry.namePrimary; } /** Loading