mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-04 06:20:26 +00:00
Faster contact photo lookup
This commit is contained in:
parent
dd593ce56a
commit
a6fa65b788
1 changed files with 5 additions and 5 deletions
|
@ -123,16 +123,16 @@ public class ContactInfo {
|
||||||
|
|
||||||
if (Helper.hasPermission(context, Manifest.permission.READ_CONTACTS)) {
|
if (Helper.hasPermission(context, Manifest.permission.READ_CONTACTS)) {
|
||||||
ContentResolver resolver = context.getContentResolver();
|
ContentResolver resolver = context.getContentResolver();
|
||||||
try (Cursor cursor = resolver.query(ContactsContract.CommonDataKinds.Email.CONTENT_URI,
|
Uri uri = Uri.withAppendedPath(
|
||||||
|
ContactsContract.CommonDataKinds.Email.CONTENT_LOOKUP_URI,
|
||||||
|
Uri.encode(address.getAddress()));
|
||||||
|
try (Cursor cursor = resolver.query(uri,
|
||||||
new String[]{
|
new String[]{
|
||||||
ContactsContract.CommonDataKinds.Photo.CONTACT_ID,
|
ContactsContract.CommonDataKinds.Photo.CONTACT_ID,
|
||||||
ContactsContract.Contacts.LOOKUP_KEY,
|
ContactsContract.Contacts.LOOKUP_KEY,
|
||||||
ContactsContract.Contacts.DISPLAY_NAME
|
ContactsContract.Contacts.DISPLAY_NAME
|
||||||
},
|
},
|
||||||
ContactsContract.CommonDataKinds.Email.ADDRESS + " = ? COLLATE NOCASE",
|
null, null, null)) {
|
||||||
new String[]{
|
|
||||||
address.getAddress()
|
|
||||||
}, null)) {
|
|
||||||
|
|
||||||
if (cursor != null && cursor.moveToNext()) {
|
if (cursor != null && cursor.moveToNext()) {
|
||||||
int colContactId = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Photo.CONTACT_ID);
|
int colContactId = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Photo.CONTACT_ID);
|
||||||
|
|
Loading…
Reference in a new issue