diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-07-07 09:32:10 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-07-10 00:53:44 +0200 |
commit | 3bdf84b6a0170264a20795e7956a68421f312fa3 (patch) | |
tree | 68960dec005e33dbae93ec7b7600e1c3ed1b93fa /src/eu/siacs/conversations/entities | |
parent | 7c3f3b2a3e878b1b1cfdcca102a38efe033dc6b7 (diff) |
filter contacts and starting confercenes
Diffstat (limited to 'src/eu/siacs/conversations/entities')
-rw-r--r-- | src/eu/siacs/conversations/entities/Contact.java | 21 | ||||
-rw-r--r-- | src/eu/siacs/conversations/entities/ListItem.java | 7 |
2 files changed, 21 insertions, 7 deletions
diff --git a/src/eu/siacs/conversations/entities/Contact.java b/src/eu/siacs/conversations/entities/Contact.java index 50d7af8b0..59e0fa126 100644 --- a/src/eu/siacs/conversations/entities/Contact.java +++ b/src/eu/siacs/conversations/entities/Contact.java @@ -12,7 +12,7 @@ import eu.siacs.conversations.xml.Element; import android.content.ContentValues; import android.database.Cursor; -public class Contact { +public class Contact implements ListItem { public static final String TABLENAME = "contacts"; public static final String SYSTEMNAME = "systemname"; @@ -37,7 +37,7 @@ public class Contact { protected Account account; protected boolean inRoster = true; - + public Lastseen lastseen = new Lastseen(); public Contact(String account, String systemName, String serverName, @@ -83,8 +83,10 @@ public class Contact { } public boolean match(String needle) { - return (jid.toLowerCase().contains(needle.toLowerCase()) || (getDisplayName() - .toLowerCase().contains(needle.toLowerCase()))); + return needle == null + || jid.contains(needle.toLowerCase()) + || getDisplayName().toLowerCase() + .contains(needle.toLowerCase()); } public ContentValues getContentValues() { @@ -142,8 +144,8 @@ public class Contact { || domainParts[0].equals("room") || domainParts[0].equals("muc") || domainParts[0].equals("chat") - || domainParts[0].equals("sala") - || domainParts[0].equals("salas")); + || domainParts[0].equals("sala") || domainParts[0] + .equals("salas")); } } } @@ -308,9 +310,14 @@ public class Contact { public static final int DIRTY_PUSH = 6; public static final int DIRTY_DELETE = 7; } - + public class Lastseen { public long time = 0; public String presence = null; } + + @Override + public int compareTo(ListItem another) { + return this.getDisplayName().compareToIgnoreCase(another.getDisplayName()); + } } diff --git a/src/eu/siacs/conversations/entities/ListItem.java b/src/eu/siacs/conversations/entities/ListItem.java new file mode 100644 index 000000000..ba47dff2a --- /dev/null +++ b/src/eu/siacs/conversations/entities/ListItem.java @@ -0,0 +1,7 @@ +package eu.siacs.conversations.entities; + +public interface ListItem extends Comparable<ListItem> { + public String getDisplayName(); + public String getJid(); + public String getProfilePhoto(); +} |