offer back/cancel button when using magic create
This commit is contained in:
parent
2843a0af26
commit
c8188ee52c
|
@ -235,6 +235,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(final View v) {
|
public void onClick(final View v) {
|
||||||
|
deleteMagicCreatedAccountAndReturnIfNecessary();
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -261,6 +262,29 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
|
||||||
updateSaveButton();
|
updateSaveButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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
|
@Override
|
||||||
public void onAccountUpdate() {
|
public void onAccountUpdate() {
|
||||||
refreshUi();
|
refreshUi();
|
||||||
|
@ -594,13 +618,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
|
||||||
updateAccountInformation(true);
|
updateAccountInformation(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((Config.MAGIC_CREATE_DOMAIN == null && this.xmppConnectionService.getAccounts().size() == 0)
|
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);
|
|
||||||
}
|
|
||||||
this.mCancelButton.setEnabled(false);
|
this.mCancelButton.setEnabled(false);
|
||||||
this.mCancelButton.setTextColor(getSecondaryTextColor());
|
this.mCancelButton.setTextColor(getSecondaryTextColor());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue