Fix bug: on the very first launch the account is not configured
authorDa Risk <da_risk@beem-project.com>
Sun, 30 Sep 2012 15:40:07 +0200
changeset 998 9bb5749a8c4f
parent 997 84b87e059de9
child 999 07b9c3efb14c
Fix bug: on the very first launch the account is not configured if you choose system account.
src/com/beem/project/beem/BeemApplication.java
src/com/beem/project/beem/ui/wizard/AccountConfigureFragment.java
--- a/src/com/beem/project/beem/BeemApplication.java	Sat Sep 29 05:22:47 2012 +0200
+++ b/src/com/beem/project/beem/BeemApplication.java	Sun Sep 30 15:40:07 2012 +0200
@@ -47,6 +47,7 @@
 import android.app.Application;
 import android.content.SharedPreferences;
 import android.preference.PreferenceManager;
+import android.text.TextUtils;
 
 /**
  * This class contains informations that needs to be global in the application.
@@ -195,10 +196,11 @@
 
 	@Override
 	public void onSharedPreferenceChanged(SharedPreferences  sharedPreferences, String key) {
-	    if (BeemApplication.ACCOUNT_USERNAME_KEY.equals(key) || BeemApplication.ACCOUNT_PASSWORD_KEY.equals(key)) {
+	    if (BeemApplication.ACCOUNT_USERNAME_KEY.equals(key) || BeemApplication.ACCOUNT_PASSWORD_KEY.equals(key) || BeemApplication.USE_SYSTEM_ACCOUNT_KEY.equals(key)) {
 		String login = mSettings.getString(BeemApplication.ACCOUNT_USERNAME_KEY, "");
 		String password = mSettings.getString(BeemApplication.ACCOUNT_PASSWORD_KEY, "");
-		mIsAccountConfigured = !("".equals(login) || "".equals(password));
+		boolean useSystemAccount = mSettings.getBoolean(BeemApplication.USE_SYSTEM_ACCOUNT_KEY, false);
+		mIsAccountConfigured = !TextUtils.isEmpty(login) && (useSystemAccount || !TextUtils.isEmpty((password)));
 	    }
 	}
     }
--- a/src/com/beem/project/beem/ui/wizard/AccountConfigureFragment.java	Sat Sep 29 05:22:47 2012 +0200
+++ b/src/com/beem/project/beem/ui/wizard/AccountConfigureFragment.java	Sun Sep 30 15:40:07 2012 +0200
@@ -472,6 +472,8 @@
 	    }
 	    if (settings.getBoolean(BeemApplication.SMACK_DEBUG_KEY, false))
 		config.setDebuggerEnabled(true);
+	    config.setSendPresence(false);
+	    config.setRosterLoadedAtLogin(false);
 	    return new XMPPConnection(config);
 	}
     }