objectives finalization, some todos

This commit is contained in:
Milos Kozak 2016-08-04 23:38:43 +02:00
parent 4df4a22997
commit b42644de39
12 changed files with 85 additions and 58 deletions

View file

@ -37,7 +37,7 @@
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View file

@ -36,25 +36,16 @@ android {
careportal {
buildConfigField "boolean", "APS", "false"
buildConfigField "boolean", "PUMPDRIVERS", "false"
buildConfigField "boolean", "OBJECTIVES", "false"
buildConfigField "boolean", "CLOSEDLOOP", "false"
}
openloop {
buildConfigField "boolean", "APS", "true"
buildConfigField "boolean", "PUMPDRIVERS", "true"
buildConfigField "boolean", "OBJECTIVES", "false"
buildConfigField "boolean", "CLOSEDLOOP", "false"
}
full {
buildConfigField "boolean", "APS", "true"
buildConfigField "boolean", "PUMPDRIVERS", "true"
buildConfigField "boolean", "OBJECTIVES", "true"
buildConfigField "boolean", "CLOSEDLOOP", "true"
}
full_noobjectives {
buildConfigField "boolean", "APS", "true"
buildConfigField "boolean", "PUMPDRIVERS", "true"
buildConfigField "boolean", "OBJECTIVES", "false"
buildConfigField "boolean", "CLOSEDLOOP", "true"
}
}

View file

