aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-07-21 19:16:41 +0200
committerDaniel Gultsch <daniel@gultsch.de>2016-07-21 19:16:41 +0200
commitc8188ee52c1fc260e3710d835f518936eacc3a64 (patch)
tree7966ed05489fd10cd3576a122606bd2b7600dd62 /src/main/java/eu/siacs
parent2843a0af2646322e5ce7c5fc237d417d7db86fa8 (diff)
offer back/cancel button when using magic create
Diffstat (limited to 'src/main/java/eu/siacs')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java32
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 18f3239c..324a7053 100644
--- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
@@ -235,6 +235,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
@Override
public void onClick(final View v) {
+ deleteMagicCreatedAccountAndReturnIfNecessary();
finish();
}
};
@@ -262,6 +263,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();
}
@@ -594,13 +618,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());
}