diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-07-21 19:16:41 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-07-25 19:45:52 +0200 |
commit | 0b26f27c6b239c6819ebeece84d7fd1a578f49f3 (patch) | |
tree | f87f9412459f4a4b8f4028efc2006e4234f4079c /src/main/java | |
parent | d32a03fe52592d3863abde1fa051f0426265b1a2 (diff) |
offer back/cancel button when using magic create
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java index da85ee494..0640f0075 100644 --- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java @@ -233,6 +233,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate @Override public void onClick(final View v) { + deleteMagicCreatedAccountAndReturnIfNecessary(); finish(); } }; @@ -260,6 +261,29 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate } @Override + public boolean onNavigateUp() { + deleteMagicCreatedAccountAndReturnIfNecessary(); + return super.onNavigateUp(); + } + + @Override + public void onBackPressed() { + deleteMagicCreatedAccountAndReturnIfNecessary(); + super.onBackPressed(); + } + + private void deleteMagicCreatedAccountAndReturnIfNecessary() { + if (Config.MAGIC_CREATE_DOMAIN != null + && mAccount != null + && mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE) + && mAccount.isOptionSet(Account.OPTION_REGISTER) + && xmppConnectionService.getAccounts().size() == 1) { + xmppConnectionService.deleteAccount(mAccount); + startActivity(new Intent(EditAccountActivity.this, WelcomeActivity.class)); + } + } + + @Override public void onAccountUpdate() { refreshUi(); } @@ -592,13 +616,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate updateAccountInformation(true); } } - if ((Config.MAGIC_CREATE_DOMAIN == null && this.xmppConnectionService.getAccounts().size() == 0) - || (this.mAccount != null && this.mAccount == xmppConnectionService.getPendingAccount())) { - if (getActionBar() != null) { - getActionBar().setDisplayHomeAsUpEnabled(false); - getActionBar().setDisplayShowHomeEnabled(false); - getActionBar().setHomeButtonEnabled(false); - } + if (Config.MAGIC_CREATE_DOMAIN == null && this.xmppConnectionService.getAccounts().size() == 0) { this.mCancelButton.setEnabled(false); this.mCancelButton.setTextColor(getSecondaryTextColor()); } |