@ -10,7 +10,6 @@ public class Config {
public static final boolean LOWSUSPEDENABLED = APS;
public static final boolean OPENAPSMAENABLED = APS;
public static final boolean LOOPENABLED = APS;
public static final boolean OBJECTIVESENABLED = APS && BuildConfig.OBJECTIVES;
public static final boolean CAREPORTALENABLED = true;
public static final boolean SMSCOMMUNICATORENABLED = true;

View file

@ -75,7 +75,7 @@ public class MainApp extends Application {
pluginsList.add(TreatmentsFragment.newInstance());
pluginsList.add(TempBasalsFragment.newInstance());
pluginsList.add(SafetyFragment.newInstance());
if (Config.OBJECTIVESENABLED) pluginsList.add(ObjectivesFragment.newInstance());
if (Config.APS) pluginsList.add(ObjectivesFragment.newInstance());
pluginsList.add(SourceXdripFragment.newInstance());
pluginsList.add(SourceNSClientFragment.newInstance());
if (Config.SMSCOMMUNICATORENABLED) pluginsList.add(SmsCommunicatorFragment.newInstance());

View file

@ -91,8 +91,6 @@ public class DanaRFragment extends Fragment implements PluginBase, PumpInterface
Button viewProfileButton;
Button historyButton;
// TODO: password in prefs
public static DanaRPump getDanaRPump() {
return sDanaRPump;
}

View file

@ -27,13 +27,11 @@ import java.util.Date;
import java.util.List;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainActivity;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventNewBG;
import info.nightscout.androidaps.interfaces.ConstraintsInterface;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.plugins.Loop.APSResult;
import info.nightscout.androidaps.plugins.Loop.LoopFragment;
public class ObjectivesFragment extends Fragment implements View.OnClickListener, PluginBase, ConstraintsInterface {
@ -41,7 +39,7 @@ public class ObjectivesFragment extends Fragment implements View.OnClickListener
RecyclerView recyclerView;
LinearLayoutManager llm;
CheckBox enableFake; // TODO: remove faking
CheckBox enableFake;
boolean fragmentVisible = true;
@ -133,11 +131,11 @@ public class ObjectivesFragment extends Fragment implements View.OnClickListener
switch (objNum) {
case 0:
return new RequirementResult(bgIsAvailableInNS && pumpStatusIsAvailableInNS,
getString(R.string.bgavailableinns) + ": " + yesOrNo(bgIsAvailableInNS)
+ " " + getString(R.string.pumpstatusavailableinns) + ": " + yesOrNo(pumpStatusIsAvailableInNS));
getString(R.string.objectives_bgavailableinns) + ": " + yesOrNo(bgIsAvailableInNS)
+ " " + getString(R.string.objectives_pumpstatusavailableinns) + ": " + yesOrNo(pumpStatusIsAvailableInNS));
case 1:
return new RequirementResult(manualEnacts >= manualEnactsNeeded,
getString(R.string.manualenacts) + ": " + manualEnacts + "/" + manualEnactsNeeded);
getString(R.string.objectives_manualenacts) + ": " + manualEnacts + "/" + manualEnactsNeeded);
case 2:
return new RequirementResult(true, "");
default:
@ -151,43 +149,43 @@ public class ObjectivesFragment extends Fragment implements View.OnClickListener
private void initializeData() {
objectives = new ArrayList<>();
objectives.add(new Objective(0,
"Setting up visualization and monitoring, and analyzing basals and ratios",
"Verify that BG is available in Nightscout, and pump insulin data is being uploaded",
MainApp.sResources.getString(R.string.objectives_0_objective),
MainApp.sResources.getString(R.string.objectives_0_gate),
new Date(0, 0, 0),
1, // 1 day
new Date(0, 0, 0)));
objectives.add(new Objective(1,
"Starting on an open loop",
"Run in Open Loop mode for a few days, and manually enact lots of temp basals",
MainApp.sResources.getString(R.string.objectives_1_objective),
MainApp.sResources.getString(R.string.objectives_1_gate),
new Date(0, 0, 0),
7, // 7 days
new Date(0, 0, 0)));
objectives.add(new Objective(2,
"Understanding your open loop, including its temp basal recommendations",
"Based on that experience, decide what max basal should be, and set it on the pump and preferences",
MainApp.sResources.getString(R.string.objectives_2_objective),
MainApp.sResources.getString(R.string.objectives_2_gate),
new Date(0, 0, 0),
0, // 0 days
new Date(0, 0, 0)));
objectives.add(new Objective(3,
"Starting to close the loop with Low Glucose Suspend",
"Run in closed loop with max IOB = 0 for a few days without too many LGS events",
MainApp.sResources.getString(R.string.objectives_3_objective),
MainApp.sResources.getString(R.string.objectives_3_gate),
new Date(0, 0, 0),
5, // 5 days
new Date(0, 0, 0)));
objectives.add(new Objective(4,
"Tuning the closed loop, raising max IOB above 0 and gradually lowering BG targets",
"Run for a few days, and at least one night with no low BG alarms, before dropping BG",
MainApp.sResources.getString(R.string.objectives_4_objective),
MainApp.sResources.getString(R.string.objectives_4_gate),
new Date(0, 0, 0),
1,
new Date(0, 0, 0)));
objectives.add(new Objective(5,
"Adjust basals and ratios if needed, and then enable auto-sens",
"1 week successful daytime looping with regular carb entry",
MainApp.sResources.getString(R.string.objectives_5_objective),
MainApp.sResources.getString(R.string.objectives_5_gate),
new Date(0, 0, 0),
7,
new Date(0, 0, 0)));
objectives.add(new Objective(6,
"Enabling additional features for daytime use, such as advanced meal assist",
MainApp.sResources.getString(R.string.objectives_6_objective),
"",
new Date(0, 0, 0),
1,
@ -205,7 +203,7 @@ public class ObjectivesFragment extends Fragment implements View.OnClickListener
editor.putBoolean("Objectives" + "bgIsAvailableInNS", bgIsAvailableInNS);
editor.putBoolean("Objectives" + "pumpStatusIsAvailableInNS", pumpStatusIsAvailableInNS);
editor.putInt("Objectives" + "manualEnacts", manualEnacts);
editor.commit();
editor.apply();
if (Config.logPrefsChange)
log.debug("Objectives stored");
}
@ -246,7 +244,7 @@ public class ObjectivesFragment extends Fragment implements View.OnClickListener
holder.position.setText(String.valueOf(position + 1));
holder.objective.setText(o.objective);
holder.gate.setText(o.gate);
holder.duration.setText(context.getString(R.string.minimalduration) + " " + o.durationInDays + " " + context.getString(R.string.days));
holder.duration.setText(context.getString(R.string.objectives_minimalduration) + " " + o.durationInDays + " " + context.getString(R.string.days));
holder.progress.setText(requirementsMet.comment);
holder.started.setText(o.started.toLocaleString());
holder.accomplished.setText(o.accomplished.toLocaleString());
@ -360,8 +358,7 @@ public class ObjectivesFragment extends Fragment implements View.OnClickListener
}
public static ObjectivesFragment newInstance() {
ObjectivesFragment fragment = new ObjectivesFragment();
return fragment;
return new ObjectivesFragment();
}
@Override
@ -384,6 +381,21 @@ public class ObjectivesFragment extends Fragment implements View.OnClickListener
updateGUI();
}
});
// Add correct translations to array after app is initialized
objectives.get(0).objective = MainApp.sResources.getString(R.string.objectives_0_objective);
objectives.get(1).objective = MainApp.sResources.getString(R.string.objectives_1_objective);
objectives.get(2).objective = MainApp.sResources.getString(R.string.objectives_2_objective);
objectives.get(3).objective = MainApp.sResources.getString(R.string.objectives_3_objective);
objectives.get(4).objective = MainApp.sResources.getString(R.string.objectives_4_objective);
objectives.get(5).objective = MainApp.sResources.getString(R.string.objectives_5_objective);
objectives.get(6).objective = MainApp.sResources.getString(R.string.objectives_6_objective);
objectives.get(0).gate = MainApp.sResources.getString(R.string.objectives_0_gate);
objectives.get(1).gate = MainApp.sResources.getString(R.string.objectives_1_gate);
objectives.get(2).gate = MainApp.sResources.getString(R.string.objectives_2_gate);
objectives.get(3).gate = MainApp.sResources.getString(R.string.objectives_3_gate);
objectives.get(4).gate = MainApp.sResources.getString(R.string.objectives_4_gate);
objectives.get(5).gate = MainApp.sResources.getString(R.string.objectives_5_gate);
updateGUI();
return view;

