jump right into edit account if now accounts are configured

Daniel Gultsch created

Change summary

res/layout/activity_edit_account.xml                    |  2 
src/eu/siacs/conversations/ui/ConversationActivity.java |  3 
src/eu/siacs/conversations/ui/EditAccountActivity.java  | 24 +++++++---
3 files changed, 19 insertions(+), 10 deletions(-)

Detailed changes

res/layout/activity_edit_account.xml 🔗

@@ -86,7 +86,7 @@
                 android:layout_marginTop="8dp"
                 android:orientation="vertical"
                 android:padding="16dp"
-                android:visibility="visible" >
+                android:visibility="gone" >
 
                 <TextView
                     android:layout_width="fill_parent"

src/eu/siacs/conversations/ui/ConversationActivity.java 🔗

@@ -628,8 +628,7 @@ public class ConversationActivity extends XmppActivity {
 			}
 		} else {
 			if (xmppConnectionService.getAccounts().size() == 0) {
-				startActivity(new Intent(this, ManageAccountActivity.class));
-				finish();
+				startActivity(new Intent(this, EditAccountActivity.class));
 			} else if (conversationList.size() <= 0) {
 				// add no history
 				startActivity(new Intent(this, StartConversationActivity.class));

src/eu/siacs/conversations/ui/EditAccountActivity.java 🔗

@@ -76,7 +76,7 @@ public class EditAccountActivity extends XmppActivity {
 				mAccount.setPassword(password);
 				mAccount.setUsername(username);
 				mAccount.setServer(server);
-				mAccount.setOption(Account.OPTION_REGISTER,registerNewAccount);
+				mAccount.setOption(Account.OPTION_REGISTER, registerNewAccount);
 				xmppConnectionService.updateAccount(mAccount);
 			} else {
 				if (xmppConnectionService.findAccountByJid(mAccountJid
@@ -116,7 +116,13 @@ public class EditAccountActivity extends XmppActivity {
 
 				@Override
 				public void run() {
-					if (jidToEdit == null && mAccount != null
+					if (mAccount != null
+							&& mAccount.getStatus() != Account.STATUS_ONLINE
+							&& mFetchingAvatar) {
+						startActivity(new Intent(getApplicationContext(),
+								ManageAccountActivity.class));
+						finish();
+					} else if (jidToEdit == null && mAccount != null
 							&& mAccount.getStatus() == Account.STATUS_ONLINE) {
 						if (!mFetchingAvatar) {
 							mFetchingAvatar = true;
@@ -250,7 +256,7 @@ public class EditAccountActivity extends XmppActivity {
 			}
 		}
 	}
-	
+
 	@Override
 	protected void onStop() {
 		if (xmppConnectionServiceBound) {
@@ -273,6 +279,7 @@ public class EditAccountActivity extends XmppActivity {
 			getActionBar().setDisplayHomeAsUpEnabled(false);
 			getActionBar().setDisplayShowHomeEnabled(false);
 			this.mCancelButton.setEnabled(false);
+			this.mCancelButton.setTextColor(getSecondaryTextColor());
 		}
 		this.mAccountJid.setAdapter(this.mKnownHostsAdapter);
 		updateSaveButton();
@@ -289,7 +296,8 @@ public class EditAccountActivity extends XmppActivity {
 			this.mRegisterNew.setVisibility(View.GONE);
 			this.mRegisterNew.setChecked(false);
 		}
-		if (this.mAccount.getStatus() == Account.STATUS_ONLINE && !this.mFetchingAvatar) {
+		if (this.mAccount.getStatus() == Account.STATUS_ONLINE
+				&& !this.mFetchingAvatar) {
 			this.mStats.setVisibility(View.VISIBLE);
 			this.mSessionEst.setText(UIHelper.readableTimeDifference(
 					getApplicationContext(), this.mAccount.getXmppConnection()
@@ -298,7 +306,8 @@ public class EditAccountActivity extends XmppActivity {
 			if (features.carbons()) {
 				this.mServerInfoCarbons.setText(R.string.server_info_available);
 			} else {
-				this.mServerInfoCarbons.setText(R.string.server_info_unavailable);
+				this.mServerInfoCarbons
+						.setText(R.string.server_info_unavailable);
 			}
 			if (features.sm()) {
 				this.mServerInfoSm.setText(R.string.server_info_available);
@@ -310,8 +319,9 @@ public class EditAccountActivity extends XmppActivity {
 			} else {
 				this.mServerInfoPep.setText(R.string.server_info_unavailable);
 			}
-			String fingerprint = this.mAccount.getOtrFingerprint(getApplicationContext());
-			if (fingerprint!=null) {
+			String fingerprint = this.mAccount
+					.getOtrFingerprint(getApplicationContext());
+			if (fingerprint != null) {
 				this.mOtrFingerprintHeadline.setVisibility(View.VISIBLE);
 				this.mOtrFingerprint.setVisibility(View.VISIBLE);
 				this.mOtrFingerprint.setText(fingerprint);