mirror of https://github.com/M66B/FairEmail.git
Glob
This commit is contained in:
parent
8206b8a333
commit
51bcae1547
|
@ -1118,6 +1118,17 @@ public class FragmentCompose extends FragmentBase {
|
||||||
String wildcard = "%" + typed + "%";
|
String wildcard = "%" + typed + "%";
|
||||||
Map<String, EntityContact> map = new HashMap<>();
|
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);
|
boolean contacts = Helper.hasPermission(getContext(), Manifest.permission.READ_CONTACTS);
|
||||||
if (contacts) {
|
if (contacts) {
|
||||||
Cursor cursor = resolver.query(
|
Cursor cursor = resolver.query(
|
||||||
|
@ -1130,8 +1141,9 @@ public class FragmentCompose extends FragmentBase {
|
||||||
},
|
},
|
||||||
ContactsContract.CommonDataKinds.Email.DATA + " <> ''" +
|
ContactsContract.CommonDataKinds.Email.DATA + " <> ''" +
|
||||||
" AND (" + ContactsContract.Contacts.DISPLAY_NAME + " LIKE ?" +
|
" AND (" + ContactsContract.Contacts.DISPLAY_NAME + " LIKE ?" +
|
||||||
|
" OR LOWER(" + ContactsContract.Contacts.DISPLAY_NAME + ") GLOB ?" +
|
||||||
" OR " + ContactsContract.CommonDataKinds.Email.DATA + " LIKE ?)",
|
" OR " + ContactsContract.CommonDataKinds.Email.DATA + " LIKE ?)",
|
||||||
new String[]{wildcard, wildcard},
|
new String[]{wildcard, glob, wildcard},
|
||||||
null);
|
null);
|
||||||
|
|
||||||
while (cursor != null && cursor.moveToNext()) {
|
while (cursor != null && cursor.moveToNext()) {
|
||||||
|
|
Loading…
Reference in New Issue