diff --git a/app/src/main/java/info/nightscout/androidaps/startupwizard/SWDefinition.java b/app/src/main/java/info/nightscout/androidaps/startupwizard/SWDefinition.java index bdebdeca8a..bcb31bcba4 100644 --- a/app/src/main/java/info/nightscout/androidaps/startupwizard/SWDefinition.java +++ b/app/src/main/java/info/nightscout/androidaps/startupwizard/SWDefinition.java @@ -91,6 +91,15 @@ public class SWDefinition { ) .add(new SWScreen(R.string.setupwizard_pump_test) .skippable(false) + // add refresh button + .add(new SWButton() + .text(R.string.combo_refresh) + .action(() -> { + log.debug("Tryng to get the current pump selected: "+ConfigBuilderPlugin.getActivePump()); + MainApp.bus().post(new EventConfigBuilderChange()); + MainApp.bus().post(new EventSWUpdate(true)); + }) + .visibility(() -> true)) // Adding DanaR specific fields .add(DanaRPlugin.getPlugin().isEnabled(PluginType.PUMP)?new SWString() .preferenceId(R.string.key_danar_bt_name) diff --git a/app/src/main/java/info/nightscout/androidaps/startupwizard/SetupWizardActivity.java b/app/src/main/java/info/nightscout/androidaps/startupwizard/SetupWizardActivity.java index 3da44618ab..a124635cc1 100644 --- a/app/src/main/java/info/nightscout/androidaps/startupwizard/SetupWizardActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/startupwizard/SetupWizardActivity.java @@ -30,14 +30,14 @@ public class SetupWizardActivity extends AppCompatActivity { SWDefinition swDefinition = SWDefinition.getInstance(); List screens = swDefinition.getScreens(); private int currentWizardPage = 0; - public static final String INTENT_MESSAGE = "WIZZARDPAGE"; + public static final String INTENT_MESSAGE = "WIZZARDPAGE"; + public static final String RESTART = "RESTART"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LocaleHelper.onCreate(this, "en"); setContentView(R.layout.activity_setupwizard); - Intent intent = getIntent(); currentWizardPage = intent.getIntExtra(SetupWizardActivity.INTENT_MESSAGE, 0); if (screens.size() > 0 && currentWizardPage < screens.size()) { @@ -61,6 +61,14 @@ public class SetupWizardActivity extends AppCompatActivity { @Override protected void onResume() { + + Intent intent = new Intent(this, SetupWizardActivity.class); + intent.putExtra(INTENT_MESSAGE, 0); + if(intent.getBooleanExtra(RESTART, false)) { + intent.putExtra(RESTART, false); + this.finish(); + startActivity(intent); + } super.onResume(); MainApp.bus().register(this); } @@ -110,6 +118,9 @@ public class SetupWizardActivity extends AppCompatActivity { this.finish(); Intent intent = new Intent(this, SetupWizardActivity.class); intent.putExtra(INTENT_MESSAGE, currentWizardPage + 1); + +// screens = SWDefinition.getInstance().getScreens(); + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); } @@ -120,6 +131,7 @@ public class SetupWizardActivity extends AppCompatActivity { intent.putExtra(INTENT_MESSAGE, currentWizardPage - 1); else intent.putExtra(INTENT_MESSAGE, 0); + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); }