# HG changeset patch # User marseille # Date 1240572361 -7200 # Node ID f106a71a4cf6d587786d196d87a1f225d2eff8db # Parent 0ccad9608190f2cb46bc1c520ce32f200f29b5f8 Correction bug signal affiche. Recuperation de la liste dans son etat initiale apres discution avec un contact diff -r 0ccad9608190 -r f106a71a4cf6 src/com/beem/project/beem/ui/ContactList.java --- a/src/com/beem/project/beem/ui/ContactList.java Fri Apr 24 13:02:27 2009 +0200 +++ b/src/com/beem/project/beem/ui/ContactList.java Fri Apr 24 13:26:01 2009 +0200 @@ -42,6 +42,7 @@ private static final String CHILD = "CHILD"; private static final String GROUP = "GROUP"; private IXmppFacade mService = null; + private ExpandableListAdapter mAdapter; private BeemApplication mBeemApplication; private BeemRosterListener mRosterListener; private SharedPreferences mSettings; @@ -63,6 +64,7 @@ super.onCreate(saveBundle); mRosterListener = new BeemRosterListener(); mSettings = getSharedPreferences(getString(R.string.PreferenceFileName), MODE_PRIVATE); + mBeemApplication = BeemApplication.getApplication(this); // bug fixe temporaire des betises de marseille /* * SharedPreferences mSettings = getSharedPreferences(getString(R.string.PreferenceFileName), MODE_PRIVATE); @@ -74,9 +76,11 @@ @Override protected void onResume() { super.onResume(); - mBeemApplication = BeemApplication.getApplication(this); - if (!mBeemApplication.isConnected()) + + if (!mBeemApplication.isConnected()) { + mBeemApplication = BeemApplication.getApplication(this); mBeemApplication.startBeemService(); + } mBeemApplication.callWhenConnectedToServer(new Handler(), new Runnable() { @Override public void run() { @@ -93,7 +97,8 @@ e.printStackTrace(); } } - callbackShowContactList(); + if (mAdapter == null) + callbackShowContactList(); } }); } @@ -159,15 +164,14 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == PREFERENCECHANGED) { if (resultCode == RESULT_OK) { - setListAdapter(null); + mAdapter = null; + setListAdapter(mAdapter); mBeemApplication.stopBeemService(); - mBeemApplication.startBeemService(); } } } private void showContactList(List listGroup, List listContact) { - ExpandableListAdapter Adapter; List> groupData = new ArrayList>(); List>> childData = new ArrayList>>(); int groupSize = listGroup.size(); @@ -182,7 +186,7 @@ List> children = new ArrayList>(); for (int j = 0; j < listContact.size(); ++j) { Contact c = listContact.get(j); - if (groupSize == 0 || listGroup.get(i).equals(c.getGroupName())) { + if (groupSize == 0 /* || listGroup.get(i).equals(c.getGroupName()) */) { Log.i(TAG, c.getID() + " " + c.getJID()); Map curChildMap = new HashMap(); children.add(curChildMap); @@ -192,10 +196,10 @@ childData.add(children); } - Adapter = new ContactExpandableListAdapter(this, groupData, R.layout.contactlistgroup, new String[] { GROUP }, + mAdapter = new ContactExpandableListAdapter(this, groupData, R.layout.contactlistgroup, new String[] { GROUP }, new int[] { R.id.textgroup }, childData, R.layout.contactlistcontact, new String[] { CHILD }, new int[] { R.id.contactliststatus, R.id.contactlistpseudo, R.id.contactlistmsgperso, R.id.contactlistavatar }); - setListAdapter(Adapter); + setListAdapter(mAdapter); } /**