From 9f30511257958b640102e1714f68feeaacc8a70f Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 17 Mar 2019 09:55:25 +0000 Subject: [PATCH] Sort searched contacts by name and email --- app/src/main/java/eu/faircode/email/DaoContact.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/DaoContact.java b/app/src/main/java/eu/faircode/email/DaoContact.java index b1b01f7d21..20ace8667a 100644 --- a/app/src/main/java/eu/faircode/email/DaoContact.java +++ b/app/src/main/java/eu/faircode/email/DaoContact.java @@ -68,7 +68,10 @@ public interface DaoContact { " 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) + " AND state <> " + EntityContact.STATE_IGNORE + + " ORDER BY" + + " CASE WHEN name IS NULL THEN 1 ELSE 0 END" + + ", name COLLATE NOCASE, email COLLATE NOCASE") Cursor searchContacts(Long account, Integer type, String query); @Insert