diff options
author | twyen <twyen@google.com> | 2018-06-26 16:04:53 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-06-26 16:04:53 -0700 |
commit | bfd105673cd6eb21a1c207d24169ad9bfe645539 (patch) | |
tree | 198fcf37848a75c8d68f74679a56fd9dc0f4891b /java/com/android/contacts/common/list/ContactEntry.java | |
parent | ee0371753257a3db0cce37f5dffae7ac6ebf34b2 (diff) | |
parent | f9d508090cbf3b9f85b72241c77f625c152448bc (diff) |
Merge changes I45374e61,I265dcc61,Id4622886,I09d0df69,I3ea0fb46 am: 2f6900466e am: e6262b0bce
am: f9d508090c
Change-Id: I329713a5083f5ccd632b536e41f466eaef9dc4e2
Diffstat (limited to 'java/com/android/contacts/common/list/ContactEntry.java')
-rw-r--r-- | java/com/android/contacts/common/list/ContactEntry.java | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/java/com/android/contacts/common/list/ContactEntry.java b/java/com/android/contacts/common/list/ContactEntry.java index e33165e45..90e6735df 100644 --- a/java/com/android/contacts/common/list/ContactEntry.java +++ b/java/com/android/contacts/common/list/ContactEntry.java @@ -16,25 +16,19 @@ package com.android.contacts.common.list; +import android.content.Context; import android.net.Uri; import android.provider.ContactsContract.PinnedPositions; -import android.text.TextUtils; -import com.android.contacts.common.preference.ContactsPreferences; +import com.android.dialer.contacts.ContactsComponent; /** Class to hold contact information */ public class ContactEntry { public static final ContactEntry BLANK_ENTRY = new ContactEntry(); - 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 phoneLabel; public String phoneNumber; @@ -46,12 +40,9 @@ public class ContactEntry { public boolean isFavorite = false; public boolean isDefaultNumber = false; - public String getPreferredDisplayName() { - if (nameDisplayOrder == UNSET_DISPLAY_ORDER_PREFERENCE - || nameDisplayOrder == ContactsPreferences.DISPLAY_ORDER_PRIMARY - || TextUtils.isEmpty(nameAlternative)) { - return namePrimary; - } - return nameAlternative; + public String getPreferredDisplayName(Context context) { + return ContactsComponent.get(context) + .contactDisplayPreferences() + .getDisplayName(namePrimary, nameAlternative); } } |