This commit is contained in:
M66B 2021-06-24 08:31:39 +02:00
parent 8206b8a333
commit 51bcae1547
1 changed files with 13 additions and 1 deletions

View File

@ -1118,6 +1118,17 @@ public class FragmentCompose extends FragmentBase {
String wildcard = "%" + typed + "%";
Map<String, EntityContact> map = new HashMap<>();
String glob = "*" +
typed.toString().toLowerCase()
.replaceAll("[aáàäâã]", "\\[aáàäâã\\]")
.replaceAll("[eéèëê]", "\\[eéèëê\\]")
.replaceAll("[iíìî]", "\\[iíìî\\]")
.replaceAll("[oóòöôõ]", "\\[oóòöôõ\\]")
.replaceAll("[uúùüû]", "\\[uúùüû\\]")
.replace("*", "[*]")
.replace("?", "[?]") +
"*";
boolean contacts = Helper.hasPermission(getContext(), Manifest.permission.READ_CONTACTS);
if (contacts) {
Cursor cursor = resolver.query(
@ -1130,8 +1141,9 @@ public class FragmentCompose extends FragmentBase {
},
ContactsContract.CommonDataKinds.Email.DATA + " <> ''" +
" AND (" + ContactsContract.Contacts.DISPLAY_NAME + " LIKE ?" +
" OR LOWER(" + ContactsContract.Contacts.DISPLAY_NAME + ") GLOB ?" +
" OR " + ContactsContract.CommonDataKinds.Email.DATA + " LIKE ?)",
new String[]{wildcard, wildcard},
new String[]{wildcard, glob, wildcard},
null);
while (cursor != null && cursor.moveToNext()) {