From e0b759340ded08ed7fcc3942473e7b3e3a91d2a1 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 23 Aug 2014 21:31:27 +0200 Subject: jump right into edit account if now accounts are configured --- .../conversations/ui/ConversationActivity.java | 3 +-- .../conversations/ui/EditAccountActivity.java | 24 +++++++++++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) (limited to 'src/eu/siacs') diff --git a/src/eu/siacs/conversations/ui/ConversationActivity.java b/src/eu/siacs/conversations/ui/ConversationActivity.java index df8f77cd..c68063d2 100644 --- a/src/eu/siacs/conversations/ui/ConversationActivity.java +++ b/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)); diff --git a/src/eu/siacs/conversations/ui/EditAccountActivity.java b/src/eu/siacs/conversations/ui/EditAccountActivity.java index 71ed89ed..2d24aa49 100644 --- a/src/eu/siacs/conversations/ui/EditAccountActivity.java +++ b/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); -- cgit v1.2.3