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/dialer/contactsfragment/ContactsCursorLoader.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/dialer/contactsfragment/ContactsCursorLoader.java')
-rw-r--r-- | java/com/android/dialer/contactsfragment/ContactsCursorLoader.java | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/java/com/android/dialer/contactsfragment/ContactsCursorLoader.java b/java/com/android/dialer/contactsfragment/ContactsCursorLoader.java index e55f95149..d74afe538 100644 --- a/java/com/android/dialer/contactsfragment/ContactsCursorLoader.java +++ b/java/com/android/dialer/contactsfragment/ContactsCursorLoader.java @@ -21,7 +21,7 @@ import android.content.CursorLoader; import android.net.Uri; import android.provider.ContactsContract.Contacts; import android.text.TextUtils; -import com.android.contacts.common.preference.ContactsPreferences; +import com.android.dialer.contacts.ContactsComponent; /** Cursor Loader for {@link ContactsFragment}. */ final class ContactsCursorLoader extends CursorLoader { @@ -61,12 +61,13 @@ final class ContactsCursorLoader extends CursorLoader { } private static String[] getProjection(Context context) { - ContactsPreferences contactsPrefs = new ContactsPreferences(context); - boolean displayOrderPrimary = - (contactsPrefs.getDisplayOrder() == ContactsPreferences.DISPLAY_ORDER_PRIMARY); - return displayOrderPrimary - ? CONTACTS_PROJECTION_DISPLAY_NAME_PRIMARY - : CONTACTS_PROJECTION_DISPLAY_NAME_ALTERNATIVE; + switch (ContactsComponent.get(context).contactDisplayPreferences().getDisplayOrder()) { + case PRIMARY: + return CONTACTS_PROJECTION_DISPLAY_NAME_PRIMARY; + case ALTERNATIVE: + return CONTACTS_PROJECTION_DISPLAY_NAME_ALTERNATIVE; + } + throw new AssertionError("exhaustive switch"); } private static String getWhere(Context context, boolean hasPhoneNumbers) { @@ -78,10 +79,14 @@ final class ContactsCursorLoader extends CursorLoader { } private static String getSortKey(Context context) { - ContactsPreferences contactsPrefs = new ContactsPreferences(context); - boolean sortOrderPrimary = - (contactsPrefs.getSortOrder() == ContactsPreferences.SORT_ORDER_PRIMARY); - return sortOrderPrimary ? Contacts.SORT_KEY_PRIMARY : Contacts.SORT_KEY_ALTERNATIVE; + + switch (ContactsComponent.get(context).contactDisplayPreferences().getSortOrder()) { + case BY_PRIMARY: + return Contacts.SORT_KEY_PRIMARY; + case BY_ALTERNATIVE: + return Contacts.SORT_KEY_ALTERNATIVE; + } + throw new AssertionError("exhaustive switch"); } /** Update cursor loader to filter contacts based on the provided query. */ |