ListItem.java

 1package eu.siacs.conversations.entities;
 2
 3import android.content.Context;
 4
 5import java.io.Serializable;
 6import java.util.List;
 7import java.util.Locale;
 8
 9import eu.siacs.conversations.entities.Account;
10import eu.siacs.conversations.services.AvatarService;
11import eu.siacs.conversations.xmpp.Jid;
12
13
14public interface ListItem extends Comparable<ListItem>, AvatarService.Avatarable {
15	String getDisplayName();
16
17	Jid getJid();
18
19	Account getAccount();
20
21	List<Tag> getTags(Context context);
22
23	final class Tag implements Serializable {
24		private final String name;
25
26		public Tag(final String name) {
27			this.name = name;
28		}
29
30		public String getName() {
31			return this.name;
32		}
33
34		public String toString() {
35			return getName();
36		}
37
38		public boolean equals(Object o) {
39			if (!(o instanceof Tag)) return false;
40			Tag ot = (Tag) o;
41			return name.toLowerCase(Locale.US).equals(ot.getName().toLowerCase(Locale.US));
42		}
43
44		public int hashCode() {
45			return name.toLowerCase(Locale.US).hashCode();
46		}
47	}
48
49	boolean match(Context context, final String needle);
50}