From 04977aedc4e05f095abf1764b70949f5ab1794c7 Mon Sep 17 00:00:00 2001 From: Alethea Butler Date: Sat, 31 May 2014 11:07:55 -0400 Subject: [PATCH 1/4] Made ConversationActivity singleTask --- AndroidManifest.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 62ea4035d..d196be7fb 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -40,7 +40,8 @@ android:name="eu.siacs.conversations.ui.ConversationActivity" android:configChanges="orientation|screenSize" android:label="@string/title_activity_conversations" - android:windowSoftInputMode="stateHidden" > + android:windowSoftInputMode="stateHidden" + android:launchMode="singleTask" > From b04fd2337ef1e37309f634f41b0d07f16f4e64ab Mon Sep 17 00:00:00 2001 From: Alethea Butler Date: Sat, 31 May 2014 11:50:09 -0400 Subject: [PATCH 2/4] Refactored into onNavigateUp --- .../conversations/ui/ManageAccountActivity.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/eu/siacs/conversations/ui/ManageAccountActivity.java b/src/eu/siacs/conversations/ui/ManageAccountActivity.java index 6fd87473c..c61c1b82c 100644 --- a/src/eu/siacs/conversations/ui/ManageAccountActivity.java +++ b/src/eu/siacs/conversations/ui/ManageAccountActivity.java @@ -398,18 +398,23 @@ 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) { + startActivity(new Intent(this, ContactsActivity.class)); + finish(); + return true; + } else { + return super.onNavigateUp(); + } + } + private void editAccount(Account account) { EditAccount dialog = new EditAccount(); dialog.setAccount(account); From d67d792409d2f7ab990be2f698c8e00bf7e787b9 Mon Sep 17 00:00:00 2001 From: Alethea Butler Date: Sat, 31 May 2014 12:53:23 -0400 Subject: [PATCH 3/4] Made the navigateUp override behave like a navigate up --- .../siacs/conversations/ui/ManageAccountActivity.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/eu/siacs/conversations/ui/ManageAccountActivity.java b/src/eu/siacs/conversations/ui/ManageAccountActivity.java index c61c1b82c..8a26d9078 100644 --- a/src/eu/siacs/conversations/ui/ManageAccountActivity.java +++ b/src/eu/siacs/conversations/ui/ManageAccountActivity.java @@ -407,7 +407,15 @@ public class ManageAccountActivity extends XmppActivity { @Override public boolean onNavigateUp() { if (xmppConnectionService.getConversations().size() == 0) { - startActivity(new Intent(this, ContactsActivity.class)); + 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 { From 97957bcfb9d5095aa1a981936ce0257b88769e99 Mon Sep 17 00:00:00 2001 From: Alethea Butler Date: Sat, 31 May 2014 13:33:46 -0400 Subject: [PATCH 4/4] Removed TASK_ON_HOME flag from intent created from share --- src/eu/siacs/conversations/ui/XmppActivity.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/eu/siacs/conversations/ui/XmppActivity.java b/src/eu/siacs/conversations/ui/XmppActivity.java index 7c8c46b2a..81092b22b 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);