Modification pour gerer les contacts avec les groupes.
authormarseille
Fri, 24 Apr 2009 13:02:27 +0200
changeset 173 0ccad9608190
parent 170 e892a47de086
child 174 f106a71a4cf6
Modification pour gerer les contacts avec les groupes. VOir avec bart pour recuperer le nom des groupes dans le roster !
src/com/beem/project/beem/ui/ContactList.java
--- a/src/com/beem/project/beem/ui/ContactList.java	Fri Apr 24 12:32:10 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java	Fri Apr 24 13:02:27 2009 +0200
@@ -170,8 +170,8 @@
 	ExpandableListAdapter Adapter;
 	List<Map<String, String>> groupData = new ArrayList<Map<String, String>>();
 	List<List<Map<String, Contact>>> childData = new ArrayList<List<Map<String, Contact>>>();
-
-	if (listGroup.size() == 0)
+	int groupSize = listGroup.size();
+	if (groupSize == 0)
 	    listGroup.add("Default");
 	for (int i = 0; i < listGroup.size(); i++) {
 	    Map<String, String> curGroupMap = new HashMap<String, String>();
@@ -182,10 +182,12 @@
 	    List<Map<String, Contact>> children = new ArrayList<Map<String, Contact>>();
 	    for (int j = 0; j < listContact.size(); ++j) {
 		Contact c = listContact.get(j);
-		Log.i(TAG, c.getID() + " " + c.getJID());
-		Map<String, Contact> curChildMap = new HashMap<String, Contact>();
-		children.add(curChildMap);
-		curChildMap.put(CHILD, c);
+		if (groupSize == 0 || listGroup.get(i).equals(c.getGroupName())) {
+		    Log.i(TAG, c.getID() + " " + c.getJID());
+		    Map<String, Contact> curChildMap = new HashMap<String, Contact>();
+		    children.add(curChildMap);
+		    curChildMap.put(CHILD, c);
+		}
 	    }
 	    childData.add(children);
 	}