View file

@ -44,7 +44,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
Thread t = new Thread(new Runnable() {
@Override
public void run() {
danaRFragment.doConnect("KeepAlive"); // TODO: only if if last conn > 30 min
danaRFragment.doConnect("KeepAlive");
}
});
t.start();

View file

@ -13,7 +13,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enable fake time and progress"
android:id="@+id/objectives_fake" />
android:id="@+id/objectives_fake"
android:visibility="gone" />
<android.support.v7.widget.RecyclerView
android:id="@+id/objectives_recyclerview"

View file

@ -6,7 +6,7 @@
<string name="apsmode_title">APS режим</string>
<string name="avgdelta">Ср. изменение</string>
<string name="basal">Базал</string>
<string name="bgavailableinns">КЗ достъпна в NS</string>
<string name="objectives_bgavailableinns">КЗ достъпна в NS</string>
<string name="bolus">Болус</string>
<string name="bolusconstraintapplied">Приложено ограничение на болус</string>
<string name="cancel">Откажи</string>
@ -74,9 +74,9 @@
<string name="loopdisabled">Loop отказан от ограниченията</string>
<string name="lowsuspend">Low Suspend</string>
<string name="lowsuspend_low_title">Граница за ниска КЗ</string>
<string name="manualenacts">Manual enacts</string>
<string name="objectives_manualenacts">Manual enacts</string>
<string name="lowsuspend_lowprojected">Low projected</string>
<string name="minimalduration">Минимална продължителност</string>
<string name="objectives_minimalduration">Минимална продължителност</string>
<string name="nav_backup">Архивиране</string>
<string name="nav_exit">Изход</string>
<string name="nav_preferences">Опции</string>
@ -124,7 +124,7 @@
<string name="overview_newtempbasal_percent_label">% (100% = current)</string>
<string name="overview_bolus_label">Болус</string>
<string name="profileviewer">NS профил</string>
<string name="pumpstatusavailableinns">Статус на помпа в NS</string>
<string name="objectives_pumpstatusavailableinns">Статус на помпа в NS</string>
<string name="rate">Стойност</string>
<string name="reason">Основание</string>
<string name="refreshfromnightscout">Искате ли да обновите treatments от Nightscout</string>
@ -220,7 +220,7 @@
<string name="end_user_license_agreement">End User License Agreement</string>
<string name="end_user_license_agreement_text">MUST NOT BE USED TO MAKE MEDICAL DECISIONS. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</string>
<string name="smscommunicator_allowednumbers_summary">+XXXXXXXXXX;+YYYYYYYYYY</string>
<string formatted="false" name="bolusdelivered">Болус %.2fU беше доставен успешно</string>
<string name="bolusdelivered" formatted="false">Болус %.2fU беше доставен успешно</string>
<string name="bolusfailed">Болусът не е доставен</string>
<string name="canceltemp">Откажи временен базал</string>
<string name="virtualpump_lastconnection_label">Последно свързване:</string>
@ -229,7 +229,7 @@
<string name="smscommunicator_allowednumbers">Позволени телефонни номера</string>
<string name="smscommunicator_remotebolusingallowed">Разреши болус чрез SMS</string>
<string name="success">Успех</string>
<string formatted="false" name="replywithcode">За да доставите болус %.2fU отговорете с код %s</string>
<string name="replywithcode" formatted="false">За да доставите болус %.2fU отговорете с код %s</string>
<string name="remotebolusnotallowed">Отдалечен болус не е разрешен</string>
<string name="reloadprofile">Обнови профила</string>
<string name="percent">Процент</string>

