made it possible to go back to welcome screen from edit account

This commit is contained in:
Daniel Gultsch 2016-04-27 10:35:08 +02:00
parent e6b526230a
commit ebcb13c8eb
2 changed files with 7 additions and 4 deletions

View File

@ -315,9 +315,10 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
public void run() { public void run() {
final Intent intent; final Intent intent;
final XmppConnection connection = mAccount.getXmppConnection(); final XmppConnection connection = mAccount.getXmppConnection();
final boolean wasFirstAccount = xmppConnectionService != null && xmppConnectionService.getAccounts().size() == 1;
if (avatar != null || (connection != null && !connection.getFeatures().pep())) { if (avatar != null || (connection != null && !connection.getFeatures().pep())) {
intent = new Intent(getApplicationContext(), StartConversationActivity.class); intent = new Intent(getApplicationContext(), StartConversationActivity.class);
if (xmppConnectionService != null && xmppConnectionService.getAccounts().size() == 1) { if (wasFirstAccount) {
intent.putExtra("init", true); intent.putExtra("init", true);
} }
} else { } else {
@ -325,6 +326,9 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
intent.putExtra(EXTRA_ACCOUNT, mAccount.getJid().toBareJid().toString()); intent.putExtra(EXTRA_ACCOUNT, mAccount.getJid().toBareJid().toString());
intent.putExtra("setup", true); intent.putExtra("setup", true);
} }
if (wasFirstAccount) {
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
}
startActivity(intent); startActivity(intent);
finish(); finish();
} }
@ -577,8 +581,8 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
updateAccountInformation(true); updateAccountInformation(true);
} }
} }
if (this.xmppConnectionService.getAccounts().size() == 0 if ((Config.MAGIC_CREATE_DOMAIN == null && this.xmppConnectionService.getAccounts().size() == 0)
|| this.mAccount == xmppConnectionService.getPendingAccount()) { || (this.mAccount != null && this.mAccount == xmppConnectionService.getPendingAccount())) {
if (getActionBar() != null) { if (getActionBar() != null) {
getActionBar().setDisplayHomeAsUpEnabled(false); getActionBar().setDisplayHomeAsUpEnabled(false);
getActionBar().setDisplayShowHomeEnabled(false); getActionBar().setDisplayShowHomeEnabled(false);

View File

@ -28,7 +28,6 @@ public class WelcomeActivity extends Activity {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
startActivity(new Intent(WelcomeActivity.this, EditAccountActivity.class)); startActivity(new Intent(WelcomeActivity.this, EditAccountActivity.class));
finish();
} }
}); });