jump right into edit account if now accounts are configured

This commit is contained in:
Daniel Gultsch 2014-08-23 21:31:27 +02:00
parent d504daec16
commit e0b759340d
3 changed files with 19 additions and 10 deletions

View File

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

View File

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

View File

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