public class GroupContact extends Contact implements Search
Modifier and Type | Class and Description |
---|---|
static interface |
GroupContact.OnGroupContactChangedListener |
Contact.UpdateStatus
HierarchyListItem.ComparatorSort, HierarchyListItem.Sort, HierarchyListItem.SortAlphabet, HierarchyListItem.SortAlphabetDesc, HierarchyListItem.SortDistanceFrom
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,Contact> |
_contacts |
protected int |
_filteredUnread |
protected boolean |
_hideIfEmpty |
protected boolean |
_hideLockedGroups |
protected java.lang.String |
_iconUri |
protected int |
_totalUnread |
protected boolean |
_unmodifiable |
protected boolean |
_userCreated |
static java.lang.String |
TAG |
BACKGROUND_COLOR_ALIVE, BACKGROUND_COLOR_DEAD, BACKGROUND_COLOR_NA, BACKGROUND_COLOR_STALE, contactUUID, FOREGROUND_COLOR_ALIVE, FOREGROUND_COLOR_DEAD, FOREGROUND_COLOR_STALE
asyncRefresh, children, disposed, filter, listener, postFilter, reusable, uiHandler
Constructor and Description |
---|
GroupContact(java.lang.String uid,
java.lang.String callsign) |
GroupContact(java.lang.String uid,
java.lang.String callsign,
boolean userCreated) |
GroupContact(java.lang.String uid,
java.lang.String callsign,
java.util.List<Contact> contacts,
boolean userCreated)
A group that has a multiple endpoints.
|
Modifier and Type | Method and Description |
---|---|
void |
addContact(Contact c) |
void |
addContacts(java.util.List<Contact> contacts)
Add a list of contacts to the master (pre-filtered) list
|
void |
addOnGroupContactChangedListener(GroupContact.OnGroupContactChangedListener listener)
Adds a listener that is notified when there is a change to the group contact
|
boolean |
alwaysShow() |
int |
calculateUnread()
Calculate the total unread count for all items in this group hierarchy
This does not depend on the result stored by refreshImpl
|
void |
clearHierarchy()
Clear this groups hierarchy without invalidating any contacts
This is mainly used when building the group hierarchy
|
java.util.Set<HierarchyListItem> |
find(java.lang.String terms) |
java.util.List<java.lang.String[]> |
findChildPaths(java.lang.String uid)
Find the path to the child contact UID to this contact
|
protected void |
fireOnGroupContactChanged() |
java.util.List<Contact> |
getAllContacts(boolean recursive)
Get all contacts (no filtering) within this group
|
java.util.List<java.lang.String> |
getAllContactUIDs(boolean recursive) |
java.util.List<java.lang.String> |
getContactUids() |
android.view.View |
getExtraView()
Returns the extra view, if any, associated with the node.
|
java.lang.String |
getIconUri()
Returns the URI for the icon for the node.
|
java.util.List<java.lang.String> |
getOnlineContactUids() |
GroupContact |
getRootUserGroup()
Return the root user group that contains this group
|
boolean |
getUnmodifiable()
Return the modifiable state of this group
|
java.util.List<Contact> |
getUnreadContacts() |
java.util.List<Contact> |
getUnreadContacts(boolean filtered)
Get list of contacts under this group which contain unread messages
|
int |
getUnreadCount() |
int |
getUnreadCount(boolean filtered)
Count total unread messages within and under this group
|
java.util.List<IndividualContact> |
getUsers() |
java.util.List<IndividualContact> |
getUsers(boolean recursive)
Get all individual contacts within this group (no filtering)
|
java.util.List<java.lang.String> |
getUserUIDs() |
java.util.List<java.lang.String> |
getUserUIDs(boolean recursive) |
boolean |
hasContact(Contact c,
boolean recursive)
Determine if this group contact has a contact or sub-contact.
|
boolean |
hideIfEmpty()
Count towards parent children if this item's children is empty
|
boolean |
isChildSupported()
Check if list item can contain children
|
boolean |
isEmpty() |
static boolean |
isGroup(Contact c) |
boolean |
isUserCreated()
Check if this group was created by the user
|
boolean |
isVisible() |
void |
lockGroup(boolean lock) |
void |
lockGroups(boolean lock)
Recursively set this group and all children groups to unmodifiable
|
protected void |
refreshImpl()
Refresh implementation to be run on a background thread
If your class doesn't need to refresh then override the filter
method above to avoid unnecessary threading
|
void |
removeAllUsers()
Remove all individuals from this group and its sub-groups
|
void |
removeContact(Contact c) |
void |
removeContacts(java.util.List<Contact> contacts)
Remove list of contacts from the master list
|
void |
removeOnGroupContactChangedListener(GroupContact.OnGroupContactChangedListener listener)
Removes a listener that is notified when there is a change to the group contact
|
void |
setContacts(java.util.List<Contact> contacts)
Set the master (pre-filtered) contact list
|
void |
setContactUIDs(java.util.List<java.lang.String> uids) |
void |
setHideIfEmpty(boolean hide) |
void |
setHideLockedGroups(boolean hide) |
void |
setIconUri(java.lang.String iconUri) |
void |
setUnmodifiable(boolean state)
Set the modifiable state (locked/unlocked) of this group
Locked means the user cannot chat within this group
|
java.lang.String |
toString() |
void |
updateLocks()
Update the group locks on every sub-group
|
protected boolean |
validChild(HierarchyListItem item)
Check if a child item is valid
Assumes item is already part of this.children
|
descendedFrom, dispatchChangeEvent, dispose, getAction, getBackgroundColor, getChildContacts, getDescendantCount, getExtras, getFiltered, getFilteredUIDs, getHierarchyPath, getName, getParent, getParentContacts, getParentHierarchy, getParentUID, getPresenceColor, getTextColor, getTitle, getUID, getUpdateStatus, getUserObject, notifyListener, refresh, refresh, setDispatch, setExtras, setListener, setName, setParentUID, setUid, setUnreadCount, setUpdateStatus, updateChildren
async, buildQueryParams, delete, disposeChildren, disposeItems, findChild, getAssociationKey, getChildActions, getChildAt, getChildCount, getChildren, getCustomLayout, getDefaultSortModes, getDeleteActions, getDescription, getDropDownSize, getExtraView, getFilter, getFooterView, getHeaderView, getIconColor, getIconDrawable, getListItemView, getLocalData, getLocalData, getPreferredListIndex, getSorts, getVisibility, isDisposed, isGetChildrenSupported, isMultiSelectSupported, notifyListener, postAccept, postRefresh, refresh, refresh, refresh, requestRefresh, requestRefresh, search, setLocalData, setPostFilter, setVisible, sortItems, syncRefresh
protected final java.util.Map<java.lang.String,Contact> _contacts
protected boolean _userCreated
protected boolean _unmodifiable
protected boolean _hideIfEmpty
protected boolean _hideLockedGroups
protected int _totalUnread
protected int _filteredUnread
protected java.lang.String _iconUri
public static final java.lang.String TAG
public GroupContact(java.lang.String uid, java.lang.String callsign, java.util.List<Contact> contacts, boolean userCreated)
uid
- UID of groupcallsign
- Display name of groupcontacts
- List of contacts under this groupuserCreated
- True if the group was user-createdpublic GroupContact(java.lang.String uid, java.lang.String callsign, boolean userCreated)
public GroupContact(java.lang.String uid, java.lang.String callsign)
public java.util.List<Contact> getAllContacts(boolean recursive)
recursive
- True to include descendant contacts
False to only include direct childrenpublic java.util.List<java.lang.String> getAllContactUIDs(boolean recursive)
public boolean hasContact(Contact c, boolean recursive)
c
- the contact to search forrecursive
- whether to traverse down sub group contactspublic java.util.List<IndividualContact> getUsers(boolean recursive)
public java.util.List<IndividualContact> getUsers()
public java.util.List<java.lang.String> getUserUIDs(boolean recursive)
public java.util.List<java.lang.String> getUserUIDs()
public java.util.List<java.lang.String> getContactUids()
public java.util.List<java.lang.String> getOnlineContactUids()
public void setContacts(java.util.List<Contact> contacts)
contacts
- List of contactspublic void setContactUIDs(java.util.List<java.lang.String> uids)
public boolean isUserCreated()
public void setUnmodifiable(boolean state)
state
- True to lock, false to unlockpublic void lockGroup(boolean lock)
public void lockGroups(boolean lock)
lock
- True to lock, false to unlockpublic void updateLocks()
public boolean getUnmodifiable()
public void addContact(Contact c)
public void addContacts(java.util.List<Contact> contacts)
contacts
- List of contactspublic void removeContact(Contact c)
public void removeContacts(java.util.List<Contact> contacts)
contacts
- List of contactspublic void removeAllUsers()
public android.view.View getExtraView()
HierarchyListItem
getExtraView
in interface HierarchyListItem
getExtraView
in class Contact
null
if there is no view.public void setIconUri(java.lang.String iconUri)
public java.lang.String getIconUri()
HierarchyListItem
getIconUri
in interface HierarchyListItem
getIconUri
in class AbstractHierarchyListItem2
null
if the node
has no icon, or "gone" to remove the icon space entirely.public boolean isChildSupported()
HierarchyListItem
isChildSupported
in interface HierarchyListItem
isChildSupported
in class AbstractHierarchyListItem2
public boolean isVisible()
isVisible
in class AbstractHierarchyListItem2
protected void refreshImpl()
AbstractHierarchyListItem2
refreshImpl
in class AbstractHierarchyListItem2
public void setHideIfEmpty(boolean hide)
public void setHideLockedGroups(boolean hide)
public boolean alwaysShow()
public boolean hideIfEmpty()
HierarchyListItem2
hideIfEmpty
in interface HierarchyListItem2
public int getUnreadCount(boolean filtered)
filtered
- True to only count filtered contactspublic int getUnreadCount()
getUnreadCount
in class Contact
public int calculateUnread()
public java.util.List<Contact> getUnreadContacts(boolean filtered)
filtered
- True to only count filtered contactspublic java.util.List<Contact> getUnreadContacts()
public GroupContact getRootUserGroup()
protected boolean validChild(HierarchyListItem item)
Contact
validChild
in class Contact
item
- Item to testpublic java.util.List<java.lang.String[]> findChildPaths(java.lang.String uid)
Contact
findChildPaths
in class Contact
uid
- Child contact UIDpublic java.util.Set<HierarchyListItem> find(java.lang.String terms)
find
in interface Search
find
in class AbstractHierarchyListItem2
public void clearHierarchy()
public boolean isEmpty()
public static boolean isGroup(Contact c)
public java.lang.String toString()
toString
in class java.lang.Object
public void addOnGroupContactChangedListener(GroupContact.OnGroupContactChangedListener listener)
listener
- the listener to be added.public void removeOnGroupContactChangedListener(GroupContact.OnGroupContactChangedListener listener)
listener
- the listener to be remove.protected void fireOnGroupContactChanged()