diff options
Diffstat (limited to 'java/com/android/dialer/contactsfragment/ContactsCursorLoader.java')
-rw-r--r-- | java/com/android/dialer/contactsfragment/ContactsCursorLoader.java | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/java/com/android/dialer/contactsfragment/ContactsCursorLoader.java b/java/com/android/dialer/contactsfragment/ContactsCursorLoader.java index 6d4d21079..2bb540ac0 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, + contactProjection, 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); } } |