View file

@ -6,7 +6,7 @@
<string name="apsmode_title">Typ smyčky</string>
<string name="avgdelta">Prům. změna</string>
<string name="basal">Bazál</string>
<string name="bgavailableinns">Glykémie dostupná v NS</string>
<string name="objectives_bgavailableinns">Glykémie dostupná v NS</string>
<string name="bolus">Bolus</string>
<string name="bolusconstraintapplied">Aplikováno omezení bolusu</string>
<string name="cancel">Zrušit</string>
@ -74,10 +74,10 @@
<string name="loopdisabled">SMYČKA ZAKÁZÁNA OMEZENÍM</string>
<string name="lowsuspend">Low Suspend</string>
<string name="lowsuspend_low_title">Hodnota nízké glykémie</string>
<string name="manualenacts">Ručně spuštěno</string>
<string name="objectives_manualenacts">Ručně spuštěno</string>
<string name="lowsuspend_lowprojected">Předpokládaná nízká glykémie</string>
<string name="minago">m zpět</string>
<string name="minimalduration">Minimální trvání</string>
<string name="objectives_minimalduration">Minimální trvání</string>
<string name="nav_backup">Záloha</string>
<string name="nav_exit">Ukončit</string>
<string name="nav_preferences">Nastavení</string>
@ -125,7 +125,7 @@
<string name="overview_newtempbasal_percent_label">% (100% = současný)</string>
<string name="overview_bolus_label">Bolus</string>
<string name="profileviewer">NS profil</string>
<string name="pumpstatusavailableinns">Stav pumpy dostupný v NS</string>
<string name="objectives_pumpstatusavailableinns">Stav pumpy dostupný v NS</string>
<string name="rate">Hodnota</string>
<string name="reason">Zdůvodnění</string>
<string name="refreshfromnightscout">Opravdu aktualizovat ošetření z NS</string>
@ -277,7 +277,7 @@
<string name="uploading">Nahrávám</string>
<string name="pumpbusy">Pumpa je zaneprázdněna</string>
<string name="wrongpumppassword">Špatné heslo k pumpě</string>
<string name="mm640g"></string>
<string name="mm640g">MM 640g</string>
<string name="danar_password">Heslo k pumpě (pouze verze 2016)</string>
<string name="overview_bolusiprogress_occlusion">Okluze</string>
<string name="overview_bolusprogress_delivered">Podáno</string>
@ -286,4 +286,17 @@
<string name="overview_bolusprogress_stoppressed">STISKNUTO STOP</string>
<string name="waitingforpump">Čekání na pumpu</string>
<string name="overview_bolusprogress_goingtodeliver" formatted="false">Podávání %.2fU inzulínu</string>
<string name="objectives_0_gate">Zkontrolovat, zda jsou glykémie a údaje z pumpy viditelné v Nightscoutu</string>
<string name="objectives_0_objective">Nastavit vizualizaci a monitoring, analyzovat bazály a koeficienty</string>
<string name="objectives_1_gate">Provozovat několik dní otevřenou smyčku a ručně potrvrzovat doporučené dočasné bazály</string>
<string name="objectives_1_objective">Začít s otevřenou smyčkou</string>
<string name="objectives_2_gate">Na základě předchozích zkušeností rozhodnout, jaký je třeba maximální bazál a nastavit ho v pumpě a v aplikaci</string>
<string name="objectives_2_objective">Porozumět otevřené smyčce a doporučeným dočasným bazálům</string>
<string name="objectives_3_gate">Spustit uzavřenou smyčku s max IOB = 0 na několik dní s minimem nutných korekcí na nízkou glykémii </string>
<string name="objectives_3_objective">Začít uzavřenou smyčku pouze s hlídáním nizké glykémie</string>
<string name="objectives_4_gate">Provozovat smyčku několik dní s alespoň jednou nocí bez alarmů na nízkou glykémii</string>
<string name="objectives_4_objective">Zapnout uzavřenou smyčku, zvyšovat max IOB nad 0 a snižovat cílovou glykémii</string>
<string name="objectives_5_gate">Jeden týden úspěšného používání s běžným příjmem sacharidů</string>
<string name="objectives_5_objective">Upravit bazály a koeficinty, když bude potřeba a povolit automatickou detekci citlivosti na inzulín</string>
<string name="objectives_6_objective">Povolit další fukce pro běžné používání jako AMA</string>
</resources>

View file

