don't show notification in MainActivity when state is restored
This commit is contained in:
@@ -128,6 +128,11 @@ public class MainActivity extends BaseNfcActivity implements FabContainer, OnBac
|
|||||||
|
|
||||||
getSupportFragmentManager().addOnBackStackChangedListener(this);
|
getSupportFragmentManager().addOnBackStackChangedListener(this);
|
||||||
|
|
||||||
|
// all further initialization steps are saved as instance state
|
||||||
|
if (savedInstanceState != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Intent data = getIntent();
|
Intent data = getIntent();
|
||||||
// If we got an EXTRA_RESULT in the intent, show the notification
|
// If we got an EXTRA_RESULT in the intent, show the notification
|
||||||
if (data != null && data.hasExtra(OperationResult.EXTRA_RESULT)) {
|
if (data != null && data.hasExtra(OperationResult.EXTRA_RESULT)) {
|
||||||
@@ -135,20 +140,18 @@ public class MainActivity extends BaseNfcActivity implements FabContainer, OnBac
|
|||||||
result.createNotify(this).show();
|
result.createNotify(this).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
// always initialize keys fragment to the bottom of the backstack
|
||||||
// always initialize keys fragment to the bottom of the backstack
|
onKeysSelected();
|
||||||
onKeysSelected();
|
|
||||||
|
|
||||||
if (data != null && data.hasExtra(EXTRA_INIT_FRAG)) {
|
if (data != null && data.hasExtra(EXTRA_INIT_FRAG)) {
|
||||||
// initialize FragmentLayout with KeyListFragment at first
|
// initialize FragmentLayout with KeyListFragment at first
|
||||||
switch (data.getIntExtra(EXTRA_INIT_FRAG, -1)) {
|
switch (data.getIntExtra(EXTRA_INIT_FRAG, -1)) {
|
||||||
case ID_ENCRYPT_DECRYPT:
|
case ID_ENCRYPT_DECRYPT:
|
||||||
onEnDecryptSelected();
|
onEnDecryptSelected();
|
||||||
break;
|
break;
|
||||||
case ID_APPS:
|
case ID_APPS:
|
||||||
onAppsSelected();
|
onAppsSelected();
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user