From de8667b0bf377ccd0088c461a638d849e8334a7c Mon Sep 17 00:00:00 2001 From: Norbel Ambanumben Date: Tue, 31 Oct 2023 17:53:53 +0100 Subject: [PATCH] Updated rules for displaying test complete notification --- .../openobservatory/ooniprobe/activity/MainActivity.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/openobservatory/ooniprobe/activity/MainActivity.java b/app/src/main/java/org/openobservatory/ooniprobe/activity/MainActivity.java index f76d49ee4..b3e46ed6e 100644 --- a/app/src/main/java/org/openobservatory/ooniprobe/activity/MainActivity.java +++ b/app/src/main/java/org/openobservatory/ooniprobe/activity/MainActivity.java @@ -93,8 +93,13 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { return false; } }); + // TODO(aanorbel): Fix change in state(theme change from notification) changing the selected item. binding.bottomNavigation.setSelectedItemId(getIntent().getIntExtra(RES_ITEM, R.id.dashboard)); - if (getIntent().hasExtra(RES_SNACKBAR_MESSAGE)) { + /* Check if we are restoring the activity from a saved state first. + * If we have a message to show, show it as a snackbar. + * This is used to show the message from test completion. + */ + if (savedInstanceState == null && getIntent().hasExtra(RES_SNACKBAR_MESSAGE)) { Snackbar.make(binding.getRoot(), getIntent().getStringExtra(RES_SNACKBAR_MESSAGE), Snackbar.LENGTH_SHORT) .setAnchorView(binding.bottomNavigation) .show();