1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-03-03 01:51:49 -05:00

Make contacts searchable from phonetic names on Eclair and earlier.

Signed-off-by: HIRANO Takahito <hiranotaka@zng.info>
This commit is contained in:
Jesse Vincent 2011-01-04 14:33:02 +00:00
parent 2daf8eaec8
commit f8f916edde
2 changed files with 11 additions and 3 deletions

View File

@ -46,11 +46,15 @@ public abstract class Contacts
int sdkVersion = Integer.parseInt(Build.VERSION.SDK);
String className = null;
if (sdkVersion <= Build.VERSION_CODES.DONUT)
/*
* The new API appeared in Eclair, but it supported phonetic names in Froyo.
* Therefore we employ the old API in Eclair.
*/
if (sdkVersion <= Build.VERSION_CODES.ECLAIR_MR1)
{
className = "com.fsck.k9.helper.ContactsSdk3_4";
}
else if (sdkVersion >= Build.VERSION_CODES.ECLAIR)
else
{
className = "com.fsck.k9.helper.ContactsSdk5";
}

View File

@ -147,11 +147,15 @@ public class ContactsSdk3_4 extends com.fsck.k9.helper.Contacts
") OR (" +
Contacts.People.NAME + " LIKE ?" +
") OR (" +
Contacts.People.PHONETIC_NAME + " LIKE ?" +
") OR (" +
Contacts.People.PHONETIC_NAME + " LIKE ?" +
") OR (" +
Contacts.ContactMethods.DATA + " LIKE ?" +
")";
final String filter = constraint.toString() + "%";
final String filter2 = "% " + filter;
args = new String[] {filter, filter2, filter};
args = new String[] {filter, filter2, filter, filter2, filter};
}
final Cursor c = mContentResolver.query(