Gestion des contacts sans groupe.
authorVincent Veronis <veroni_v@epitech.net>
Fri, 25 Sep 2009 14:28:38 +0200
changeset 384 0909c0428116
parent 383 228b20eb8b44
child 385 df1ad72832a4
Gestion des contacts sans groupe.
res/values-en/strings.xml
res/values-fr/strings.xml
src/com/beem/project/beem/ui/ContactList.java
--- a/res/values-en/strings.xml	Fri Sep 25 00:05:26 2009 +0200
+++ b/res/values-en/strings.xml	Fri Sep 25 14:28:38 2009 +0200
@@ -207,5 +207,6 @@
 	 <string name="contact_list_menu_add_contact">Add a contact</string>
 	 <string name="contact_list_menu_settings">Settings</string>
 	 <string name="contact_list_all_contact">All contacts</string>
+	 <string name="contact_list_no_group">No group</string>
 
 </resources>
--- a/res/values-fr/strings.xml	Fri Sep 25 00:05:26 2009 +0200
+++ b/res/values-fr/strings.xml	Fri Sep 25 14:28:38 2009 +0200
@@ -201,5 +201,6 @@
 	 <string name="contact_list_menu_add_contact">Ajouter un contact</string>
 	 <string name="contact_list_menu_settings">Param├Ętres</string>
 	 <string name="contact_list_all_contact">Tous les contacts</string>
+	 <string name="contact_list_no_group">Aucun groupe</string>
 
 </resources>
--- a/src/com/beem/project/beem/ui/ContactList.java	Fri Sep 25 00:05:26 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java	Fri Sep 25 14:28:38 2009 +0200
@@ -580,16 +580,20 @@
 		    List<String> tmpGroupList = mRoster.getGroupsNames();
 		    Collections.sort(tmpGroupList);
 		    mListGroup = tmpGroupList;
+		    mListGroup.add(getString(R.string.contact_list_no_group));
 		    if (tmpGroupList.size() > 0) {
+			List<Contact> tmpNoGroup = new ArrayList<Contact>();
 			for (String s : tmpGroupList) {
 			    List<Contact> tmpList = new ArrayList<Contact>();
 			    for (Contact c : tmpContactList) {
-				if (c.getGroups().contains(s)) {
+				if (c.getGroups().size() == 0 && !tmpNoGroup.contains(c))
+				    tmpNoGroup.add(c);
+				else if (c.getGroups().contains(s))
 				    tmpList.add(c);
-				}
 			    }
 			    mContactOnGroup.put(s, tmpList);
 			}
+			mContactOnGroup.put(getString(R.string.contact_list_no_group), tmpNoGroup);
 			mCurGroup = tmpGroupList.get(0);
 		    } else {
 			mCurGroup = null;