From 5335cda50cb070e1c258ba26ff0fffcf913d0a02 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 9 Feb 2018 20:09:58 +0100 Subject: [PATCH] do not put setup activites on stack twice --- .../siacs/conversations/ui/ConversationActivity.java | 11 ++++++++--- .../java/eu/siacs/conversations/ui/XmppActivity.java | 3 +++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index 34947965a..8502dae87 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -1215,6 +1215,7 @@ public class ConversationActivity extends XmppActivity startActivity(startConversationActivity); } else { switchToAccount(pendingAccount, true); + return; } finish(); } @@ -1237,15 +1238,19 @@ public class ConversationActivity extends XmppActivity if (xmppConnectionService.getAccounts().size() == 0) { if (mRedirected.compareAndSet(false, true)) { if (Config.X509_VERIFICATION) { - startActivity(new Intent(this, ManageAccountActivity.class)); + Intent redirectionIntent = new Intent(this, ManageAccountActivity.class); + redirectionIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION); + startActivity(redirectionIntent); } else if (Config.MAGIC_CREATE_DOMAIN != null) { - startActivity(new Intent(this, WelcomeActivity.class)); + Intent redirectionIntent =new Intent(this, WelcomeActivity.class); + redirectionIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION); + startActivity(redirectionIntent); } else { Intent editAccount = new Intent(this, EditAccountActivity.class); editAccount.putExtra("init",true); + editAccount.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(editAccount); } - finish(); } } else if (conversationList.size() <= 0) { if (mRedirected.compareAndSet(false, true)) { diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index f3e067b88..18899bb11 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -522,6 +522,9 @@ public abstract class XmppActivity extends Activity { Intent intent = new Intent(this, EditAccountActivity.class); intent.putExtra("jid", account.getJid().toBareJid().toString()); intent.putExtra("init", init); + if (init) { + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION); + } startActivity(intent); }