trying pump followup screen -NOT WORKING

This commit is contained in:
Roumen Georgiev 2018-05-09 11:06:52 +03:00
parent 85d4ef4419
commit d5a3177c35
2 changed files with 23 additions and 2 deletions

View file

@ -91,6 +91,15 @@ public class SWDefinition {
) )
.add(new SWScreen(R.string.setupwizard_pump_test) .add(new SWScreen(R.string.setupwizard_pump_test)
.skippable(false) .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 // Adding DanaR specific fields
.add(DanaRPlugin.getPlugin().isEnabled(PluginType.PUMP)?new SWString() .add(DanaRPlugin.getPlugin().isEnabled(PluginType.PUMP)?new SWString()
.preferenceId(R.string.key_danar_bt_name) .preferenceId(R.string.key_danar_bt_name)

View file

@ -30,14 +30,14 @@ public class SetupWizardActivity extends AppCompatActivity {
SWDefinition swDefinition = SWDefinition.getInstance(); SWDefinition swDefinition = SWDefinition.getInstance();
List<SWScreen> screens = swDefinition.getScreens(); List<SWScreen> screens = swDefinition.getScreens();
private int currentWizardPage = 0; 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 @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
LocaleHelper.onCreate(this, "en"); LocaleHelper.onCreate(this, "en");
setContentView(R.layout.activity_setupwizard); setContentView(R.layout.activity_setupwizard);
Intent intent = getIntent(); Intent intent = getIntent();
currentWizardPage = intent.getIntExtra(SetupWizardActivity.INTENT_MESSAGE, 0); currentWizardPage = intent.getIntExtra(SetupWizardActivity.INTENT_MESSAGE, 0);
if (screens.size() > 0 && currentWizardPage < screens.size()) { if (screens.size() > 0 && currentWizardPage < screens.size()) {
@ -61,6 +61,14 @@ public class SetupWizardActivity extends AppCompatActivity {
@Override @Override
protected void onResume() { 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(); super.onResume();
MainApp.bus().register(this); MainApp.bus().register(this);
} }
@ -110,6 +118,9 @@ public class SetupWizardActivity extends AppCompatActivity {
this.finish(); this.finish();
Intent intent = new Intent(this, SetupWizardActivity.class); Intent intent = new Intent(this, SetupWizardActivity.class);
intent.putExtra(INTENT_MESSAGE, currentWizardPage + 1); intent.putExtra(INTENT_MESSAGE, currentWizardPage + 1);
// screens = SWDefinition.getInstance().getScreens();
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent); startActivity(intent);
} }
@ -120,6 +131,7 @@ public class SetupWizardActivity extends AppCompatActivity {
intent.putExtra(INTENT_MESSAGE, currentWizardPage - 1); intent.putExtra(INTENT_MESSAGE, currentWizardPage - 1);
else else
intent.putExtra(INTENT_MESSAGE, 0); intent.putExtra(INTENT_MESSAGE, 0);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent); startActivity(intent);
} }