Ajout d'une verification que le compte est configure avant de lancer la
connexion
--- a/res/values-en/strings.xml Fri Jun 26 20:38:43 2009 +0200
+++ b/res/values-en/strings.xml Wed Jul 01 14:15:06 2009 +0200
@@ -37,6 +37,7 @@
<string name="PreferenceProxyTypeSocks5">SOCKS5</string>
<string name="PreferenceStatus">status</string>
<string name="PreferenceStatusText">status_text</string>
+ <string name="PreferenceIsConfigured">preference_is_configured</string>
<!-- ContactListSettings class -->
<string name="CLSServerConnection">Server connection</string>
--- a/src/com/beem/project/beem/ui/EditSettings.java Fri Jun 26 20:38:43 2009 +0200
+++ b/src/com/beem/project/beem/ui/EditSettings.java Wed Jul 01 14:15:06 2009 +0200
@@ -6,6 +6,7 @@
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
+import android.text.Editable;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
@@ -501,6 +502,15 @@
registerProxySettingsChanges(settingsEditor);
registerAccountSettingsChanges(settingsEditor);
registerXMPPSettingsChanges(settingsEditor);
+ String password = accPasswordField.getText().toString();
+ String username = accUsernameField.getText().toString();
+ String port = xmppPortField.getText().toString();
+ String server = xmppServerField.getText().toString();
+ if("".equals(password) || "".equals(username)
+ || "".equals(port) || "".equals(server))
+ settingsEditor.putBoolean(getString(R.string.PreferenceIsConfigured), false);
+ else
+ settingsEditor.putBoolean(getString(R.string.PreferenceIsConfigured), true);
if (settingsEditor.commit()) {
displayNotification(getText(R.string.settings_saved_ok));
--- a/src/com/beem/project/beem/ui/Login.java Fri Jun 26 20:38:43 2009 +0200
+++ b/src/com/beem/project/beem/ui/Login.java Wed Jul 01 14:15:06 2009 +0200
@@ -7,10 +7,12 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.content.ServiceConnection;
+import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.RemoteException;
+import android.preference.Preference;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
@@ -42,6 +44,11 @@
private boolean mIsConnected = false;
private final ServiceConnection mServConn = new BeemServiceConnection();
private IXmppFacade xmppFacade = null;
+
+ private SharedPreferences settings = null;
+ private boolean isConfigured = false;
+
+ private Button mButtonLogin = null;
/**
* Create an about "BEEM" dialog
@@ -65,6 +72,7 @@
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ settings = getSharedPreferences(getString(R.string.settings_filename), MODE_PRIVATE);
setContentView(R.layout.login);
Button button = (Button) findViewById(R.id.log_as_settings);
button.setOnClickListener(new OnClickListener() {
@@ -75,8 +83,8 @@
}
});
- button = (Button) findViewById(R.id.log_as_login);
- button.setOnClickListener(new OnClickListener() {
+ mButtonLogin = (Button) findViewById(R.id.log_as_login);
+ mButtonLogin.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@@ -90,7 +98,7 @@
@Override
protected void onDestroy() {
super.onDestroy();
- if (mIsConnected || xmppFacade == null) {
+ if (isConfigured && (mIsConnected || xmppFacade == null)) {
unbindService(mServConn);
}
}
@@ -102,7 +110,11 @@
public void onStart() {
super.onStart();
Log.e("LOGIN", "BINDSERVICE");
- bindService(Login.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
+ isConfigured = settings.getBoolean(getString(R.string.PreferenceIsConfigured), false);
+ if (isConfigured)
+ bindService(Login.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
+ else
+ mButtonLogin.setEnabled(false);
}
private class BeemConnectionListener extends IBeemConnectionListener.Stub {