diff options
author | calderwoodra <calderwoodra@google.com> | 2017-10-18 04:49:12 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-10-18 04:49:12 +0000 |
commit | df419c43b14e58e5241867e3bd2962a7b555f74f (patch) | |
tree | 7606a99d60659b38dbc4895e1826afac70e550de /java/com/android/dialer/searchfragment/common | |
parent | 7f1dd720b96504ce706e4d7d8867211048bf5cfa (diff) | |
parent | 4b46ec2258373c76c44c900a3cfe93c1d28935a8 (diff) |
Merge changes Ib92b055d,I5c9f66ff
am: 4b46ec2258
Change-Id: I8cbfb88558d46cbdd3ed696b56774913d1839a78
Diffstat (limited to 'java/com/android/dialer/searchfragment/common')
-rw-r--r-- | java/com/android/dialer/searchfragment/common/Projections.java | 44 | ||||
-rw-r--r-- | java/com/android/dialer/searchfragment/common/QueryFilteringUtil.java | 4 |
2 files changed, 31 insertions, 17 deletions
diff --git a/java/com/android/dialer/searchfragment/common/Projections.java b/java/com/android/dialer/searchfragment/common/Projections.java index 078c3e5e6..aaf9e80f1 100644 --- a/java/com/android/dialer/searchfragment/common/Projections.java +++ b/java/com/android/dialer/searchfragment/common/Projections.java @@ -16,37 +16,47 @@ package com.android.dialer.searchfragment.common; +import android.provider.ContactsContract.CommonDataKinds.Nickname; +import android.provider.ContactsContract.CommonDataKinds.Organization; import android.provider.ContactsContract.CommonDataKinds.Phone; +import android.provider.ContactsContract.Data; /** Class containing relevant projections for searching contacts. */ public class Projections { - public static final int PHONE_ID = 0; + public static final int ID = 0; public static final int PHONE_TYPE = 1; public static final int PHONE_LABEL = 2; public static final int PHONE_NUMBER = 3; - public static final int PHONE_DISPLAY_NAME = 4; - public static final int PHONE_PHOTO_ID = 5; - public static final int PHONE_PHOTO_URI = 6; - public static final int PHONE_LOOKUP_KEY = 7; - public static final int PHONE_CARRIER_PRESENCE = 8; - public static final int PHONE_CONTACT_ID = 9; + public static final int DISPLAY_NAME = 4; + public static final int PHOTO_ID = 5; + public static final int PHOTO_URI = 6; + public static final int LOOKUP_KEY = 7; + public static final int CARRIER_PRESENCE = 8; + public static final int CONTACT_ID = 9; + public static final int MIME_TYPE = 10; @SuppressWarnings("unused") - public static final int PHONE_SORT_KEY = 10; + public static final int SORT_KEY = 11; - public static final String[] PHONE_PROJECTION = + public static final int COMPANY_NAME = 12; + public static final int NICKNAME = 13; + + public static final String[] DATA_PROJECTION = new String[] { - Phone._ID, // 0 + Data._ID, // 0 Phone.TYPE, // 1 Phone.LABEL, // 2 Phone.NUMBER, // 3 - Phone.DISPLAY_NAME_PRIMARY, // 4 - Phone.PHOTO_ID, // 5 - Phone.PHOTO_THUMBNAIL_URI, // 6 - Phone.LOOKUP_KEY, // 7 - Phone.CARRIER_PRESENCE, // 8 - Phone.CONTACT_ID, // 9 - Phone.SORT_KEY_PRIMARY // 10 + Data.DISPLAY_NAME_PRIMARY, // 4 + Data.PHOTO_ID, // 5 + Data.PHOTO_THUMBNAIL_URI, // 6 + Data.LOOKUP_KEY, // 7 + Data.CARRIER_PRESENCE, // 8 + Data.CONTACT_ID, // 9 + Data.MIMETYPE, // 10 + Data.SORT_KEY_PRIMARY, // 11 + Organization.COMPANY, // 12 + Nickname.NAME // 13 }; } diff --git a/java/com/android/dialer/searchfragment/common/QueryFilteringUtil.java b/java/com/android/dialer/searchfragment/common/QueryFilteringUtil.java index 775f8deec..6b5cea88d 100644 --- a/java/com/android/dialer/searchfragment/common/QueryFilteringUtil.java +++ b/java/com/android/dialer/searchfragment/common/QueryFilteringUtil.java @@ -81,6 +81,10 @@ public class QueryFilteringUtil { * </ul> */ public static boolean nameContainsQuery(String query, String name) { + if (TextUtils.isEmpty(name)) { + return false; + } + return Pattern.compile("(^|\\s)" + Pattern.quote(query.toLowerCase())) .matcher(name.toLowerCase()) .find(); |