mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-04 16:16:33 +02:00
Simplify local contact search
This commit is contained in:
@@ -59,16 +59,12 @@ public interface DaoContact {
|
||||
EntityContact getContact(long account, int type, String email);
|
||||
|
||||
@Query("SELECT id AS _id, name, email" +
|
||||
", CASE type" +
|
||||
" WHEN " + EntityContact.TYPE_TO + " THEN '>'" +
|
||||
" WHEN " + EntityContact.TYPE_FROM + " THEN '<'" +
|
||||
" ELSE '?'" +
|
||||
" END AS type" +
|
||||
" FROM contact" +
|
||||
" WHERE (:account IS NULL OR account = :account)" +
|
||||
" AND (:type IS NULL OR type = :type)" +
|
||||
" AND (email LIKE :query COLLATE NOCASE OR name LIKE :query COLLATE NOCASE)" +
|
||||
" AND state <> " + EntityContact.STATE_IGNORE +
|
||||
" GROUP BY name, email" +
|
||||
" ORDER BY" +
|
||||
" CASE WHEN name IS NULL THEN 1 ELSE 0 END" +
|
||||
", name COLLATE NOCASE, email COLLATE NOCASE")
|
||||
|
||||
@@ -440,16 +440,9 @@ public class FragmentCompose extends FragmentBase {
|
||||
contacts
|
||||
? new String[]{
|
||||
ContactsContract.Contacts.DISPLAY_NAME,
|
||||
ContactsContract.CommonDataKinds.Email.DATA
|
||||
}
|
||||
: new String[]{
|
||||
"name",
|
||||
"email",
|
||||
"type"
|
||||
},
|
||||
contacts
|
||||
? new int[]{android.R.id.text1, android.R.id.text2}
|
||||
: new int[]{android.R.id.text1, android.R.id.text2, R.id.tvType},
|
||||
ContactsContract.CommonDataKinds.Email.DATA}
|
||||
: new String[]{"name", "email"},
|
||||
new int[]{android.R.id.text1, android.R.id.text2},
|
||||
0);
|
||||
|
||||
etTo.setAdapter(cadapter);
|
||||
|
||||
Reference in New Issue
Block a user