diff options
Diffstat (limited to 'java/com/android/contacts/common/util')
-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; - } } |