@ -2,7 +2,7 @@
<resources>
<string name="app_name">AndroidAPS</string>
<string name="apsmode_title">APS Modus</string>
<string name="bgavailableinns">BZ verfügbar in NS</string>
<string name="objectives_bgavailableinns">BZ verfügbar in NS</string>
<string name="cancel">Abbrechen</string>
<string name="carbs">Kohlehydrate</string>
<string name="careportal">Careportal</string>
@ -121,7 +121,7 @@
<string name="setbasalquestion">Akzeptiere neue temp Basalrate:</string>
<string name="danar_useextended_title">Benutze extended Bolus für hohe temps (\>200%)></string>
<string name="refreshfromnightscout">Möchtest du die Treatments von Nightscout abrufen</string>
<string name="pumpstatusavailableinns">Pumpen Status verfügbar in NS</string>
<string name="objectives_pumpstatusavailableinns">Pumpen Status verfügbar in NS</string>
<string name="overview_newtempbasal_percent_label">% (100% = current)</string>
<string name="overview_newtempbasal_basal_label">Basal Wert</string>
<string name="overview_extendedbolus_button">Extended Bolus</string>
@ -179,10 +179,10 @@
<string name="lowsuspend_lowmessage">LOW: Temp basal 0%</string>
<string name="lowsuspend_lowprojected">Low projected</string>
<string name="lowsuspend_lowprojectedmessage">LOW PROJECTED: Temp basal 0%</string>
<string name="manualenacts">Manual enacts</string>
<string name="objectives_manualenacts">Manual enacts</string>
<string name="carbsconstraintapplied">Carbs constraint applied</string>
<string name="nav_resetdb">Reset Datenbanken</string>
<string name="minimalduration">Minimale Dauer</string>
<string name="objectives_minimalduration">Minimale Dauer</string>
<string name="minago">min ago</string>
<string name="nav_refreshtreatments">Erneure treatments von NS</string>
<string name="nav_exit">Exit</string>

View file

@ -101,7 +101,7 @@
<string name="configbuilder_aps">APS</string>
<string name="configbuilder_general">General</string>
<string name="days">days</string>
<string name="minimalduration">Minimal duration</string>
<string name="objectives_minimalduration">Minimal duration</string>
<string name="configbuilder_constraints">Constraints</string>
<string name="loop">Loop</string>
@ -142,9 +142,9 @@
<string name="openloop_newsuggestion">New suggestion available</string>
<string name="unsupportedclientver">Unsupported version of NSClient</string>
<string name="nsclientnotinstalled">NSClient not installed. Record lost!</string>
<string name="bgavailableinns">BG available in NS</string>
<string name="pumpstatusavailableinns">Pump status available in NS</string>
<string name="manualenacts">Manual enacts</string>
<string name="objectives_bgavailableinns">BG available in NS</string>
<string name="objectives_pumpstatusavailableinns">Pump status available in NS</string>
<string name="objectives_manualenacts">Manual enacts</string>
<string name="loopdisabled">LOOP DISABLED BY CONSTRAINTS</string>
<string name="cs_lang">Czech</string>
<string name="en_lang">English</string>
@ -295,5 +295,18 @@
<string name="overview_bolusprogress_stoppressed">STOP PRESSED</string>
<string name="waitingforpump">Waiting for pump</string>
<string name="overview_bolusprogress_goingtodeliver" formatted="false">Going to deliver %.2fU</string>
<string name="objectives_0_objective">Setting up visualization and monitoring, and analyzing basals and ratios</string>
<string name="objectives_0_gate">Verify that BG is available in Nightscout, and pump insulin data is being uploaded</string>
<string name="objectives_1_objective">Starting on an open loop</string>
<string name="objectives_1_gate">Run in Open Loop mode for a few days, and manually enact lots of temp basals</string>
<string name="objectives_2_objective">Understanding your open loop, including its temp basal recommendations</string>
<string name="objectives_2_gate">Based on that experience, decide what max basal should be, and set it on the pump and preferences</string>
<string name="objectives_3_objective">Starting to close the loop with Low Glucose Suspend</string>
<string name="objectives_3_gate">Run in closed loop with max IOB = 0 for a few days without too many LGS events</string>
<string name="objectives_4_objective">Tuning the closed loop, raising max IOB above 0 and gradually lowering BG targets</string>
<string name="objectives_4_gate">Run for a few days, and at least one night with no low BG alarms, before dropping BG</string>
<string name="objectives_5_objective">Adjust basals and ratios if needed, and then enable auto-sens</string>
<string name="objectives_5_gate">1 week successful daytime looping with regular carb entry</string>
<string name="objectives_6_objective">Enabling additional features for daytime use, such as advanced meal assist</string>
</resources>