diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2014-06-01 09:55:40 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2014-06-01 09:55:40 +0200 |
commit | ca49603c8575f965f3b096ba65a53af214429cb8 (patch) | |
tree | 7ae3d65902cba98f108a4e0899a99a078c020e33 /src | |
parent | 15096aa0dd07422bee1c02bb4a60d89bd96d07fc (diff) | |
parent | 97957bcfb9d5095aa1a981936ce0257b88769e99 (diff) |
Merge pull request #167 from alethea/up-navigation
Up navigation
Diffstat (limited to 'src')
-rw-r--r-- | src/eu/siacs/conversations/ui/ManageAccountActivity.java | 25 | ||||
-rw-r--r-- | src/eu/siacs/conversations/ui/XmppActivity.java | 4 |
2 files changed, 22 insertions, 7 deletions
diff --git a/src/eu/siacs/conversations/ui/ManageAccountActivity.java b/src/eu/siacs/conversations/ui/ManageAccountActivity.java index 6fd87473..8a26d907 100644 --- a/src/eu/siacs/conversations/ui/ManageAccountActivity.java +++ b/src/eu/siacs/conversations/ui/ManageAccountActivity.java @@ -398,18 +398,31 @@ public class ManageAccountActivity extends XmppActivity { case R.id.action_add_account: addAccount(); break; - case android.R.id.home: - if (xmppConnectionService.getConversations().size() == 0) { - startActivity(new Intent(getApplicationContext(), - ContactsActivity.class)); - } - break; default: break; } return super.onOptionsItemSelected(item); } + @Override + public boolean onNavigateUp() { + if (xmppConnectionService.getConversations().size() == 0) { + Intent contactsIntent = new Intent(this, ContactsActivity.class); + contactsIntent.setFlags( + // if activity exists in stack, pop the stack and go back to it + Intent.FLAG_ACTIVITY_CLEAR_TOP | + // otherwise, make a new task for it + Intent.FLAG_ACTIVITY_NEW_TASK | + // don't use the new activity animation; finish animation runs instead + Intent.FLAG_ACTIVITY_NO_ANIMATION); + startActivity(contactsIntent); + finish(); + return true; + } else { + return super.onNavigateUp(); + } + } + private void editAccount(Account account) { EditAccount dialog = new EditAccount(); dialog.setAccount(account); diff --git a/src/eu/siacs/conversations/ui/XmppActivity.java b/src/eu/siacs/conversations/ui/XmppActivity.java index 7c8c46b2..81092b22 100644 --- a/src/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/eu/siacs/conversations/ui/XmppActivity.java @@ -156,7 +156,9 @@ public abstract class XmppActivity extends Activity { } viewConversationIntent.setType(ConversationActivity.VIEW_CONVERSATION); if (newTask) { - viewConversationIntent.setFlags(viewConversationIntent.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_TASK_ON_HOME ); + viewConversationIntent.setFlags(viewConversationIntent.getFlags() + | Intent.FLAG_ACTIVITY_NEW_TASK + | Intent.FLAG_ACTIVITY_SINGLE_TOP); } else { viewConversationIntent.setFlags(viewConversationIntent.getFlags() | Intent.FLAG_ACTIVITY_CLEAR_TOP); |