summaryrefslogtreecommitdiffstats
path: root/java/com/android/dialer/contactsfragment/ContactsCursorLoader.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/android/dialer/contactsfragment/ContactsCursorLoader.java')
-rw-r--r--java/com/android/dialer/contactsfragment/ContactsCursorLoader.java29
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);
}
}