From b42644de39929bf3e865f6048e091fe6eac0bc6f Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 4 Aug 2016 23:38:43 +0200 Subject: [PATCH] objectives finalization, some todos --- .idea/misc.xml | 2 +- app/build.gradle | 9 --- .../info/nightscout/androidaps/Config.java | 1 - .../info/nightscout/androidaps/MainApp.java | 2 +- .../plugins/DanaR/DanaRFragment.java | 2 - .../Objectives/ObjectivesFragment.java | 58 +++++++++++-------- .../receivers/KeepAliveReceiver.java | 2 +- .../main/res/layout/objectives_fragment.xml | 3 +- app/src/main/res/values-bg/strings.xml | 12 ++-- app/src/main/res/values-cs/strings.xml | 23 ++++++-- app/src/main/res/values-de/strings.xml | 8 +-- app/src/main/res/values/strings.xml | 21 +++++-- 12 files changed, 85 insertions(+), 58 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index fbb68289f4..5d19981032 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -37,7 +37,7 @@ - + diff --git a/app/build.gradle b/app/build.gradle index 8cb1da059d..9a0cf4ba5b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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" } } diff --git a/app/src/main/java/info/nightscout/androidaps/Config.java b/app/src/main/java/info/nightscout/androidaps/Config.java index d453d1af8f..90d4c56199 100644 --- a/app/src/main/java/info/nightscout/androidaps/Config.java +++ b/app/src/main/java/info/nightscout/androidaps/Config.java @@ -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; diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index f7d78758b4..fd18f01c19 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -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()); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRFragment.java index 89b819ec46..e6bc68bfab 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRFragment.java @@ -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; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Objectives/ObjectivesFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Objectives/ObjectivesFragment.java index a663d4f3a0..3e05ccdaf0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Objectives/ObjectivesFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Objectives/ObjectivesFragment.java @@ -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; diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java index feb78b1589..663196bced 100644 --- a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java +++ b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java @@ -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(); diff --git a/app/src/main/res/layout/objectives_fragment.xml b/app/src/main/res/layout/objectives_fragment.xml index c28805aac8..0af18aa142 100644 --- a/app/src/main/res/layout/objectives_fragment.xml +++ b/app/src/main/res/layout/objectives_fragment.xml @@ -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" /> APS режим Ср. изменение Базал - КЗ достъпна в NS + КЗ достъпна в NS Болус Приложено ограничение на болус Откажи @@ -74,9 +74,9 @@ Loop отказан от ограниченията Low Suspend Граница за ниска КЗ - Manual enacts + Manual enacts Low projected - Минимална продължителност + Минимална продължителност Архивиране Изход Опции @@ -124,7 +124,7 @@ % (100% = current) Болус NS профил - Статус на помпа в NS + Статус на помпа в NS Стойност Основание Искате ли да обновите treatments от Nightscout @@ -220,7 +220,7 @@ End User License Agreement 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. +XXXXXXXXXX;+YYYYYYYYYY - Болус %.2fU беше доставен успешно + Болус %.2fU беше доставен успешно Болусът не е доставен Откажи временен базал Последно свързване: @@ -229,7 +229,7 @@ Позволени телефонни номера Разреши болус чрез SMS Успех - За да доставите болус %.2fU отговорете с код %s + За да доставите болус %.2fU отговорете с код %s Отдалечен болус не е разрешен Обнови профила Процент diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index dde2b6e86a..a04e3843f0 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -6,7 +6,7 @@ Typ smyčky Prům. změna Bazál - Glykémie dostupná v NS + Glykémie dostupná v NS Bolus Aplikováno omezení bolusu Zrušit @@ -74,10 +74,10 @@ SMYČKA ZAKÁZÁNA OMEZENÍM Low Suspend Hodnota nízké glykémie - Ručně spuštěno + Ručně spuštěno Předpokládaná nízká glykémie m zpět - Minimální trvání + Minimální trvání Záloha Ukončit Nastavení @@ -125,7 +125,7 @@ % (100% = současný) Bolus NS profil - Stav pumpy dostupný v NS + Stav pumpy dostupný v NS Hodnota Zdůvodnění Opravdu aktualizovat ošetření z NS @@ -277,7 +277,7 @@ Nahrávám Pumpa je zaneprázdněna Špatné heslo k pumpě - + MM 640g Heslo k pumpě (pouze verze 2016) Okluze Podáno @@ -286,4 +286,17 @@ STISKNUTO STOP Čekání na pumpu Podávání %.2fU inzulínu + Zkontrolovat, zda jsou glykémie a údaje z pumpy viditelné v Nightscoutu + Nastavit vizualizaci a monitoring, analyzovat bazály a koeficienty + Provozovat několik dní otevřenou smyčku a ručně potrvrzovat doporučené dočasné bazály + Začít s otevřenou smyčkou + 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 + Porozumět otevřené smyčce a doporučeným dočasným bazálům + Spustit uzavřenou smyčku s max IOB = 0 na několik dní s minimem nutných korekcí na nízkou glykémii + Začít uzavřenou smyčku pouze s hlídáním nizké glykémie + Provozovat smyčku několik dní s alespoň jednou nocí bez alarmů na nízkou glykémii + Zapnout uzavřenou smyčku, zvyšovat max IOB nad 0 a snižovat cílovou glykémii + Jeden týden úspěšného používání s běžným příjmem sacharidů + Upravit bazály a koeficinty, když bude potřeba a povolit automatickou detekci citlivosti na inzulín + Povolit další fukce pro běžné používání jako AMA \ No newline at end of file diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index e99b9645da..39b91736c7 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -2,7 +2,7 @@ AndroidAPS APS Modus - BZ verfügbar in NS + BZ verfügbar in NS Abbrechen Kohlehydrate Careportal @@ -121,7 +121,7 @@ Akzeptiere neue temp Basalrate: Benutze extended Bolus für hohe temps (\>200%)> Möchtest du die Treatments von Nightscout abrufen - Pumpen Status verfügbar in NS + Pumpen Status verfügbar in NS % (100% = current) Basal Wert Extended Bolus @@ -179,10 +179,10 @@ LOW: Temp basal 0% Low projected LOW PROJECTED: Temp basal 0% - Manual enacts + Manual enacts Carbs constraint applied Reset Datenbanken - Minimale Dauer + Minimale Dauer min ago Erneure treatments von NS Exit diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ef607d4123..403dfef6fd 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -101,7 +101,7 @@ APS General days - Minimal duration + Minimal duration Constraints Loop @@ -142,9 +142,9 @@ New suggestion available Unsupported version of NSClient NSClient not installed. Record lost! - BG available in NS - Pump status available in NS - Manual enacts + BG available in NS + Pump status available in NS + Manual enacts LOOP DISABLED BY CONSTRAINTS Czech English @@ -295,5 +295,18 @@ STOP PRESSED Waiting for pump Going to deliver %.2fU + Setting up visualization and monitoring, and analyzing basals and ratios + Verify that BG is available in Nightscout, and pump insulin data is being uploaded + Starting on an open loop + Run in Open Loop mode for a few days, and manually enact lots of temp basals + 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 + 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 + 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 + Adjust basals and ratios if needed, and then enable auto-sens + 1 week successful daytime looping with regular carb entry + Enabling additional features for daytime use, such as advanced meal assist