equal
deleted
inserted
replaced
50 private IRoster mRoster; |
50 private IRoster mRoster; |
51 private Map<String, List<Contact>> groupMap; |
51 private Map<String, List<Contact>> groupMap; |
52 private List<String> groupName; |
52 private List<String> groupName; |
53 private List<Contact> mListContact; |
53 private List<Contact> mListContact; |
54 private Handler mHandler; |
54 private Handler mHandler; |
55 private IXmppFacade xmppFacade = null; |
55 public IXmppFacade xmppFacade = null; |
56 private final ServiceConnection mServConn = new BeemServiceConnection(); |
56 private final ServiceConnection mServConn = new BeemServiceConnection(); |
57 private int REQUEST_CODE = 1; |
57 private int REQUEST_CODE = 1; |
58 |
58 |
59 /** |
59 /** |
60 * Callback for menu creation. |
60 * Callback for menu creation. |
189 mHandler.post(new RunnableChange()); |
189 mHandler.post(new RunnableChange()); |
190 } |
190 } |
191 |
191 |
192 @Override |
192 @Override |
193 public void onEntriesDeleted(List<String> addresses) throws RemoteException { |
193 public void onEntriesDeleted(List<String> addresses) throws RemoteException { |
|
194 Log.i("CONTACTLIST", "EntreiesDeleted"); |
194 for (List<Contact> cList : groupMap.values()) { |
195 for (List<Contact> cList : groupMap.values()) { |
195 for (Contact curContact : cList) { |
196 for (Contact curContact : cList) { |
196 for (String addr : addresses) { |
197 for (String addr : addresses) { |
197 if (addr.equals(curContact.getJID())) { |
198 if (addr.equals(curContact.getJID())) { |
198 cList.remove(curContact); |
199 cList.remove(curContact); |
204 } |
205 } |
205 } |
206 } |
206 mHandler.post(new RunnableChange()); |
207 mHandler.post(new RunnableChange()); |
207 } |
208 } |
208 |
209 |
|
210 |
|
211 /** |
|
212 * TODO: sur la suppression de contact, on passe tt le temps dans entries updated ... |
|
213 * probleme comment reconnaitre si on supprime ou ajoute un contact .... |
|
214 */ |
209 @Override |
215 @Override |
210 public void onEntriesUpdated(List<String> addresses) throws RemoteException { |
216 public void onEntriesUpdated(List<String> addresses) throws RemoteException { |
|
217 Log.e("CONTACTLIST", "ENTRIESUPDATED"); |
211 for (String str : addresses) { |
218 for (String str : addresses) { |
212 Contact curContact = mRoster.getContact(str); |
219 Contact curContact = mRoster.getContact(str); |
213 for (String group : curContact.getGroups()) { |
220 for (String group : curContact.getGroups()) { |
214 if (!groupMap.containsKey(group)) { |
221 if (!groupMap.containsKey(group)) { |
215 groupMap.put(group, new ArrayList<Contact>()); |
222 groupMap.put(group, new ArrayList<Contact>()); |
272 } |
279 } |
273 |
280 |
274 class MyOnLongClickListener implements OnLongClickListener { |
281 class MyOnLongClickListener implements OnLongClickListener { |
275 |
282 |
276 private final Contact mContact; |
283 private final Contact mContact; |
277 |
284 private final String mGroup; |
278 public MyOnLongClickListener(Contact contact) { |
285 |
|
286 public MyOnLongClickListener(Contact contact, String group) { |
279 mContact = contact; |
287 mContact = contact; |
|
288 mGroup = group; |
280 } |
289 } |
281 |
290 |
282 @Override |
291 @Override |
283 public boolean onLongClick(View v) { |
292 public boolean onLongClick(View v) { |
284 createDialog(mContact); |
293 createDialog(mContact, mGroup); |
285 return true; |
294 return true; |
286 } |
295 } |
287 } |
296 } |
288 |
297 |
289 private final List<DataSetObserver> observers; |
298 private final List<DataSetObserver> observers; |
354 for (DataSetObserver obs : observers) { |
363 for (DataSetObserver obs : observers) { |
355 obs.onChanged(); |
364 obs.onChanged(); |
356 } |
365 } |
357 } |
366 } |
358 |
367 |
359 void createDialog(Contact contact) { |
368 void createDialog(Contact contact, String group) { |
360 ContactDialog dialogContact = new ContactDialog(ContactList.this, contact); |
369 ContactDialog dialogContact = new ContactDialog(ContactList.this, contact, group); |
361 dialogContact.setOwnerActivity(ContactList.this); |
370 dialogContact.setOwnerActivity(ContactList.this); |
362 dialogContact.show(); |
371 dialogContact.show(); |
363 } |
372 } |
364 |
373 |
365 @Override |
374 @Override |
403 v = convertView; |
412 v = convertView; |
404 } |
413 } |
405 Contact contact = groupMap.get(groupName.get(groupPosition)).get(childPosition); |
414 Contact contact = groupMap.get(groupName.get(groupPosition)).get(childPosition); |
406 bindView(v, contact); |
415 bindView(v, contact); |
407 |
416 |
408 v.setOnLongClickListener(new MyOnLongClickListener(contact)); |
417 v.setOnLongClickListener(new MyOnLongClickListener(contact, groupName.get(groupPosition))); |
409 v.setOnClickListener(new MyOnClickListener(contact)); |
418 v.setOnClickListener(new MyOnClickListener(contact)); |
410 return v; |
419 return v; |
411 } |
420 } |
412 |
421 |
413 @Override |
422 @Override |