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/util/ContactDisplayUtils.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/util/ContactDisplayUtils.java')
-rw-r--r-- | java/com/android/contacts/common/util/ContactDisplayUtils.java | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/java/com/android/contacts/common/util/ContactDisplayUtils.java b/java/com/android/contacts/common/util/ContactDisplayUtils.java index 7d428e102..967395af4 100644 --- a/java/com/android/contacts/common/util/ContactDisplayUtils.java +++ b/java/com/android/contacts/common/util/ContactDisplayUtils.java @@ -28,7 +28,6 @@ import android.text.TextUtils; import android.text.style.TtsSpan; import android.util.Patterns; import com.android.contacts.common.R; -import com.android.contacts.common.preference.ContactsPreferences; import com.android.dialer.common.LogUtil; import java.util.Objects; @@ -244,62 +243,4 @@ public class ContactDisplayUtils { String msg = resources.getString(stringId, number); return ContactDisplayUtils.getTelephoneTtsSpannable(msg, number); } - - /** - * Returns either namePrimary or nameAlternative based on the {@link ContactsPreferences}. - * Defaults to the name that is non-null. - * - * @param namePrimary the primary name. - * @param nameAlternative the alternative name. - * @param contactsPreferences the ContactsPreferences used to determine the preferred display - * name. - * @return namePrimary or nameAlternative depending on the value of displayOrderPreference. - */ - public static String getPreferredDisplayName( - String namePrimary, - String nameAlternative, - @Nullable ContactsPreferences contactsPreferences) { - if (contactsPreferences == null) { - return namePrimary != null ? namePrimary : nameAlternative; - } - if (contactsPreferences.getDisplayOrder() == ContactsPreferences.DISPLAY_ORDER_PRIMARY) { - return namePrimary; - } - - if (contactsPreferences.getDisplayOrder() == ContactsPreferences.DISPLAY_ORDER_ALTERNATIVE - && !TextUtils.isEmpty(nameAlternative)) { - return nameAlternative; - } - - return namePrimary; - } - - /** - * Returns either namePrimary or nameAlternative based on the {@link ContactsPreferences}. - * Defaults to the name that is non-null. - * - * @param namePrimary the primary name. - * @param nameAlternative the alternative name. - * @param contactsPreferences the ContactsPreferences used to determine the preferred sort order. - * @return namePrimary or nameAlternative depending on the value of displayOrderPreference. - */ - public static String getPreferredSortName( - String namePrimary, - String nameAlternative, - @Nullable ContactsPreferences contactsPreferences) { - if (contactsPreferences == null) { - return namePrimary != null ? namePrimary : nameAlternative; - } - - if (contactsPreferences.getSortOrder() == ContactsPreferences.SORT_ORDER_PRIMARY) { - return namePrimary; - } - - if (contactsPreferences.getSortOrder() == ContactsPreferences.SORT_ORDER_ALTERNATIVE - && !TextUtils.isEmpty(nameAlternative)) { - return nameAlternative; - } - - return namePrimary; - } } |