Mark local contacts

pull/172/head
M66B 5 years ago
parent 891252bf3e
commit 2fc85244d5

@ -58,7 +58,7 @@ public interface DaoContact {
" AND email = :email COLLATE NOCASE") " AND email = :email COLLATE NOCASE")
EntityContact getContact(long account, int type, String email); EntityContact getContact(long account, int type, String email);
@Query("SELECT id AS _id, name, email" + @Query("SELECT id AS _id, name, email, name || ' *' AS display" +
" FROM contact" + " FROM contact" +
" WHERE (:account IS NULL OR account = :account)" + " WHERE (:account IS NULL OR account = :account)" +
" AND (:type IS NULL OR type = :type)" + " AND (:type IS NULL OR type = :type)" +

@ -668,7 +668,7 @@ public class FragmentCompose extends FragmentBase {
getContext(), getContext(),
R.layout.spinner_item2_dropdown, R.layout.spinner_item2_dropdown,
null, null,
new String[]{"name", "email"}, new String[]{"display", "email"},
new int[]{android.R.id.text1, android.R.id.text2}, new int[]{android.R.id.text1, android.R.id.text2},
0); 0);
@ -701,7 +701,7 @@ public class FragmentCompose extends FragmentBase {
String wildcard = "%" + typed + "%"; String wildcard = "%" + typed + "%";
List<Cursor> cursors = new ArrayList<>(); List<Cursor> cursors = new ArrayList<>();
MatrixCursor provided = new MatrixCursor(new String[]{"_id", "name", "email"}); MatrixCursor provided = new MatrixCursor(new String[]{"_id", "name", "email", "display"});
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(
@ -723,7 +723,8 @@ public class FragmentCompose extends FragmentBase {
provided.newRow() provided.newRow()
.add(cursor.getLong(0)) .add(cursor.getLong(0))
.add(cursor.getString(1)) .add(cursor.getString(1))
.add(cursor.getString(2)); .add(cursor.getString(2))
.add(cursor.getString(1));
} }
cursors.add(provided); cursors.add(provided);

Loading…
Cancel
Save