author | nikita@nikita-lab |
Sat, 20 Jun 2009 18:01:09 +0200 | |
changeset 251 | fae2a16a1f28 |
parent 250 | bce0846bc3ed |
child 252 | f9bbba863298 |
permissions | -rw-r--r-- |
22
280112cd9602
Reorganisation des fichiers de linterface.
marseille@marseille-desktop
parents:
diff
changeset
|
1 |
package com.beem.project.beem.ui; |
280112cd9602
Reorganisation des fichiers de linterface.
marseille@marseille-desktop
parents:
diff
changeset
|
2 |
|
280112cd9602
Reorganisation des fichiers de linterface.
marseille@marseille-desktop
parents:
diff
changeset
|
3 |
import java.util.ArrayList; |
239
65369afd96d3
Rajout de Log dans le beem service pour les reconnections etc.
marseille@marseille-desktop
parents:
238
diff
changeset
|
4 |
import java.util.Collections; |
65369afd96d3
Rajout de Log dans le beem service pour les reconnections etc.
marseille@marseille-desktop
parents:
238
diff
changeset
|
5 |
import java.util.Comparator; |
22
280112cd9602
Reorganisation des fichiers de linterface.
marseille@marseille-desktop
parents:
diff
changeset
|
6 |
import java.util.HashMap; |
280112cd9602
Reorganisation des fichiers de linterface.
marseille@marseille-desktop
parents:
diff
changeset
|
7 |
import java.util.List; |
280112cd9602
Reorganisation des fichiers de linterface.
marseille@marseille-desktop
parents:
diff
changeset
|
8 |
import java.util.Map; |
52 | 9 |
|
191
cc21283865ad
La liste marche, mais chut faut pas le dire a darkmouchefdeprojtyran
nikita@nikita-lab
parents:
185
diff
changeset
|
10 |
import org.jivesoftware.smack.util.StringUtils; |
cc21283865ad
La liste marche, mais chut faut pas le dire a darkmouchefdeprojtyran
nikita@nikita-lab
parents:
185
diff
changeset
|
11 |
|
22
280112cd9602
Reorganisation des fichiers de linterface.
marseille@marseille-desktop
parents:
diff
changeset
|
12 |
import android.app.ExpandableListActivity; |
237
66ea747448ea
Suppression de la beemapplication dans contactlist.
marseille@marseille-desktop
parents:
235
diff
changeset
|
13 |
import android.content.ComponentName; |
22
280112cd9602
Reorganisation des fichiers de linterface.
marseille@marseille-desktop
parents:
diff
changeset
|
14 |
import android.content.Intent; |
237
66ea747448ea
Suppression de la beemapplication dans contactlist.
marseille@marseille-desktop
parents:
235
diff
changeset
|
15 |
import android.content.ServiceConnection; |
191
cc21283865ad
La liste marche, mais chut faut pas le dire a darkmouchefdeprojtyran
nikita@nikita-lab
parents:
185
diff
changeset
|
16 |
import android.database.DataSetObserver; |
60
aa70a805da17
Ajout de nombreux icones pour la gestion des status.
marseille@KungFuh
parents:
59
diff
changeset
|
17 |
import android.graphics.drawable.Drawable; |
22
280112cd9602
Reorganisation des fichiers de linterface.
marseille@marseille-desktop
parents:
diff
changeset
|
18 |
import android.os.Bundle; |
47 | 19 |
import android.os.Handler; |
237
66ea747448ea
Suppression de la beemapplication dans contactlist.
marseille@marseille-desktop
parents:
235
diff
changeset
|
20 |
import android.os.IBinder; |
33
0e65d5f55d2f
Merge with ui. Synchronous connection worked.
Da Risk <darisk972@gmail.com>
parents:
22
diff
changeset
|
21 |
import android.os.RemoteException; |
0e65d5f55d2f
Merge with ui. Synchronous connection worked.
Da Risk <darisk972@gmail.com>
parents:
22
diff
changeset
|
22 |
import android.util.Log; |
191
cc21283865ad
La liste marche, mais chut faut pas le dire a darkmouchefdeprojtyran
nikita@nikita-lab
parents:
185
diff
changeset
|
23 |
import android.view.LayoutInflater; |
52 | 24 |
import android.view.Menu; |
25 |
import android.view.MenuInflater; |
|
26 |
import android.view.MenuItem; |
|
42
a0baf41c24a1
Ajout de la partie de barbu. Mais c'est en dur.
marseille@KungFuh
parents:
41
diff
changeset
|
27 |
import android.view.View; |
47 | 28 |
import android.view.ViewGroup; |
196 | 29 |
import android.view.View.OnClickListener; |
30 |
import android.view.View.OnLongClickListener; |
|
22
280112cd9602
Reorganisation des fichiers de linterface.
marseille@marseille-desktop
parents:
diff
changeset
|
31 |
import android.widget.ExpandableListAdapter; |
60
aa70a805da17
Ajout de nombreux icones pour la gestion des status.
marseille@KungFuh
parents:
59
diff
changeset
|
32 |
import android.widget.ImageView; |
47 | 33 |
import android.widget.TextView; |
52 | 34 |
|
237
66ea747448ea
Suppression de la beemapplication dans contactlist.
marseille@marseille-desktop
parents:
235
diff
changeset
|
35 |
import com.beem.project.beem.BeemService; |
59 | 36 |
import com.beem.project.beem.R; |
38
3e76846c48a9
We can now get the contact list of the user.
Da Risk <darisk972@gmail.com>
parents:
33
diff
changeset
|
37 |
import com.beem.project.beem.service.Contact; |
77
0f474a0c4e93
Hop petit commit pour que popop puisse debugger.
marseille@KungFuh
parents:
76
diff
changeset
|
38 |
import com.beem.project.beem.service.PresenceAdapter; |
0f474a0c4e93
Hop petit commit pour que popop puisse debugger.
marseille@KungFuh
parents:
76
diff
changeset
|
39 |
import com.beem.project.beem.service.aidl.IBeemRosterListener; |
88 | 40 |
import com.beem.project.beem.service.aidl.IRoster; |
67
8c3870db8e31
Rename some XMPP* classes in Xmpp*
Da Risk <darisk972@gmail.com>
parents:
48
diff
changeset
|
41 |
import com.beem.project.beem.service.aidl.IXmppFacade; |
106
a9bc9297dff7
Amelioration de la methode change status.
Da Risk <darisk972@gmail.com>
parents:
105
diff
changeset
|
42 |
import com.beem.project.beem.utils.Status; |
22
280112cd9602
Reorganisation des fichiers de linterface.
marseille@marseille-desktop
parents:
diff
changeset
|
43 |
|
280112cd9602
Reorganisation des fichiers de linterface.
marseille@marseille-desktop
parents:
diff
changeset
|
44 |
public class ContactList extends ExpandableListActivity { |
280112cd9602
Reorganisation des fichiers de linterface.
marseille@marseille-desktop
parents:
diff
changeset
|
45 |
|
250 | 46 |
private static final String TAG = "CONTACTLIST_ACT"; |
47 |
private static final String DEFAULT_GROUP = "Default"; |
|
48 |
private MyExpandableListAdapter mAdapter; |
|
49 |
private IRoster mRoster; |
|
50 |
private Map<String, List<Contact>> groupMap; |
|
51 |
private List<String> groupName; |
|
52 |
private List<Contact> mListContact; |
|
53 |
private Handler mHandler; |
|
54 |
private IXmppFacade xmppFacade = null; |
|
55 |
private final ServiceConnection mServConn = new BeemServiceConnection(); |
|
238
ef8d8745894a
Correction bug lors de la Fermeture de la contactlist
marseille@marseille-desktop
parents:
237
diff
changeset
|
56 |
|
250 | 57 |
/** |
58 |
* Callback for menu creation. |
|
59 |
* @param menu the menu created |
|
60 |
* @return true on success, false otherwise |
|
61 |
*/ |
|
239
65369afd96d3
Rajout de Log dans le beem service pour les reconnections etc.
marseille@marseille-desktop
parents:
238
diff
changeset
|
62 |
@Override |
250 | 63 |
public final boolean onCreateOptionsMenu(Menu menu) { |
64 |
super.onCreateOptionsMenu(menu); |
|
65 |
MenuInflater inflater = getMenuInflater(); |
|
66 |
inflater.inflate(R.menu.contact_list, menu); |
|
67 |
return true; |
|
240 | 68 |
} |
239
65369afd96d3
Rajout de Log dans le beem service pour les reconnections etc.
marseille@marseille-desktop
parents:
238
diff
changeset
|
69 |
|
250 | 70 |
/** |
71 |
* Callback for menu item selected. |
|
72 |
* @param item the item selected |
|
73 |
* @return true on success, false otherwise |
|
74 |
*/ |
|
75 |
@Override |
|
76 |
public final boolean onOptionsItemSelected(MenuItem item) { |
|
77 |
switch (item.getItemId()) { |
|
78 |
case R.id.contact_list_menu_settings: |
|
79 |
startActivity(new Intent(this, EditSettings.class)); |
|
80 |
return true; |
|
81 |
case R.id.contact_list_menu_add_contact: |
|
82 |
startActivity(new Intent(ContactList.this, AddContact.class)); |
|
83 |
return true; |
|
84 |
default: |
|
85 |
return false; |
|
235
d8fa7f751a0f
Arrangement de la classe ContactList .
marseille@marseille-desktop
parents:
234
diff
changeset
|
86 |
} |
d8fa7f751a0f
Arrangement de la classe ContactList .
marseille@marseille-desktop
parents:
234
diff
changeset
|
87 |
} |
22
280112cd9602
Reorganisation des fichiers de linterface.
marseille@marseille-desktop
parents:
diff
changeset
|
88 |
|
212 | 89 |
@Override |
250 | 90 |
protected void onCreate(Bundle saveBundle) { |
91 |
super.onCreate(saveBundle); |
|
92 |
bindService(new Intent(this, BeemService.class), mServConn, BIND_AUTO_CREATE); |
|
93 |
mHandler = new Handler(); |
|
94 |
groupMap = new HashMap<String, List<Contact>>(); |
|
95 |
groupName = new ArrayList<String>(); |
|
212 | 96 |
} |
97 |
||
98 |
@Override |
|
250 | 99 |
protected void onDestroy() { |
100 |
super.onDestroy(); |
|
101 |
unbindService(mServConn); |
|
102 |
} |
|
103 |
||
104 |
class ComparatorContactListByName<T> implements Comparator<T> { |
|
105 |
@Override |
|
106 |
public int compare(T c1, T c2) { |
|
107 |
return ((Contact) c1).getName().compareToIgnoreCase(((Contact) c2).getName()); |
|
108 |
} |
|
109 |
} |
|
110 |
||
111 |
class ComparatorContactListByStatusAndName<T> implements Comparator<T> { |
|
112 |
@Override |
|
113 |
public int compare(T c1, T c2) { |
|
114 |
if (((Contact) c1).getStatus() < ((Contact) c2).getStatus()) { |
|
115 |
return 1; |
|
116 |
} else if (((Contact) c1).getStatus() > ((Contact) c2).getStatus()) { |
|
117 |
return -1; |
|
118 |
} else |
|
119 |
return ((Contact) c1).getName().compareToIgnoreCase(((Contact) c2).getName()); |
|
120 |
} |
|
121 |
} |
|
122 |
||
123 |
private void buildContactList(List<Contact> listContact) { |
|
124 |
mListContact = listContact; |
|
125 |
Collections.sort(mListContact, new ComparatorContactListByStatusAndName<Contact>()); |
|
126 |
for (Contact contact : mListContact) { |
|
127 |
for (String group : contact.getGroups()) { |
|
128 |
if (!groupMap.containsKey(group)) { |
|
129 |
groupMap.put(group, new ArrayList<Contact>()); |
|
130 |
Collections.sort(groupMap.get(group), new ComparatorContactListByStatusAndName<Contact>()); |
|
131 |
groupName.add(group); |
|
132 |
} |
|
133 |
try { |
|
134 |
if (!groupMap.get(group).contains(contact)) |
|
135 |
groupMap.get(group).add(contact); |
|
136 |
} catch (NullPointerException e) { |
|
137 |
Log.e(TAG, "Failed to find group in groupMap", e); |
|
138 |
} |
|
212 | 139 |
} |
250 | 140 |
if (contact.getGroups().isEmpty()) { |
141 |
if (!groupMap.containsKey(DEFAULT_GROUP)) { |
|
142 |
groupMap.put(DEFAULT_GROUP, new ArrayList<Contact>()); |
|
143 |
groupName.add(DEFAULT_GROUP); |
|
144 |
} |
|
145 |
groupMap.get(DEFAULT_GROUP).add(contact); |
|
146 |
} |
|
86 | 147 |
} |
250 | 148 |
mAdapter = new MyExpandableListAdapter(); |
149 |
setListAdapter(mAdapter); |
|
212 | 150 |
} |
170 | 151 |
|
250 | 152 |
private class BeemRosterListener extends IBeemRosterListener.Stub { |
153 |
||
154 |
@Override |
|
155 |
public void onEntriesAdded(List<String> addresses) throws RemoteException { |
|
156 |
for (String str : addresses) { |
|
157 |
Contact curContact = mRoster.getContact(str); |
|
158 |
for (String group : curContact.getGroups()) { |
|
159 |
if (!groupMap.containsKey(group)) { |
|
160 |
groupMap.put(group, new ArrayList<Contact>()); |
|
161 |
groupName.add(group); |
|
162 |
} |
|
163 |
try { |
|
164 |
groupMap.get(group).add(curContact); |
|
165 |
} catch (NullPointerException e) { |
|
166 |
Log.e(TAG, "Failed to find group in groupMap", e); |
|
167 |
} |
|
168 |
} |
|
212 | 169 |
} |
250 | 170 |
mHandler.post(new RunnableChange()); |
171 |
} |
|
172 |
||
173 |
@Override |
|
174 |
public void onEntriesDeleted(List<String> addresses) throws RemoteException { |
|
175 |
for (List<Contact> cList : groupMap.values()) { |
|
176 |
for (Contact curContact : cList) { |
|
177 |
for (String addr : addresses) { |
|
178 |
if (addr.equals(curContact.getJID())) { |
|
179 |
cList.remove(curContact); |
|
180 |
if (cList.isEmpty()) { |
|
181 |
groupMap.values().remove(cList); |
|
182 |
} |
|
183 |
} |
|
184 |
} |
|
185 |
} |
|
212 | 186 |
} |
250 | 187 |
mHandler.post(new RunnableChange()); |
212 | 188 |
} |
189 |
||
250 | 190 |
@Override |
191 |
public void onEntriesUpdated(List<String> addresses) throws RemoteException { |
|
192 |
for (String str : addresses) { |
|
193 |
Contact curContact = mRoster.getContact(str); |
|
194 |
for (String group : curContact.getGroups()) { |
|
195 |
if (!groupMap.containsKey(group)) { |
|
196 |
groupMap.put(group, new ArrayList<Contact>()); |
|
197 |
groupName.add(group); |
|
198 |
groupMap.get(group).add(curContact); |
|
199 |
} else { |
|
200 |
boolean found = false; |
|
201 |
for (Contact tempContact : groupMap.get(group)) { |
|
202 |
if (tempContact.getJID() == str) { |
|
203 |
curContact = tempContact; |
|
204 |
found = true; |
|
205 |
break; |
|
206 |
} |
|
207 |
} |
|
208 |
if (!found) { |
|
209 |
groupMap.get(group).add(curContact); |
|
210 |
} |
|
211 |
} |
|
212 |
} |
|
213 |
} |
|
214 |
mHandler.post(new RunnableChange()); |
|
212 | 215 |
} |
235
d8fa7f751a0f
Arrangement de la classe ContactList .
marseille@marseille-desktop
parents:
234
diff
changeset
|
216 |
|
250 | 217 |
@Override |
218 |
public void onPresenceChanged(PresenceAdapter presence) throws RemoteException { |
|
219 |
for (Contact curContact : mListContact) { |
|
220 |
if (curContact.getJID().equals(StringUtils.parseBareAddress(presence.getFrom()))) { |
|
251 | 221 |
curContact.setStatus(mRoster.getPresence(StringUtils.parseBareAddress(presence.getFrom()))); |
250 | 222 |
mHandler.post(new RunnableChange()); |
223 |
return; |
|
224 |
} |
|
225 |
} |
|
226 |
} |
|
212 | 227 |
|
250 | 228 |
private class RunnableChange implements Runnable { |
229 |
@Override |
|
230 |
public void run() { |
|
231 |
mAdapter.changed(); |
|
232 |
} |
|
233 |
} |
|
212 | 234 |
|
235 |
} |
|
236 |
||
250 | 237 |
private class MyExpandableListAdapter implements ExpandableListAdapter { |
238 |
||
239 |
class MyOnClickListener implements OnClickListener { |
|
212 | 240 |
|
250 | 241 |
private final Contact mContact; |
242 |
||
243 |
public MyOnClickListener(Contact contact) { |
|
244 |
mContact = contact; |
|
245 |
} |
|
212 | 246 |
|
250 | 247 |
@Override |
248 |
public void onClick(View v) { |
|
249 |
Intent i = new Intent(ContactList.this, SendIM.class); |
|
250 |
i.setData(mContact.toUri()); |
|
251 |
startActivity(i); |
|
252 |
} |
|
253 |
||
254 |
} |
|
255 |
||
256 |
class MyOnLongClickListener implements OnLongClickListener { |
|
257 |
||
258 |
private final Contact mContact; |
|
212 | 259 |
|
250 | 260 |
public MyOnLongClickListener(Contact contact) { |
261 |
mContact = contact; |
|
262 |
} |
|
212 | 263 |
|
250 | 264 |
@Override |
265 |
public boolean onLongClick(View v) { |
|
266 |
createDialog(mContact); |
|
267 |
return true; |
|
268 |
} |
|
269 |
} |
|
196 | 270 |
|
250 | 271 |
private final List<DataSetObserver> observers; |
272 |
||
273 |
public MyExpandableListAdapter() { |
|
274 |
observers = new ArrayList<DataSetObserver>(); |
|
275 |
} |
|
276 |
||
196 | 277 |
|
250 | 278 |
@Override |
279 |
public boolean areAllItemsEnabled() { |
|
280 |
return true; |
|
281 |
} |
|
212 | 282 |
|
250 | 283 |
private void bindView(View view, Contact curContact) { |
212 | 284 |
|
250 | 285 |
if (curContact != null) { |
286 |
ImageView imgV = (ImageView) view.findViewById(R.id.contactliststatus); |
|
287 |
Drawable imageDrawable = null; |
|
288 |
switch (curContact.getStatus()) { |
|
289 |
case Status.CONTACT_STATUS_AVAILABLE: |
|
290 |
imageDrawable = getResources().getDrawable(R.drawable.online); |
|
291 |
break; |
|
292 |
case Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT: |
|
293 |
imageDrawable = getResources().getDrawable(R.drawable.chat); |
|
294 |
break; |
|
295 |
case Status.CONTACT_STATUS_AWAY: |
|
296 |
imageDrawable = getResources().getDrawable(R.drawable.away); |
|
297 |
break; |
|
298 |
case Status.CONTACT_STATUS_BUSY: |
|
299 |
imageDrawable = getResources().getDrawable(R.drawable.dnd); |
|
300 |
break; |
|
301 |
case Status.CONTACT_STATUS_DISCONNECT: |
|
302 |
imageDrawable = getResources().getDrawable(R.drawable.offline); |
|
303 |
break; |
|
304 |
case Status.CONTACT_STATUS_UNAVAILABLE: |
|
305 |
imageDrawable = getResources().getDrawable(R.drawable.requested); |
|
306 |
break; |
|
307 |
default: |
|
308 |
imageDrawable = getResources().getDrawable(R.drawable.error); |
|
309 |
break; |
|
310 |
} |
|
311 |
imgV.setImageDrawable(imageDrawable); |
|
312 |
||
313 |
TextView v = (TextView) view.findViewById(R.id.contactlistpseudo); |
|
314 |
if (v != null) { |
|
315 |
v.setText(curContact.getName()); |
|
316 |
} |
|
317 |
||
318 |
v = (TextView) view.findViewById(R.id.contactlistmsgperso); |
|
319 |
if (v != null) { |
|
320 |
v.setText(curContact.getMsgState()); |
|
321 |
} |
|
322 |
||
323 |
// TODO: Rajouter l'avatar du contact getAvatar() dans la classe |
|
324 |
imgV = (ImageView) view.findViewById(R.id.contactlistavatar); |
|
325 |
if (imgV != null) { |
|
326 |
imageDrawable = getResources().getDrawable(R.drawable.avatar); |
|
327 |
imgV.setImageDrawable(imageDrawable); |
|
328 |
} |
|
329 |
} |
|
212 | 330 |
} |
331 |
||
250 | 332 |
public void changed() { |
251 | 333 |
for (String name : groupName) { |
334 |
Collections.sort(groupMap.get(name), new ComparatorContactListByStatusAndName<Contact>()); |
|
335 |
} |
|
250 | 336 |
for (DataSetObserver obs : observers) { |
337 |
obs.onChanged(); |
|
338 |
} |
|
339 |
} |
|
340 |
||
341 |
void createDialog(Contact contact) { |
|
342 |
ContactDialog dialogContact = new ContactDialog(ContactList.this, contact); |
|
343 |
dialogContact.setOwnerActivity(ContactList.this); |
|
344 |
dialogContact.show(); |
|
212 | 345 |
} |
346 |
||
250 | 347 |
@Override |
348 |
public Object getChild(int groupPosition, int childPosition) { |
|
349 |
try { |
|
350 |
return groupMap.get(groupName.get(groupPosition)).get(childPosition); |
|
351 |
} catch (NullPointerException e) { |
|
352 |
Log.e(TAG, "Child not found", e); |
|
353 |
return null; |
|
354 |
} |
|
355 |
} |
|
356 |
||
357 |
@Override |
|
358 |
public long getChildId(int groupPosition, int childPosition) { |
|
359 |
try { |
|
360 |
groupMap.get(groupName.get(groupPosition)).get(childPosition); |
|
361 |
} catch (NullPointerException e) { |
|
362 |
Log.e(TAG, "Child not found", e); |
|
363 |
return 0; |
|
364 |
} |
|
365 |
return childPosition; |
|
366 |
} |
|
367 |
||
368 |
@Override |
|
369 |
public int getChildrenCount(int groupPosition) { |
|
370 |
try { |
|
371 |
return groupMap.get(groupName.get(groupPosition)).size(); |
|
372 |
} catch (NullPointerException e) { |
|
373 |
Log.e(TAG, "Child not found", e); |
|
374 |
return 0; |
|
375 |
} |
|
376 |
} |
|
377 |
||
378 |
@Override |
|
379 |
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, |
|
380 |
ViewGroup parent) { |
|
381 |
View v; |
|
382 |
if (convertView == null) { |
|
383 |
v = LayoutInflater.from(ContactList.this).inflate(R.layout.contactlistcontact, null); |
|
384 |
} else { |
|
385 |
v = convertView; |
|
386 |
} |
|
387 |
Contact contact = groupMap.get(groupName.get(groupPosition)).get(childPosition); |
|
388 |
bindView(v, contact); |
|
389 |
||
390 |
v.setOnLongClickListener(new MyOnLongClickListener(contact)); |
|
391 |
v.setOnClickListener(new MyOnClickListener(contact)); |
|
392 |
return v; |
|
393 |
} |
|
394 |
||
395 |
@Override |
|
396 |
public long getCombinedChildId(long groupId, long childId) { |
|
397 |
return 1000 * groupId + childId; |
|
398 |
} |
|
399 |
||
400 |
@Override |
|
401 |
public long getCombinedGroupId(long groupId) { |
|
402 |
return 1000 * groupId; |
|
212 | 403 |
} |
404 |
||
250 | 405 |
@Override |
406 |
public Object getGroup(int groupPosition) { |
|
407 |
try { |
|
408 |
return groupMap.get(groupName.get(groupPosition)); |
|
409 |
} catch (NullPointerException e) { |
|
410 |
Log.e(TAG, "Group not found", e); |
|
411 |
return null; |
|
412 |
} |
|
413 |
} |
|
414 |
||
415 |
@Override |
|
416 |
public int getGroupCount() { |
|
417 |
return groupMap.size(); |
|
212 | 418 |
} |
250 | 419 |
|
420 |
@Override |
|
421 |
public long getGroupId(int groupPosition) { |
|
422 |
return groupPosition; |
|
423 |
} |
|
212 | 424 |
|
250 | 425 |
@Override |
426 |
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { |
|
427 |
if (convertView == null) { |
|
428 |
convertView = LayoutInflater.from(ContactList.this).inflate(R.layout.contactlistgroup, null); |
|
429 |
} |
|
430 |
TextView groupTextView = (TextView) convertView.findViewById(R.id.textgroup); |
|
431 |
groupTextView.setText(groupName.get(groupPosition)); |
|
432 |
return convertView; |
|
433 |
} |
|
196 | 434 |
|
250 | 435 |
@Override |
436 |
public boolean hasStableIds() { |
|
437 |
return false; |
|
438 |
} |
|
439 |
||
440 |
@Override |
|
441 |
public boolean isChildSelectable(int groupPosition, int childPosition) { |
|
442 |
return true; |
|
443 |
} |
|
444 |
||
445 |
@Override |
|
446 |
public boolean isEmpty() { |
|
447 |
return groupMap.isEmpty(); |
|
448 |
} |
|
48 | 449 |
|
250 | 450 |
@Override |
451 |
public void onGroupCollapsed(int groupPosition) { |
|
452 |
} |
|
453 |
||
454 |
@Override |
|
455 |
public void onGroupExpanded(int groupPosition) { |
|
456 |
} |
|
48 | 457 |
|
250 | 458 |
@Override |
459 |
public void registerDataSetObserver(DataSetObserver observer) { |
|
460 |
observers.add(observer); |
|
461 |
} |
|
462 |
||
463 |
@Override |
|
464 |
public void unregisterDataSetObserver(DataSetObserver observer) { |
|
465 |
observers.remove(observer); |
|
466 |
} |
|
42
a0baf41c24a1
Ajout de la partie de barbu. Mais c'est en dur.
marseille@KungFuh
parents:
41
diff
changeset
|
467 |
} |
22
280112cd9602
Reorganisation des fichiers de linterface.
marseille@marseille-desktop
parents:
diff
changeset
|
468 |
|
250 | 469 |
private class BeemServiceConnection implements ServiceConnection { |
60
aa70a805da17
Ajout de nombreux icones pour la gestion des status.
marseille@KungFuh
parents:
59
diff
changeset
|
470 |
|
250 | 471 |
@Override |
472 |
public void onServiceConnected(ComponentName name, IBinder service) { |
|
473 |
xmppFacade = IXmppFacade.Stub.asInterface(service); |
|
474 |
try { |
|
475 |
mRoster = xmppFacade.getRoster(); |
|
476 |
if (mRoster != null) { |
|
477 |
mRoster.addRosterListener(new BeemRosterListener()); |
|
478 |
buildContactList(mRoster.getContactList()); |
|
479 |
} |
|
480 |
} catch (RemoteException e) { |
|
481 |
e.printStackTrace(); |
|
482 |
} |
|
483 |
} |
|
191
cc21283865ad
La liste marche, mais chut faut pas le dire a darkmouchefdeprojtyran
nikita@nikita-lab
parents:
185
diff
changeset
|
484 |
|
250 | 485 |
@Override |
486 |
public void onServiceDisconnected(ComponentName name) { |
|
487 |
xmppFacade = null; |
|
488 |
mRoster = null; |
|
489 |
} |
|
191
cc21283865ad
La liste marche, mais chut faut pas le dire a darkmouchefdeprojtyran
nikita@nikita-lab
parents:
185
diff
changeset
|
490 |
} |
184 | 491 |
} |