From 5578d928bf777f721ec0ec04c84ddb7d3ea56edb Mon Sep 17 00:00:00 2001 From: twyen Date: Mon, 25 Jun 2018 12:36:26 -0700 Subject: Refactor ContactPreference Moving it outside contacts.commons reduces dependency to legacy code. Also removed redundant implementations such as caching SharedPreferences (it is already cached), custom ListPreferences (standard ListPreferences already have what we want), and corrected preference storage location (allow standard ListPreferences to work) TEST=TAP Test: TAP PiperOrigin-RevId: 202000393 Change-Id: I45374e610b3510784b5a4da92e5d8462cbfc92bb --- java/com/android/dialer/calllogutils/PhoneCallDetails.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'java/com/android/dialer/calllogutils') diff --git a/java/com/android/dialer/calllogutils/PhoneCallDetails.java b/java/com/android/dialer/calllogutils/PhoneCallDetails.java index fe8bfde43..7212fa960 100644 --- a/java/com/android/dialer/calllogutils/PhoneCallDetails.java +++ b/java/com/android/dialer/calllogutils/PhoneCallDetails.java @@ -25,8 +25,8 @@ import android.support.annotation.Nullable; import android.telecom.PhoneAccountHandle; import android.text.TextUtils; import com.android.contacts.common.ContactsUtils.UserType; -import com.android.contacts.common.preference.ContactsPreferences; import com.android.contacts.common.util.ContactDisplayUtils; +import com.android.dialer.contacts.displaypreference.ContactDisplayPreferences.DisplayOrder; import com.android.dialer.logging.ContactSource; import com.android.dialer.phonenumbercache.ContactInfo; @@ -65,7 +65,7 @@ public class PhoneCallDetails { * The user's preference on name display order, last name first or first time first. {@see * ContactsPreferences} */ - public int nameDisplayOrder; + public DisplayOrder nameDisplayOrder; // The type of phone, e.g., {@link Phone#TYPE_HOME}, 0 if not available. public int numberType; // The custom label associated with the phone number in the contact, or the empty string. @@ -183,8 +183,7 @@ public class PhoneCallDetails { * @return the preferred name */ public CharSequence getPreferredName() { - if (nameDisplayOrder == ContactsPreferences.DISPLAY_ORDER_PRIMARY - || TextUtils.isEmpty(nameAlternative)) { + if (nameDisplayOrder == DisplayOrder.PRIMARY || TextUtils.isEmpty(nameAlternative)) { return namePrimary; } return nameAlternative; -- cgit v1.2.3