mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-03 13:44:40 +00:00
Glob
This commit is contained in:
parent
8206b8a333
commit
51bcae1547
1 changed files with 13 additions and 1 deletions
|
@ -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()) {
|
||||
|
|
Loading…
Reference in a new issue