commit
49c0917c03
8 changed files with 66 additions and 20 deletions
|
@ -67,23 +67,19 @@ public class ObjectivesFragment extends SubscriberFragment {
|
||||||
holder.startButton.setTag(o);
|
holder.startButton.setTag(o);
|
||||||
holder.verifyButton.setTag(o);
|
holder.verifyButton.setTag(o);
|
||||||
|
|
||||||
holder.startButton.setOnClickListener(new View.OnClickListener() {
|
holder.startButton.setOnClickListener(v -> {
|
||||||
public void onClick(View v) {
|
ObjectivesPlugin.Objective o1 = (ObjectivesPlugin.Objective) v.getTag();
|
||||||
ObjectivesPlugin.Objective o = (ObjectivesPlugin.Objective) v.getTag();
|
o1.started = new Date();
|
||||||
o.started = new Date();
|
|
||||||
updateGUI();
|
updateGUI();
|
||||||
ObjectivesPlugin.saveProgress();
|
ObjectivesPlugin.saveProgress();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
holder.verifyButton.setOnClickListener(new View.OnClickListener() {
|
holder.verifyButton.setOnClickListener(v -> {
|
||||||
public void onClick(View v) {
|
ObjectivesPlugin.Objective o12 = (ObjectivesPlugin.Objective) v.getTag();
|
||||||
ObjectivesPlugin.Objective o = (ObjectivesPlugin.Objective) v.getTag();
|
if (ObjectivesPlugin.getPlugin().requirementsMet(o12.num).done || enableFake.isChecked()) {
|
||||||
if (ObjectivesPlugin.getPlugin().requirementsMet(o.num).done || enableFake.isChecked()) {
|
o12.accomplished = new Date();
|
||||||
o.accomplished = new Date();
|
|
||||||
updateGUI();
|
updateGUI();
|
||||||
ObjectivesPlugin.saveProgress();
|
ObjectivesPlugin.saveProgress();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
long prevObjectiveAccomplishedTime = position > 0 ?
|
long prevObjectiveAccomplishedTime = position > 0 ?
|
||||||
|
|
|
@ -22,6 +22,7 @@ import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PluginType;
|
import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.ConstraintsObjectives.events.EventObjectivesSaved;
|
||||||
import info.nightscout.androidaps.plugins.ConstraintsSafety.SafetyPlugin;
|
import info.nightscout.androidaps.plugins.ConstraintsSafety.SafetyPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientPlugin;
|
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientPlugin;
|
||||||
|
@ -87,7 +88,7 @@ public class ObjectivesPlugin extends PluginBase implements ConstraintsInterface
|
||||||
this.started = started;
|
this.started = started;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isStarted() {
|
public boolean isStarted() {
|
||||||
return started.getTime() > 0;
|
return started.getTime() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,6 +234,7 @@ public class ObjectivesPlugin extends PluginBase implements ConstraintsInterface
|
||||||
editor.apply();
|
editor.apply();
|
||||||
if (Config.logPrefsChange)
|
if (Config.logPrefsChange)
|
||||||
log.debug("Objectives stored");
|
log.debug("Objectives stored");
|
||||||
|
MainApp.bus().post(new EventObjectivesSaved());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package info.nightscout.androidaps.plugins.ConstraintsObjectives.events;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.Event;
|
||||||
|
|
||||||
|
public class EventObjectivesSaved extends Event {
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ import com.squareup.otto.Subscribe;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -23,6 +24,7 @@ import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialo
|
||||||
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderFragment;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderFragment;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.ConstraintsObjectives.ObjectivesFragment;
|
||||||
import info.nightscout.androidaps.plugins.ConstraintsObjectives.ObjectivesPlugin;
|
import info.nightscout.androidaps.plugins.ConstraintsObjectives.ObjectivesPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientPlugin;
|
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientPlugin;
|
||||||
|
@ -34,6 +36,7 @@ import info.nightscout.androidaps.plugins.ProfileSimple.SimpleProfileFragment;
|
||||||
import info.nightscout.androidaps.plugins.ProfileSimple.SimpleProfilePlugin;
|
import info.nightscout.androidaps.plugins.ProfileSimple.SimpleProfilePlugin;
|
||||||
import info.nightscout.androidaps.startupwizard.events.EventSWLabel;
|
import info.nightscout.androidaps.startupwizard.events.EventSWLabel;
|
||||||
import info.nightscout.androidaps.startupwizard.events.EventSWUpdate;
|
import info.nightscout.androidaps.startupwizard.events.EventSWUpdate;
|
||||||
|
import info.nightscout.utils.ImportExportPrefs;
|
||||||
import info.nightscout.utils.LocaleHelper;
|
import info.nightscout.utils.LocaleHelper;
|
||||||
import info.nightscout.utils.PasswordProtection;
|
import info.nightscout.utils.PasswordProtection;
|
||||||
import info.nightscout.utils.SP;
|
import info.nightscout.utils.SP;
|
||||||
|
@ -67,6 +70,13 @@ public class SWDefinition {
|
||||||
add(new SWScreen(R.string.nav_setupwizard)
|
add(new SWScreen(R.string.nav_setupwizard)
|
||||||
.add(new SWInfotext()
|
.add(new SWInfotext()
|
||||||
.label(R.string.welcometosetupwizard))
|
.label(R.string.welcometosetupwizard))
|
||||||
|
.add(new SWButton()
|
||||||
|
.text(R.string.nav_import)
|
||||||
|
.action(() -> ImportExportPrefs.importSharedPreferences(getActivity()))
|
||||||
|
.visibility(ImportExportPrefs.file::exists))
|
||||||
|
.add(new SWButton()
|
||||||
|
.text(R.string.exitwizard)
|
||||||
|
.action(() -> getActivity().finish()))
|
||||||
)
|
)
|
||||||
.add(new SWScreen(R.string.language)
|
.add(new SWScreen(R.string.language)
|
||||||
.skippable(false)
|
.skippable(false)
|
||||||
|
@ -215,6 +225,17 @@ public class SWDefinition {
|
||||||
.add(new SWPlugin()
|
.add(new SWPlugin()
|
||||||
.option(PluginType.APS)
|
.option(PluginType.APS)
|
||||||
.label(R.string.configbuilder_aps))
|
.label(R.string.configbuilder_aps))
|
||||||
|
.add(new SWButton()
|
||||||
|
.text(R.string.apssetup)
|
||||||
|
.action(() -> {
|
||||||
|
final PluginBase plugin = (PluginBase) MainApp.getConfigBuilder().getActiveAPS();
|
||||||
|
PasswordProtection.QueryPassword(activity, R.string.settings_password, "settings_password", () -> {
|
||||||
|
Intent i = new Intent(activity, PreferencesActivity.class);
|
||||||
|
i.putExtra("id", plugin.getPreferencesId());
|
||||||
|
activity.startActivity(i);
|
||||||
|
}, null);
|
||||||
|
})
|
||||||
|
.visibility(() -> MainApp.getConfigBuilder().getActiveAPS() != null && ((PluginBase) MainApp.getConfigBuilder().getActiveAPS()).getPreferencesId() > 0))
|
||||||
.validator(() -> MainApp.getConfigBuilder().getActiveAPS() != null)
|
.validator(() -> MainApp.getConfigBuilder().getActiveAPS() != null)
|
||||||
)
|
)
|
||||||
.add(new SWScreen(R.string.configbuilder_loop)
|
.add(new SWScreen(R.string.configbuilder_loop)
|
||||||
|
@ -239,7 +260,7 @@ public class SWDefinition {
|
||||||
.add(new SWInfotext()
|
.add(new SWInfotext()
|
||||||
.label(R.string.setupwizard_objectives_description))
|
.label(R.string.setupwizard_objectives_description))
|
||||||
.add(new SWButton()
|
.add(new SWButton()
|
||||||
.text(R.string.objectives_button_start)
|
.text(R.string.enableobjectives)
|
||||||
.action(() -> {
|
.action(() -> {
|
||||||
ObjectivesPlugin.getPlugin().setPluginEnabled(PluginType.CONSTRAINTS, true);
|
ObjectivesPlugin.getPlugin().setPluginEnabled(PluginType.CONSTRAINTS, true);
|
||||||
ObjectivesPlugin.getPlugin().setFragmentVisible(PluginType.CONSTRAINTS, true);
|
ObjectivesPlugin.getPlugin().setFragmentVisible(PluginType.CONSTRAINTS, true);
|
||||||
|
@ -251,6 +272,13 @@ public class SWDefinition {
|
||||||
.validator(() -> ObjectivesPlugin.getPlugin().isEnabled(PluginType.CONSTRAINTS))
|
.validator(() -> ObjectivesPlugin.getPlugin().isEnabled(PluginType.CONSTRAINTS))
|
||||||
.visibility(() -> !ObjectivesPlugin.getPlugin().isFragmentVisible())
|
.visibility(() -> !ObjectivesPlugin.getPlugin().isFragmentVisible())
|
||||||
)
|
)
|
||||||
|
.add(new SWScreen(R.string.objectives)
|
||||||
|
.skippable(false)
|
||||||
|
.add(new SWFragment(this)
|
||||||
|
.add(new ObjectivesFragment()))
|
||||||
|
.validator(() -> ObjectivesPlugin.getPlugin().objectives.get(0).isStarted())
|
||||||
|
.visibility(() -> !ObjectivesPlugin.getPlugin().objectives.get(0).isStarted())
|
||||||
|
)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,9 @@ import info.nightscout.androidaps.MainActivity;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.events.EventProfileStoreChanged;
|
import info.nightscout.androidaps.events.EventProfileStoreChanged;
|
||||||
|
import info.nightscout.androidaps.events.EventProfileSwitchChange;
|
||||||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||||
|
import info.nightscout.androidaps.plugins.ConstraintsObjectives.events.EventObjectivesSaved;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientStatus;
|
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientStatus;
|
||||||
import info.nightscout.androidaps.startupwizard.events.EventSWUpdate;
|
import info.nightscout.androidaps.startupwizard.events.EventSWUpdate;
|
||||||
import info.nightscout.utils.LocaleHelper;
|
import info.nightscout.utils.LocaleHelper;
|
||||||
|
@ -95,6 +97,16 @@ public class SetupWizardActivity extends AppCompatActivity {
|
||||||
updateButtons();
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onEventProfileSwitchChange(EventProfileSwitchChange ignored) {
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onEventObjectivesSaved(EventObjectivesSaved ignored) {
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
|
||||||
private void generateLayout() {
|
private void generateLayout() {
|
||||||
SWScreen currentScreen = screens.get(currentWizardPage);
|
SWScreen currentScreen = screens.get(currentWizardPage);
|
||||||
LinearLayout layout = SWItem.generateLayout(this.findViewById(R.id.sw_content_fields));
|
LinearLayout layout = SWItem.generateLayout(this.findViewById(R.id.sw_content_fields));
|
||||||
|
|
|
@ -33,7 +33,7 @@ import info.nightscout.androidaps.events.EventAppExit;
|
||||||
public class ImportExportPrefs {
|
public class ImportExportPrefs {
|
||||||
private static Logger log = LoggerFactory.getLogger(ImportExportPrefs.class);
|
private static Logger log = LoggerFactory.getLogger(ImportExportPrefs.class);
|
||||||
static File path = new File(Environment.getExternalStorageDirectory().toString());
|
static File path = new File(Environment.getExternalStorageDirectory().toString());
|
||||||
static final File file = new File(path, MainApp.gs(R.string.app_name) + "Preferences");
|
static public final File file = new File(path, MainApp.gs(R.string.app_name) + "Preferences");
|
||||||
|
|
||||||
private static final int REQUEST_EXTERNAL_STORAGE = 1;
|
private static final int REQUEST_EXTERNAL_STORAGE = 1;
|
||||||
private static String[] PERMISSIONS_STORAGE = {
|
private static String[] PERMISSIONS_STORAGE = {
|
||||||
|
|
|
@ -545,7 +545,7 @@
|
||||||
<string name="overview_extendedbolus_cancel_button">Zrušit prodloužený bolus</string>
|
<string name="overview_extendedbolus_cancel_button">Zrušit prodloužený bolus</string>
|
||||||
<string name="overview_newtempbasal_basalabsolute">Hodnota bazálu [U/h]</string>
|
<string name="overview_newtempbasal_basalabsolute">Hodnota bazálu [U/h]</string>
|
||||||
<string name="overview_newtempbasal_basaltype_label">Typ bazálu</string>
|
<string name="overview_newtempbasal_basaltype_label">Typ bazálu</string>
|
||||||
<string name="profileswitch">PřepnutíProfilu</string>
|
<string name="profileswitch">Přepnutí profilu</string>
|
||||||
<string name="pump">Pumpa</string>
|
<string name="pump">Pumpa</string>
|
||||||
<string name="xdripstatus">Statusový řádek xDripu (hodinky)</string>
|
<string name="xdripstatus">Statusový řádek xDripu (hodinky)</string>
|
||||||
<string name="xdripstatus_settings">Status z xDripu (hodinky)</string>
|
<string name="xdripstatus_settings">Status z xDripu (hodinky)</string>
|
||||||
|
|
|
@ -1063,9 +1063,11 @@
|
||||||
<string name="pumpsetup">Pump setup</string>
|
<string name="pumpsetup">Pump setup</string>
|
||||||
<string name="readstatus">Read status</string>
|
<string name="readstatus">Read status</string>
|
||||||
<string name="adjustprofileinns">Changes must be done in NS</string>
|
<string name="adjustprofileinns">Changes must be done in NS</string>
|
||||||
<string name="exitwizard">Exit setup wizard?</string>
|
<string name="exitwizard">Skip setup wizard</string>
|
||||||
<string name="setupwizard_bgsource_description">Where should blood glucose(BG) data be comming from ?</string>
|
<string name="setupwizard_bgsource_description">Where should blood glucose(BG) data be comming from ?</string>
|
||||||
<string name="setupwizard_loop_description">Press the button below to enable AndroidAPS to suggest/make basal changes</string>
|
<string name="setupwizard_loop_description">Press the button below to enable AndroidAPS to suggest/make basal changes</string>
|
||||||
<string name="setupwizard_objectives_description">Press the button below to enable Objectives. Look in the Objectives tab, after you finish this wizard, to make AndroidAPS completely functional.</string>
|
<string name="setupwizard_objectives_description">Press the button below to enable Objectives. Look in the Objectives tab, after you finish this wizard, to make AndroidAPS completely functional.</string>
|
||||||
|
<string name="enableobjectives">Enable Objectives</string>
|
||||||
|
<string name="apssetup">Configure APS plugin</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue