Predictable sort order for contact lookup by email address

master
M66B 1 month ago
parent 17de79d52e
commit e538e0f036

@ -312,7 +312,7 @@ public class ContactInfo {
ContactsContract.Contacts.LOOKUP_KEY,
ContactsContract.Contacts.DISPLAY_NAME
},
null, null, null)) {
null, null, ContactsContract.Contacts.DISPLAY_NAME)) {
if (cursor != null && cursor.moveToNext()) {
int colContactId = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Photo.CONTACT_ID);
@ -1155,7 +1155,7 @@ public class ContactInfo {
ContactsContract.Contacts.DISPLAY_NAME
},
ContactsContract.CommonDataKinds.Email.ADDRESS + " <> ''",
null, null)) {
null, ContactsContract.Contacts.DISPLAY_NAME)) {
while (cursor != null && cursor.moveToNext()) {
long contactId = cursor.getLong(0);
String lookupKey = cursor.getString(1);

@ -1280,7 +1280,7 @@ public class FragmentCompose extends FragmentBase {
" OR LOWER(" + ContactsContract.Contacts.DISPLAY_NAME + ") GLOB ?" +
" OR " + ContactsContract.CommonDataKinds.Email.DATA + " LIKE ?)",
new String[]{wildcard, glob, wildcard},
null)) {
ContactsContract.Contacts.DISPLAY_NAME)) {
while (cursor != null && cursor.moveToNext()) {
EntityContact item = new EntityContact();
@ -3479,7 +3479,7 @@ public class FragmentCompose extends FragmentBase {
ContactsContract.CommonDataKinds.Email.ADDRESS,
ContactsContract.Contacts.DISPLAY_NAME
},
null, null, null)) {
null, null, ContactsContract.Contacts.DISPLAY_NAME)) {
// https://issuetracker.google.com/issues/118400813
// https://developer.android.com/guide/topics/providers/content-provider-basics#DisplayResults
if (cursor != null && cursor.getCount() == 0)
@ -4867,7 +4867,7 @@ public class FragmentCompose extends FragmentBase {
},
ContactsContract.Data.CONTACT_ID + " = ?",
new String[]{cursor.getString(0)},
null)) {
ContactsContract.Contacts.DISPLAY_NAME)) {
if (contact != null && contact.moveToNext()) {
String name = contact.getString(0);
String email = contact.getString(1);

@ -185,7 +185,7 @@ class Shortcuts {
ContactsContract.Contacts.DISPLAY_NAME
},
ContactsContract.CommonDataKinds.Email.ADDRESS + " = ?",
new String[]{email}, null)) {
new String[]{email}, ContactsContract.Contacts.DISPLAY_NAME)) {
if (cursor != null && cursor.moveToNext()) {
int colContactId = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Photo.CONTACT_ID);
int colLookupKey = cursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY);

Loading…
Cancel
Save