SWFragment
This commit is contained in:
parent
0060a2ba7f
commit
1ba828d20a
|
@ -0,0 +1,4 @@
|
|||
package info.nightscout.androidaps.events;
|
||||
|
||||
public class EventProfileStoreChanged extends Event {
|
||||
}
|
|
@ -4,7 +4,6 @@ package info.nightscout.androidaps.plugins.ProfileLocal;
|
|||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -23,7 +22,6 @@ import java.text.DecimalFormat;
|
|||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.data.ProfileStore;
|
||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||
|
@ -109,34 +107,25 @@ public class LocalProfileFragment extends SubscriberFragment {
|
|||
mgdlView.setChecked(LocalProfilePlugin.getPlugin().mgdl);
|
||||
mmolView.setChecked(LocalProfilePlugin.getPlugin().mmol);
|
||||
|
||||
mgdlView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
LocalProfilePlugin.getPlugin().mgdl = mgdlView.isChecked();
|
||||
LocalProfilePlugin.getPlugin().mmol = !LocalProfilePlugin.getPlugin().mgdl;
|
||||
mmolView.setChecked(LocalProfilePlugin.getPlugin().mmol);
|
||||
doEdit();
|
||||
}
|
||||
mgdlView.setOnClickListener(v -> {
|
||||
LocalProfilePlugin.getPlugin().mgdl = mgdlView.isChecked();
|
||||
LocalProfilePlugin.getPlugin().mmol = !LocalProfilePlugin.getPlugin().mgdl;
|
||||
mmolView.setChecked(LocalProfilePlugin.getPlugin().mmol);
|
||||
doEdit();
|
||||
});
|
||||
mmolView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
LocalProfilePlugin.getPlugin().mmol = mmolView.isChecked();
|
||||
LocalProfilePlugin.getPlugin().mgdl = !LocalProfilePlugin.getPlugin().mmol;
|
||||
mgdlView.setChecked(LocalProfilePlugin.getPlugin().mgdl);
|
||||
doEdit();
|
||||
}
|
||||
mmolView.setOnClickListener(v -> {
|
||||
LocalProfilePlugin.getPlugin().mmol = mmolView.isChecked();
|
||||
LocalProfilePlugin.getPlugin().mgdl = !LocalProfilePlugin.getPlugin().mmol;
|
||||
mgdlView.setChecked(LocalProfilePlugin.getPlugin().mgdl);
|
||||
doEdit();
|
||||
});
|
||||
|
||||
profileswitchButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
NewNSTreatmentDialog newDialog = new NewNSTreatmentDialog();
|
||||
final OptionsToShow profileswitch = CareportalFragment.PROFILESWITCHDIRECT;
|
||||
profileswitch.executeProfileSwitch = true;
|
||||
newDialog.setOptions(profileswitch, R.string.careportal_profileswitch);
|
||||
newDialog.show(getFragmentManager(), "NewNSTreatmentDialog");
|
||||
}
|
||||
profileswitchButton.setOnClickListener(view -> {
|
||||
NewNSTreatmentDialog newDialog = new NewNSTreatmentDialog();
|
||||
final OptionsToShow profileswitch = CareportalFragment.PROFILESWITCHDIRECT;
|
||||
profileswitch.executeProfileSwitch = true;
|
||||
newDialog.setOptions(profileswitch, R.string.careportal_profileswitch);
|
||||
newDialog.show(getFragmentManager(), "NewNSTreatmentDialog");
|
||||
});
|
||||
|
||||
resetButton.setOnClickListener(view -> {
|
||||
|
|
|
@ -13,6 +13,7 @@ import info.nightscout.androidaps.Constants;
|
|||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.ProfileStore;
|
||||
import info.nightscout.androidaps.events.EventProfileStoreChanged;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
|
@ -81,6 +82,7 @@ public class LocalProfilePlugin extends PluginBase implements ProfileInterface {
|
|||
edited = false;
|
||||
if (Config.logPrefsChange)
|
||||
log.debug("Storing settings: " + getRawProfile().getData().toString());
|
||||
MainApp.bus().post(new EventProfileStoreChanged());
|
||||
}
|
||||
|
||||
public synchronized void loadSettings() {
|
||||
|
|
|
@ -16,6 +16,7 @@ import info.nightscout.androidaps.MainApp;
|
|||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.Services.Intents;
|
||||
import info.nightscout.androidaps.data.ProfileStore;
|
||||
import info.nightscout.androidaps.events.EventProfileStoreChanged;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
|
@ -43,7 +44,7 @@ public class NSProfilePlugin extends PluginBase implements ProfileInterface {
|
|||
super(new PluginDescription()
|
||||
.mainType(PluginType.PROFILE)
|
||||
.fragmentClass(NSProfileFragment.class.getName())
|
||||
.pluginName(R.string.profileviewer)
|
||||
.pluginName(R.string.nsprofile)
|
||||
.shortName(R.string.profileviewer_shortname)
|
||||
.alwaysEnabled(Config.NSCLIENT)
|
||||
.alwayVisible(Config.NSCLIENT)
|
||||
|
@ -68,6 +69,7 @@ public class NSProfilePlugin extends PluginBase implements ProfileInterface {
|
|||
profile = new ProfileStore(newProfile.getData());
|
||||
storeNSProfile();
|
||||
MainApp.bus().post(new EventNSProfileUpdateGUI());
|
||||
MainApp.bus().post(new EventProfileStoreChanged());
|
||||
}
|
||||
|
||||
private void storeNSProfile() {
|
||||
|
|
|
@ -73,34 +73,25 @@ public class SimpleProfileFragment extends SubscriberFragment {
|
|||
targetlowView.setText(SimpleProfilePlugin.getPlugin().targetLow.toString());
|
||||
targethighView.setText(SimpleProfilePlugin.getPlugin().targetHigh.toString());
|
||||
|
||||
mgdlView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
SimpleProfilePlugin.getPlugin().mgdl = mgdlView.isChecked();
|
||||
SimpleProfilePlugin.getPlugin().mmol = !SimpleProfilePlugin.getPlugin().mgdl;
|
||||
mmolView.setChecked(SimpleProfilePlugin.getPlugin().mmol);
|
||||
SimpleProfilePlugin.getPlugin().storeSettings();
|
||||
}
|
||||
mgdlView.setOnClickListener(v -> {
|
||||
SimpleProfilePlugin.getPlugin().mgdl = mgdlView.isChecked();
|
||||
SimpleProfilePlugin.getPlugin().mmol = !SimpleProfilePlugin.getPlugin().mgdl;
|
||||
mmolView.setChecked(SimpleProfilePlugin.getPlugin().mmol);
|
||||
SimpleProfilePlugin.getPlugin().storeSettings();
|
||||
});
|
||||
mmolView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
SimpleProfilePlugin.getPlugin().mmol = mmolView.isChecked();
|
||||
SimpleProfilePlugin.getPlugin().mgdl = !SimpleProfilePlugin.getPlugin().mmol;
|
||||
mgdlView.setChecked(SimpleProfilePlugin.getPlugin().mgdl);
|
||||
SimpleProfilePlugin.getPlugin().storeSettings();
|
||||
}
|
||||
mmolView.setOnClickListener(v -> {
|
||||
SimpleProfilePlugin.getPlugin().mmol = mmolView.isChecked();
|
||||
SimpleProfilePlugin.getPlugin().mgdl = !SimpleProfilePlugin.getPlugin().mmol;
|
||||
mgdlView.setChecked(SimpleProfilePlugin.getPlugin().mgdl);
|
||||
SimpleProfilePlugin.getPlugin().storeSettings();
|
||||
});
|
||||
|
||||
profileswitchButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
NewNSTreatmentDialog newDialog = new NewNSTreatmentDialog();
|
||||
final OptionsToShow profileswitch = CareportalFragment.PROFILESWITCH;
|
||||
profileswitch.executeProfileSwitch = true;
|
||||
newDialog.setOptions(profileswitch, R.string.careportal_profileswitch);
|
||||
newDialog.show(getFragmentManager(), "NewNSTreatmentDialog");
|
||||
}
|
||||
profileswitchButton.setOnClickListener(view -> {
|
||||
NewNSTreatmentDialog newDialog = new NewNSTreatmentDialog();
|
||||
final OptionsToShow profileswitch = CareportalFragment.PROFILESWITCH;
|
||||
profileswitch.executeProfileSwitch = true;
|
||||
newDialog.setOptions(profileswitch, R.string.careportal_profileswitch);
|
||||
newDialog.show(getFragmentManager(), "NewNSTreatmentDialog");
|
||||
});
|
||||
|
||||
TextWatcher textWatch = new TextWatcher() {
|
||||
|
@ -152,20 +143,17 @@ public class SimpleProfileFragment extends SubscriberFragment {
|
|||
protected void updateGUI() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
boolean isValid = SimpleProfilePlugin.getPlugin().getProfile() != null && SimpleProfilePlugin.getPlugin().getProfile().getDefaultProfile().isValid(MainApp.gs(R.string.simpleprofile));
|
||||
if (!ConfigBuilderPlugin.getActivePump().isInitialized() || ConfigBuilderPlugin.getActivePump().isSuspended() || !isValid) {
|
||||
profileswitchButton.setVisibility(View.GONE);
|
||||
} else {
|
||||
profileswitchButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (isValid)
|
||||
invalidProfile.setVisibility(View.GONE);
|
||||
else
|
||||
invalidProfile.setVisibility(View.VISIBLE);
|
||||
activity.runOnUiThread(() -> {
|
||||
boolean isValid = SimpleProfilePlugin.getPlugin().getProfile() != null && SimpleProfilePlugin.getPlugin().getProfile().getDefaultProfile().isValid(MainApp.gs(R.string.simpleprofile));
|
||||
if (!ConfigBuilderPlugin.getActivePump().isInitialized() || ConfigBuilderPlugin.getActivePump().isSuspended() || !isValid) {
|
||||
profileswitchButton.setVisibility(View.GONE);
|
||||
} else {
|
||||
profileswitchButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (isValid)
|
||||
invalidProfile.setVisibility(View.GONE);
|
||||
else
|
||||
invalidProfile.setVisibility(View.VISIBLE);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import info.nightscout.androidaps.Constants;
|
|||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.ProfileStore;
|
||||
import info.nightscout.androidaps.events.EventProfileStoreChanged;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
|
@ -73,6 +74,7 @@ public class SimpleProfilePlugin extends PluginBase implements ProfileInterface
|
|||
createConvertedProfile();
|
||||
if (Config.logPrefsChange)
|
||||
log.debug("Storing settings: " + getRawProfile().getData().toString());
|
||||
MainApp.bus().post(new EventProfileStoreChanged());
|
||||
}
|
||||
|
||||
private void loadSettings() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package info.nightscout.androidaps.startupwizard;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
import com.squareup.otto.Subscribe;
|
||||
|
||||
|
@ -21,6 +21,12 @@ import info.nightscout.androidaps.interfaces.PluginType;
|
|||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderFragment;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientPlugin;
|
||||
import info.nightscout.androidaps.plugins.ProfileLocal.LocalProfileFragment;
|
||||
import info.nightscout.androidaps.plugins.ProfileLocal.LocalProfilePlugin;
|
||||
import info.nightscout.androidaps.plugins.ProfileNS.NSProfileFragment;
|
||||
import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin;
|
||||
import info.nightscout.androidaps.plugins.ProfileSimple.SimpleProfileFragment;
|
||||
import info.nightscout.androidaps.plugins.ProfileSimple.SimpleProfilePlugin;
|
||||
import info.nightscout.androidaps.startupwizard.events.EventSWLabel;
|
||||
import info.nightscout.androidaps.startupwizard.events.EventSWUpdate;
|
||||
import info.nightscout.utils.LocaleHelper;
|
||||
|
@ -30,14 +36,14 @@ import info.nightscout.utils.SP;
|
|||
public class SWDefinition {
|
||||
private static Logger log = LoggerFactory.getLogger(SWDefinition.class);
|
||||
|
||||
private Activity activity;
|
||||
private AppCompatActivity activity;
|
||||
private List<SWScreen> screens = new ArrayList<>();
|
||||
|
||||
public void setActivity(Activity activity) {
|
||||
public void setActivity(AppCompatActivity activity) {
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
public Activity getActivity() {
|
||||
public AppCompatActivity getActivity() {
|
||||
return activity;
|
||||
}
|
||||
|
||||
|
@ -106,15 +112,45 @@ public class SWDefinition {
|
|||
.add(new SWPlugin()
|
||||
.option(PluginType.INSULIN)
|
||||
.label(R.string.configbuilder_insulin))
|
||||
.validator(() -> MainApp.getSpecificPluginsList(PluginType.INSULIN) != null)
|
||||
.validator(() -> MainApp.getConfigBuilder().getActiveInsulin() != null)
|
||||
)
|
||||
.add(new SWScreen(R.string.configbuilder_bgsource)
|
||||
.skippable(false)
|
||||
.add(new SWPlugin()
|
||||
.option(PluginType.BGSOURCE)
|
||||
.label(R.string.configbuilder_bgsource))
|
||||
.validator(() -> MainApp.getSpecificPluginsList(PluginType.BGSOURCE) != null)
|
||||
.validator(() -> MainApp.getConfigBuilder().getActiveBgSource() != null)
|
||||
)
|
||||
.add(new SWScreen(R.string.configbuilder_profile)
|
||||
.skippable(false)
|
||||
.add(new SWPlugin()
|
||||
.option(PluginType.PROFILE)
|
||||
.label(R.string.configbuilder_profile))
|
||||
.validator(() -> MainApp.getConfigBuilder().getActiveProfileInterface() != null)
|
||||
)
|
||||
.add(new SWScreen(R.string.nsprofile)
|
||||
.skippable(false)
|
||||
.add(new SWInfotext()
|
||||
.label(R.string.adjustprofileinns))
|
||||
.add(new SWFragment(this)
|
||||
.add(new NSProfileFragment()))
|
||||
.validator(() -> NSProfilePlugin.getPlugin().getProfile() != null && NSProfilePlugin.getPlugin().getProfile().getDefaultProfile().isValid("StartupWizard"))
|
||||
.visibility(() -> NSProfilePlugin.getPlugin().isEnabled(PluginType.PROFILE))
|
||||
)
|
||||
.add(new SWScreen(R.string.localprofile)
|
||||
.skippable(false)
|
||||
.add(new SWFragment(this)
|
||||
.add(new LocalProfileFragment()))
|
||||
.validator(() -> LocalProfilePlugin.getPlugin().getProfile() != null && LocalProfilePlugin.getPlugin().getProfile().getDefaultProfile().isValid("StartupWizard"))
|
||||
.visibility(() -> LocalProfilePlugin.getPlugin().isEnabled(PluginType.PROFILE))
|
||||
)
|
||||
.add(new SWScreen(R.string.simpleprofile)
|
||||
.skippable(false)
|
||||
.add(new SWFragment(this)
|
||||
.add(new SimpleProfileFragment()))
|
||||
.validator(() -> SimpleProfilePlugin.getPlugin().getProfile() != null && SimpleProfilePlugin.getPlugin().getProfile().getDefaultProfile().isValid("StartupWizard"))
|
||||
.visibility(() -> SimpleProfilePlugin.getPlugin().isEnabled(PluginType.PROFILE))
|
||||
)
|
||||
.add(new SWScreen(R.string.configbuilder_pump)
|
||||
.skippable(false)
|
||||
.add(new SWPlugin()
|
||||
|
@ -134,7 +170,7 @@ public class SWDefinition {
|
|||
.add(new SWButton()
|
||||
.text(R.string.readstatus)
|
||||
.action(() -> ConfigBuilderPlugin.getCommandQueue().readStatus("Clicked connect to pump", null))
|
||||
.visibility(() -> MainApp.getSpecificPluginsList(PluginType.PUMP) != null))
|
||||
.visibility(() -> MainApp.getConfigBuilder().getActivePump() != null))
|
||||
.add(new SWEventListener(this)
|
||||
.listener(new Object() {
|
||||
@Subscribe
|
||||
|
@ -143,14 +179,14 @@ public class SWDefinition {
|
|||
}
|
||||
})
|
||||
)
|
||||
.validator(() -> MainApp.getSpecificPluginsList(PluginType.PUMP) != null && MainApp.getConfigBuilder().getActivePump().isInitialized())
|
||||
.validator(() -> MainApp.getConfigBuilder().getActivePump() != null && MainApp.getConfigBuilder().getActivePump().isInitialized())
|
||||
)
|
||||
.add(new SWScreen(R.string.configbuilder_aps)
|
||||
.skippable(false)
|
||||
.add(new SWPlugin()
|
||||
.option(PluginType.APS)
|
||||
.label(R.string.configbuilder_aps))
|
||||
.validator(() -> MainApp.getSpecificPluginsList(PluginType.APS) != null)
|
||||
.validator(() ->MainApp.getConfigBuilder().getActiveAPS() != null)
|
||||
)
|
||||
;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package info.nightscout.androidaps.startupwizard;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
|
||||
|
||||
public class SWFragment extends SWItem {
|
||||
private static Logger log = LoggerFactory.getLogger(SWFragment.class);
|
||||
|
||||
SWDefinition definition;
|
||||
SubscriberFragment fragment;
|
||||
|
||||
public SWFragment(SWDefinition definition) {
|
||||
super(Type.FRAGMENT);
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public SWFragment add(SubscriberFragment fragment) {
|
||||
this.fragment = fragment;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateDialog(View view, LinearLayout layout) {
|
||||
definition.getActivity().getSupportFragmentManager().beginTransaction().add(layout.getId(), fragment, fragment.getTag()).commit();
|
||||
}
|
||||
|
||||
}
|
|
@ -25,7 +25,8 @@ public class SWItem {
|
|||
CHECKBOX,
|
||||
RADIOBUTTON,
|
||||
PLUGIN,
|
||||
BUTTON
|
||||
BUTTON,
|
||||
FRAGMENT
|
||||
}
|
||||
|
||||
Type type;
|
||||
|
|
|
@ -10,6 +10,7 @@ public class SWScreen {
|
|||
int header;
|
||||
List<SWItem> items = new ArrayList<>();
|
||||
SWValidator validator;
|
||||
SWValidator visibility;
|
||||
boolean skippable = false;
|
||||
|
||||
public SWScreen(int header) {
|
||||
|
@ -35,6 +36,11 @@ public class SWScreen {
|
|||
return this;
|
||||
}
|
||||
|
||||
public SWScreen visibility(SWValidator visibility) {
|
||||
this.visibility = visibility;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void processVisibility() {
|
||||
for (SWItem i : items)
|
||||
i.processVisibility();
|
||||
|
|
|
@ -17,6 +17,7 @@ import java.util.List;
|
|||
import info.nightscout.androidaps.MainActivity;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.events.EventProfileStoreChanged;
|
||||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientStatus;
|
||||
import info.nightscout.androidaps.startupwizard.events.EventSWUpdate;
|
||||
|
@ -46,6 +47,7 @@ public class SetupWizardActivity extends AppCompatActivity {
|
|||
TextView screenName = (TextView) findViewById(R.id.sw_content);
|
||||
screenName.setText(currentScreen.getHeader());
|
||||
|
||||
swDefinition.setActivity(this);
|
||||
//Generate layout first
|
||||
generateLayout();
|
||||
updateButtons();
|
||||
|
@ -82,6 +84,11 @@ public class SetupWizardActivity extends AppCompatActivity {
|
|||
updateButtons();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEventProfileStoreChanged(EventProfileStoreChanged ignored) {
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
private void generateLayout() {
|
||||
SWScreen currentScreen = screens.get(currentWizardPage);
|
||||
LinearLayout layout = SWItem.generateLayout(this.findViewById(R.id.sw_content_fields));
|
||||
|
@ -92,40 +99,39 @@ public class SetupWizardActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
private void updateButtons() {
|
||||
SWScreen currentScreen = screens.get(currentWizardPage);
|
||||
if (currentScreen.validator == null || currentScreen.validator.isValid() || currentScreen.skippable) {
|
||||
if (currentWizardPage == screens.size() - 1) {
|
||||
findViewById(R.id.finish_button).setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.next_button).setVisibility(View.GONE);
|
||||
runOnUiThread(() -> {
|
||||
SWScreen currentScreen = screens.get(currentWizardPage);
|
||||
if (currentScreen.validator == null || currentScreen.validator.isValid() || currentScreen.skippable) {
|
||||
if (currentWizardPage == nextPage()) {
|
||||
findViewById(R.id.finish_button).setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.next_button).setVisibility(View.GONE);
|
||||
} else {
|
||||
findViewById(R.id.finish_button).setVisibility(View.GONE);
|
||||
findViewById(R.id.next_button).setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
findViewById(R.id.finish_button).setVisibility(View.GONE);
|
||||
findViewById(R.id.next_button).setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.next_button).setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
findViewById(R.id.finish_button).setVisibility(View.GONE);
|
||||
findViewById(R.id.next_button).setVisibility(View.GONE);
|
||||
}
|
||||
if (currentWizardPage == 0)
|
||||
findViewById(R.id.previous_button).setVisibility(View.GONE);
|
||||
else
|
||||
findViewById(R.id.previous_button).setVisibility(View.VISIBLE);
|
||||
currentScreen.processVisibility();
|
||||
if (currentWizardPage == 0)
|
||||
findViewById(R.id.previous_button).setVisibility(View.GONE);
|
||||
else
|
||||
findViewById(R.id.previous_button).setVisibility(View.VISIBLE);
|
||||
currentScreen.processVisibility();
|
||||
});
|
||||
}
|
||||
|
||||
public void showNextPage(View view) {
|
||||
this.finish();
|
||||
Intent intent = new Intent(this, SetupWizardActivity.class);
|
||||
intent.putExtra(INTENT_MESSAGE, currentWizardPage + 1);
|
||||
intent.putExtra(INTENT_MESSAGE, nextPage());
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
public void showPreviousPage(View view) {
|
||||
this.finish();
|
||||
Intent intent = new Intent(this, SetupWizardActivity.class);
|
||||
if (currentWizardPage > 0)
|
||||
intent.putExtra(INTENT_MESSAGE, currentWizardPage - 1);
|
||||
else
|
||||
intent.putExtra(INTENT_MESSAGE, 0);
|
||||
intent.putExtra(INTENT_MESSAGE, previousPage());
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
|
@ -135,4 +141,23 @@ public class SetupWizardActivity extends AppCompatActivity {
|
|||
startActivity(intent);
|
||||
}
|
||||
|
||||
private int nextPage() {
|
||||
int page = currentWizardPage + 1;
|
||||
while (page < screens.size()) {
|
||||
if (screens.get(page).visibility == null || screens.get(page).visibility.isValid())
|
||||
return page;
|
||||
page++;
|
||||
}
|
||||
return currentWizardPage;
|
||||
}
|
||||
|
||||
private int previousPage() {
|
||||
int page = currentWizardPage - 1;
|
||||
while (page > 0) {
|
||||
if (screens.get(page).visibility == null || screens.get(page).visibility.isValid())
|
||||
return page;
|
||||
page--;
|
||||
}
|
||||
return currentWizardPage;
|
||||
}
|
||||
}
|
|
@ -1,79 +1,73 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#0099cc"
|
||||
android:orientation="vertical"
|
||||
tools:context=".startupwizard.SetupWizardActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sw_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:keepScreenOn="true"
|
||||
android:text="@string/dummy_content"
|
||||
android:textColor="#33b5e5"
|
||||
android:textSize="20dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<FrameLayout
|
||||
<LinearLayout
|
||||
android:id="@+id/sw_content_fields"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/sw_content_fields"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:orientation="vertical">
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/sw_content_controls"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:background="@color/black_overlay"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/sw_content_controls"
|
||||
android:layout_width="match_parent"
|
||||
<Button
|
||||
android:id="@+id/previous_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:background="@color/black_overlay"
|
||||
android:orientation="horizontal">
|
||||
android:layout_weight="1"
|
||||
android:onClick="showPreviousPage"
|
||||
android:text="@string/setupwizard_previous" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/previous_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:onClick="showPreviousPage"
|
||||
android:text="@string/setupwizard_previous" />
|
||||
<Button
|
||||
android:id="@+id/skip_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:onClick="showNextPage"
|
||||
android:text="@string/setupwizard_skip"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/skip_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:onClick="showNextPage"
|
||||
android:text="@string/setupwizard_skip"
|
||||
android:visibility="invisible" />
|
||||
<Button
|
||||
android:id="@+id/next_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:onClick="showNextPage"
|
||||
android:text="@string/setupwizard_next"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/next_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:onClick="showNextPage"
|
||||
android:text="@string/setupwizard_next"
|
||||
android:visibility="gone" />
|
||||
<Button
|
||||
android:id="@+id/finish_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:onClick="finishSetupWizard"
|
||||
android:text="@string/setupwizard_finish"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/finish_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:onClick="finishSetupWizard"
|
||||
android:text="@string/setupwizard_finish"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
|
@ -71,7 +71,7 @@
|
|||
<string name="objectives">Цели</string>
|
||||
<string name="openapsma">OpenAPS MA</string>
|
||||
<string name="overview">Общ</string>
|
||||
<string name="profileviewer">NS Профил</string>
|
||||
<string name="nsprofile">NS Профил</string>
|
||||
<string name="simpleprofile">Обикновен профил</string>
|
||||
<string name="tempbasal">TempBasal</string>
|
||||
<string name="treatments">Лечения</string>
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
<string name="overview_newtempbasal_basalpercent">Hodnota bazálu [%]</string>
|
||||
<string name="overview_newtempbasal_percent_label">% (100% = současný)</string>
|
||||
<string name="overview_treatment_label">Bolus</string>
|
||||
<string name="profileviewer">NS profil</string>
|
||||
<string name="nsprofile">NS profil</string>
|
||||
<string name="objectives_pumpstatusavailableinns">Stav pumpy dostupný v NS</string>
|
||||
<string name="rate">Hodnota</string>
|
||||
<string name="reason">Zdůvodnění</string>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<string name="days">Tage</string>
|
||||
<string name="ok">OK</string>
|
||||
<string name="openapsma_profile_label">Profil</string>
|
||||
<string name="profileviewer">Nightscout-Profil</string>
|
||||
<string name="nsprofile">Nightscout-Profil</string>
|
||||
<string name="tempbasals_iob_label_string">IOB:</string>
|
||||
<string name="tempbasals_iobtotal_label_string">Gesamt-IOB:</string>
|
||||
<string name="tempbasals_netinsulin_label_string">Ins:</string>
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
<string name="objectives">Στόχοι</string>
|
||||
<string name="openapsma">OpenAPS MA</string>
|
||||
<string name="overview">Επισκόπηση</string>
|
||||
<string name="profileviewer">Προφίλ NS</string>
|
||||
<string name="nsprofile">Προφίλ NS</string>
|
||||
<string name="simpleprofile">Απλό Προφίλ</string>
|
||||
<string name="tempbasal">Προσ.Ρυθμός</string>
|
||||
<string name="treatments">Θεραπείες</string>
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
<string name="objectives">Objetivos</string>
|
||||
<string name="openapsma">OpenAPS MA</string>
|
||||
<string name="overview">Sinopsis</string>
|
||||
<string name="profileviewer">Perfil NS</string>
|
||||
<string name="nsprofile">Perfil NS</string>
|
||||
<string name="simpleprofile">Perfil simple</string>
|
||||
<string name="tempbasal">Basal temporal</string>
|
||||
<string name="treatments">Tratamientos</string>
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
<string name="objectives">Objectifs</string>
|
||||
<string name="openapsma">OpenAPS MA</string>
|
||||
<string name="overview">Aperçu</string>
|
||||
<string name="profileviewer">Profil NS</string>
|
||||
<string name="nsprofile">Profil NS</string>
|
||||
<string name="simpleprofile">Profil simple</string>
|
||||
<string name="tempbasal">Basal Tempo</string>
|
||||
<string name="treatments">Traitements</string>
|
||||
|
|
|
@ -454,7 +454,7 @@
|
|||
<string name="simpleprofile_shortname">SP</string>
|
||||
<string name="quickwizard">QuickWizard</string>
|
||||
<string name="quickwizardsettings">Impostazioni QuickWizard</string>
|
||||
<string name="profileviewer">Profilo NS</string>
|
||||
<string name="nsprofile">Profilo NS</string>
|
||||
<string name="profile_set_ok">Profilo Basale aggiornato nel Micro</string>
|
||||
<string name="profile_set_failed">Impostazione Profilo Basale fallito</string>
|
||||
</resources>
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
<string name="objectives">목표</string>
|
||||
<string name="openapsma">OpenAPS MA</string>
|
||||
<string name="overview">개요</string>
|
||||
<string name="profileviewer">NS 프로파일</string>
|
||||
<string name="nsprofile">NS 프로파일</string>
|
||||
<string name="simpleprofile">Simple 프로파일</string>
|
||||
<string name="tempbasal">임시기초</string>
|
||||
<string name="treatments">관리</string>
|
||||
|
|
|
@ -426,7 +426,7 @@
|
|||
<string name="openapsma_inputparameters_label">Berekende gegevens</string>
|
||||
<string name="openapsma_iobdata_label">IOB gegevens</string>
|
||||
<string name="openapsma_maxbasal_summary">DIt is de maximale waarde waarop het basaal door OpenAPS ingesteld kan worden</string>
|
||||
<string name="profileviewer">NS Profiel</string>
|
||||
<string name="nsprofile">NS Profiel</string>
|
||||
<string name="profileviewer_shortname">NSPROFIEL</string>
|
||||
<string name="pump">Pomp</string>
|
||||
<string name="overview_tempbasal_button">Tijdelijk basaal</string>
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
<string name="objectives">Zadania</string>
|
||||
<string name="openapsma">OpenAPS MA</string>
|
||||
<string name="overview">Przegląd</string>
|
||||
<string name="profileviewer">NS Profil</string>
|
||||
<string name="nsprofile">NS Profil</string>
|
||||
<string name="simpleprofile">Prosty profil</string>
|
||||
<string name="tempbasal">TymczasowaBaza</string>
|
||||
<string name="treatments">Leczenie</string>
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
<string name="objectives">Obiective</string>
|
||||
<string name="openapsma">OpenAPS MA</string>
|
||||
<string name="overview">Privire ansamblu</string>
|
||||
<string name="profileviewer">Profil NS</string>
|
||||
<string name="nsprofile">Profil NS</string>
|
||||
<string name="simpleprofile">Profil simplu</string>
|
||||
<string name="treatments">Tratamente</string>
|
||||
<string name="virtualpump">Pompă virtuală</string>
|
||||
|
|
|
@ -374,7 +374,7 @@
|
|||
<string name="profile">профиль</string>
|
||||
<string name="profile_set_failed">настройка базального профиля не состоялась</string>
|
||||
<string name="profile_set_ok">базальный профиль помпы обновлен</string>
|
||||
<string name="profileviewer">профиль NS</string>
|
||||
<string name="nsprofile">профиль NS</string>
|
||||
<string name="profileviewer_shortname">профильNS</string>
|
||||
<string name="pumpNotInitialized">помпа не инициализирована</string>
|
||||
<string name="pumpNotInitializedProfileNotSet">помпа не инициализирована, профиль не установлен</string>
|
||||
|
|
|
@ -430,7 +430,7 @@
|
|||
<string name="pumpNotInitialized">Pump inte initierad</string>
|
||||
<string name="pump">Pump</string>
|
||||
<string name="profileviewer_shortname">NSProfil</string>
|
||||
<string name="profileviewer">NS-profil</string>
|
||||
<string name="nsprofile">NS-profil</string>
|
||||
<string name="profileswitch">Profilbyte</string>
|
||||
<string name="profile_set_ok">Basalprofilen uppdaterad i pumpen</string>
|
||||
<string name="profile_set_failed">Lyckades inte sätta basalprofilen</string>
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
<string name="objectives">Objectives</string>
|
||||
<string name="openapsma">OpenAPS MA</string>
|
||||
<string name="overview">Overview</string>
|
||||
<string name="profileviewer">NS Profile</string>
|
||||
<string name="nsprofile">NS Profile</string>
|
||||
<string name="simpleprofile">Simple profile</string>
|
||||
<string name="tempbasal">TempBasal</string>
|
||||
<string name="treatments">Treatments</string>
|
||||
|
@ -1057,11 +1057,10 @@
|
|||
<string name="wear_wizard_settings_summary">Calculations included in the Wizard result:</string>
|
||||
<string name="wear_display_settings">Display Settings</string>
|
||||
<string name="wear_general_settings">General Settings</string>
|
||||
|
||||
<string name="dummy_content">DUMMY\nCONTENT</string>
|
||||
<string name="enable_nsclient">Enable NSClient</string>
|
||||
<string name="welcometosetupwizard">Welcome to setup wizard. It will guide you through the setup process</string>
|
||||
<string name="pumpsetup">Pump setup</string>
|
||||
<string name="readstatus">Read status</string>
|
||||
<string name="adjustprofileinns">Changes must be done in NS</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue