diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-08-31 16:17:04 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-08-31 16:17:04 +0000 |
commit | c39ea3c55fac807c0b98aabdf56c70dc8a49036c (patch) | |
tree | e282668a9587cf6c1ec7b604dea860400c75c6c7 /java/com/android/dialer/contactsfragment/ContactsCursorLoader.java | |
parent | 68038172793ee0e2ab3e2e56ddfbeb82879d1f58 (diff) | |
parent | 2ca4318cc1ee57dda907ba2069bd61d162b1baef (diff) |
Merge "Update Dialer source to latest internal Google revision."
Diffstat (limited to 'java/com/android/dialer/contactsfragment/ContactsCursorLoader.java')
-rw-r--r-- | java/com/android/dialer/contactsfragment/ContactsCursorLoader.java | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/java/com/android/dialer/contactsfragment/ContactsCursorLoader.java b/java/com/android/dialer/contactsfragment/ContactsCursorLoader.java index 6d4d21079..a22f7eb39 100644 --- a/java/com/android/dialer/contactsfragment/ContactsCursorLoader.java +++ b/java/com/android/dialer/contactsfragment/ContactsCursorLoader.java @@ -29,7 +29,7 @@ final class ContactsCursorLoader extends CursorLoader { public static final int CONTACT_PHOTO_URI = 3; public static final int CONTACT_LOOKUP_KEY = 4; - public static final String[] CONTACTS_PROJECTION = + public static final String[] CONTACTS_PROJECTION_DISPLAY_NAME_PRIMARY = new String[] { Contacts._ID, // 0 Contacts.DISPLAY_NAME_PRIMARY, // 1 @@ -38,16 +38,35 @@ final class ContactsCursorLoader extends CursorLoader { Contacts.LOOKUP_KEY, // 4 }; - public ContactsCursorLoader(Context context) { + public static final String[] CONTACTS_PROJECTION_DISPLAY_NAME_ALTERNATIVE = + new String[] { + Contacts._ID, // 0 + Contacts.DISPLAY_NAME_ALTERNATIVE, // 1 + Contacts.PHOTO_ID, // 2 + Contacts.PHOTO_THUMBNAIL_URI, // 3 + Contacts.LOOKUP_KEY, // 4 + }; + + private ContactsCursorLoader(Context context, String[] contactProjection, String sortKey) { super( context, Contacts.CONTENT_URI .buildUpon() .appendQueryParameter(Contacts.EXTRA_ADDRESS_BOOK_INDEX, "true") .build(), - CONTACTS_PROJECTION, - null, + contactProjection, + contactProjection[CONTACT_DISPLAY_NAME] + " IS NOT NULL", null, - Contacts.SORT_KEY_PRIMARY + " ASC"); + sortKey + " ASC"); + } + + public static ContactsCursorLoader createInstanceDisplayNamePrimary( + Context context, String sortKey) { + return new ContactsCursorLoader(context, CONTACTS_PROJECTION_DISPLAY_NAME_PRIMARY, sortKey); + } + + public static ContactsCursorLoader createInstanceDisplayNameAlternative( + Context context, String sortKey) { + return new ContactsCursorLoader(context, CONTACTS_PROJECTION_DISPLAY_NAME_ALTERNATIVE, sortKey); } } |