# HG changeset patch # User marseille # Date 1240512486 -7200 # Node ID 60c5f4d64a2be43d1315d5939ba9dd116a903b9b # Parent 2faf7174aa03fd10a193c357830a52fd77503586 Configuration appel par default. Ou lorsqu'aucun host nest specifie. diff -r 2faf7174aa03 -r 60c5f4d64a2b src/com/beem/project/beem/ui/ContactList.java --- a/src/com/beem/project/beem/ui/ContactList.java Thu Apr 23 17:18:49 2009 +0200 +++ b/src/com/beem/project/beem/ui/ContactList.java Thu Apr 23 20:48:06 2009 +0200 @@ -8,6 +8,7 @@ import android.app.ExpandableListActivity; import android.content.Context; import android.content.Intent; +import android.content.SharedPreferences; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; @@ -43,6 +44,7 @@ private IXmppFacade mService = null; private BeemApplication mBeemApplication; private BeemRosterListener mRosterListener; + private SharedPreferences mSettings; private IRoster mRoster; @SuppressWarnings("unchecked") @@ -61,6 +63,7 @@ super.onCreate(saveBundle); mBeemApplication = BeemApplication.getApplication(this); mRosterListener = new BeemRosterListener(); + mSettings = getSharedPreferences(getString(R.string.PreferenceFileName), MODE_PRIVATE); mBeemApplication.startBeemService(); mBeemApplication.callWhenConnectedToServer(new Handler(), new Runnable() { @Override @@ -84,6 +87,14 @@ } @Override + protected void onResume() { + super.onResume(); + if (mSettings.getString(getString(R.string.PreferenceHostKey), "") == "") { + startActivityForResult(new Intent(this, ContactListSettings.class), PREFERENCECHANGED); + } + } + + @Override protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); @@ -181,10 +192,9 @@ childData.add(children); } - Adapter = 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 }); + Adapter = 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); } diff -r 2faf7174aa03 -r 60c5f4d64a2b src/com/beem/project/beem/ui/ContactListSettings.java --- a/src/com/beem/project/beem/ui/ContactListSettings.java Thu Apr 23 17:18:49 2009 +0200 +++ b/src/com/beem/project/beem/ui/ContactListSettings.java Thu Apr 23 20:48:06 2009 +0200 @@ -2,6 +2,7 @@ import android.app.Activity; import android.content.Context; +import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.util.Log; @@ -51,16 +52,18 @@ showSettings(); Button ok = (Button) findViewById(R.id.ok); ok.setOnClickListener(mOkListener); - + Button reco = (Button) findViewById(R.id.reconnect); - reco.setOnClickListener(new OnClickListener () { + reco.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { - setResult(RESULT_OK); - finish(); + if (mSettings.getString(getString(R.string.PreferenceHostKey), "") != "") { + setResult(RESULT_OK); + finish(); + } } - + }); } @@ -95,7 +98,7 @@ private OnClickListener mOkListener = new OnClickListener() { public void onClick(View v) { SharedPreferences.Editor editor = mSettings.edit(); - + if (isChanged(R.id.host, R.string.PreferenceHostKey)) { editor.putString(getString(R.string.PreferenceHostKey), getWidgetText(R.id.host)); mIsChanged = true; @@ -117,8 +120,10 @@ editor.putString(getString(R.string.PreferenceProxyHost), getWidgetText(R.id.proxy_host)); mIsChanged = true; } - if (Integer.parseInt(getWidgetText(R.id.proxy_port)) != mSettings.getInt(getString(R.string.PreferenceProxyPort), 1080) ) { - editor.putInt(getString(R.string.PreferenceProxyPort), Integer.parseInt(getWidgetText(R.id.proxy_port))); + if (Integer.parseInt(getWidgetText(R.id.proxy_port)) != mSettings.getInt( + getString(R.string.PreferenceProxyPort), 1080)) { + editor + .putInt(getString(R.string.PreferenceProxyPort), Integer.parseInt(getWidgetText(R.id.proxy_port))); mIsChanged = true; } if (isChanged(R.id.proxy_login, R.string.PreferenceProxyUser)) {