merge
authorDa Risk <darisk972@gmail.com>
Fri, 25 Sep 2009 15:15:49 +0200
changeset 388 21f8a872962f
parent 387 055bfaf224ce (current diff)
parent 386 928e9403f8c1 (diff)
child 389 e6161048130d
merge
--- a/res/values-en/strings.xml	Fri Sep 25 15:14:49 2009 +0200
+++ b/res/values-en/strings.xml	Fri Sep 25 15:15:49 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 15:14:49 2009 +0200
+++ b/res/values-fr/strings.xml	Fri Sep 25 15:15:49 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 15:14:49 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java	Fri Sep 25 15:15:49 2009 +0200
@@ -1,5 +1,6 @@
 package com.beem.project.beem.ui;
 
+import java.security.spec.MGF1ParameterSpec;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
@@ -156,6 +157,12 @@
 	unbindService(mServConn);
     }
 
+    @Override
+    public void onContentChanged() {
+	super.onContentChanged();
+	Log.i("OO", "CHANGED");
+    }
+
     /**
      * Comparator Contact by Name.
      */
@@ -263,7 +270,7 @@
 	@Override
 	public boolean onItemLongClick(AdapterView<?> arg0, View v, int pos, long lpos) {
 	    Contact c = mListContact.get(pos);
-	    ContactDialog dialogContact = new ContactDialog(ContactList.this, c, "MYSTATICGROUP");
+	    ContactDialog dialogContact = new ContactDialog(ContactList.this, c, mCurGroup);
 	    dialogContact.setOwnerActivity(ContactList.this);
 	    dialogContact.show();
 	    return true;
@@ -358,8 +365,21 @@
 	}
 
 	@Override
-	public void onEntryDeleteFromGroup(String group, String jid) throws RemoteException {
-	    // TODO Auto-generated method stub
+	public void onEntryDeleteFromGroup(String group, String jid) throws RemoteException {	    
+	    List<Contact> tmpContactList = mContactOnGroup.get(group);
+	    Contact curContact = null;
+	    for (Contact c : tmpContactList) {
+		if (jid.equals(c.getJID())) {
+		    curContact = c;
+		    tmpContactList.remove(c);
+		    c.getGroups().remove(group);
+		    break;
+		}
+	    }
+	    if (curContact != null && curContact.getGroups().size() == 0) {
+		mContactOnGroup.get(getString(R.string.contact_list_no_group)).add(curContact);
+	    }
+	    mHandler.post(new RunnableChange());
 	}
 
 	/**
@@ -367,7 +387,6 @@
 	 */
 	@Override
 	public void onPresenceChanged(PresenceAdapter presence) throws RemoteException {
-	    // TODO gerer la presence au niveau de chaque ressources ?
 	    String from = presence.getFrom();
 	    boolean resfound = false;
 	    for (Contact curContact : mListContact) {
@@ -580,16 +599,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;