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