From bd78166c668f979fe0ad4bcdaab13eeea7ca2520 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Sun, 5 Jul 2015 21:21:34 +0200 Subject: don't show notification in MainActivity when state is restored --- .../keychain/ui/MainActivity.java | 31 ++++++++++++---------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'OpenKeychain/src/main') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/MainActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/MainActivity.java index ec6fd1bbe..51ed2b012 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/MainActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/MainActivity.java @@ -128,6 +128,11 @@ public class MainActivity extends BaseNfcActivity implements FabContainer, OnBac getSupportFragmentManager().addOnBackStackChangedListener(this); + // all further initialization steps are saved as instance state + if (savedInstanceState != null) { + return; + } + Intent data = getIntent(); // If we got an EXTRA_RESULT in the intent, show the notification if (data != null && data.hasExtra(OperationResult.EXTRA_RESULT)) { @@ -135,20 +140,18 @@ public class MainActivity extends BaseNfcActivity implements FabContainer, OnBac result.createNotify(this).show(); } - if (savedInstanceState == null) { - // always initialize keys fragment to the bottom of the backstack - onKeysSelected(); - - if (data != null && data.hasExtra(EXTRA_INIT_FRAG)) { - // initialize FragmentLayout with KeyListFragment at first - switch (data.getIntExtra(EXTRA_INIT_FRAG, -1)) { - case ID_ENCRYPT_DECRYPT: - onEnDecryptSelected(); - break; - case ID_APPS: - onAppsSelected(); - break; - } + // always initialize keys fragment to the bottom of the backstack + onKeysSelected(); + + if (data != null && data.hasExtra(EXTRA_INIT_FRAG)) { + // initialize FragmentLayout with KeyListFragment at first + switch (data.getIntExtra(EXTRA_INIT_FRAG, -1)) { + case ID_ENCRYPT_DECRYPT: + onEnDecryptSelected(); + break; + case ID_APPS: + onAppsSelected(); + break; } } -- cgit v1.2.3