Suppression des contacts dans un groupe.
--- a/src/com/beem/project/beem/ui/ContactList.java Fri Sep 25 14:28:38 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java Fri Sep 25 15:55:26 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;
@@ -317,6 +324,7 @@
@Override
public void run() {
sortBeemContactList();
+ Log.i("OO", "OO");
mAdapter.notifyDataSetChanged();
}
}
@@ -326,6 +334,7 @@
*/
@Override
public void onEntriesAdded(List<String> addresses) throws RemoteException {
+ Log.i("CONTACTLIST", "ADD");
for (String newName : addresses) {
Contact c = new Contact(newName);
mListContact.add(c);
@@ -338,6 +347,7 @@
*/
@Override
public void onEntriesDeleted(List<String> addresses) throws RemoteException {
+ Log.i("CONTACTLIST", "DELETE");
for (String cToDelete : addresses) {
for (Contact c : mListContact) {
if (c.getJID().equals(cToDelete)) {
@@ -354,12 +364,27 @@
*/
@Override
public void onEntriesUpdated(List<String> addresses) throws RemoteException {
+ Log.i("CONTACTLIST", "UPDATED");
mHandler.post(new RunnableChange());
}
@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());
+ Log.i("CONTACTLIST", "delete from group");
}
/**
@@ -367,7 +392,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) {