From 668008e1c1dd6100e247517a990e2e97aafea8d3 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 31 Jul 2017 19:53:09 +0200 Subject: [PATCH 01/18] cancel current temp before activating superbolus --- .../androidaps/plugins/Overview/Dialogs/WizardDialog.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java index 5d57f3caf1..085312893c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java @@ -313,6 +313,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com activeloop.superBolusTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000); MainApp.bus().post(new EventRefreshOverview("WizardDialog")); } + pump.cancelTempBasal(); result = pump.setTempBasalAbsolute(0d, 120); if (!result.success) { OKDialog.show(getActivity(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror), result.comment, null); From 6f9f72d84939db5bf3b0ff87f31f48b2d51a498f Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 1 Aug 2017 17:21:32 +0200 Subject: [PATCH 02/18] remove notes from temp basal upload --- app/src/main/java/info/nightscout/utils/NSUpload.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/info/nightscout/utils/NSUpload.java b/app/src/main/java/info/nightscout/utils/NSUpload.java index 4fa5a0d5e2..ac9d636bab 100644 --- a/app/src/main/java/info/nightscout/utils/NSUpload.java +++ b/app/src/main/java/info/nightscout/utils/NSUpload.java @@ -49,7 +49,7 @@ public class NSUpload { data.put("pumpId", temporaryBasal.pumpId); data.put("created_at", DateUtil.toISOString(temporaryBasal.date)); data.put("enteredBy", "openaps://" + MainApp.instance().getString(R.string.app_name)); - data.put("notes", MainApp.sResources.getString(R.string.androidaps_tempbasalstartnote) + " " + temporaryBasal.absoluteRate + "u/h " + temporaryBasal.durationInMinutes + " min"); // ECOR + //data.put("notes", MainApp.sResources.getString(R.string.androidaps_tempbasalstartnote) + " " + temporaryBasal.absoluteRate + "u/h " + temporaryBasal.durationInMinutes + " min"); // ECOR if (originalExtendedAmount != null) data.put("originalExtendedAmount", originalExtendedAmount); // for back synchronization Bundle bundle = new Bundle(); @@ -88,7 +88,7 @@ public class NSUpload { data.put("pumpId", temporaryBasal.pumpId); data.put("created_at", DateUtil.toISOString(temporaryBasal.date)); data.put("enteredBy", "openaps://" + MainApp.instance().getString(R.string.app_name)); - data.put("notes", MainApp.sResources.getString(R.string.androidaps_tempbasalstartnote) + " " + temporaryBasal.percentRate + "% " + temporaryBasal.durationInMinutes + " min"); // ECOR + //data.put("notes", MainApp.sResources.getString(R.string.androidaps_tempbasalstartnote) + " " + temporaryBasal.percentRate + "% " + temporaryBasal.durationInMinutes + " min"); // ECOR Bundle bundle = new Bundle(); bundle.putString("action", "dbAdd"); bundle.putString("collection", "treatments"); @@ -111,7 +111,7 @@ public class NSUpload { data.put("eventType", CareportalEvent.TEMPBASAL); data.put("created_at", DateUtil.toISOString(time)); data.put("enteredBy", "openaps://" + MainApp.instance().getString(R.string.app_name)); - data.put("notes", MainApp.sResources.getString(R.string.androidaps_tempbasalendnote)); // ECOR + //data.put("notes", MainApp.sResources.getString(R.string.androidaps_tempbasalendnote)); // ECOR if (isFakedTempBasal) data.put("isFakedTempBasal", isFakedTempBasal); if (pumpId != 0) From 6828e11dd98d688c9bf74fc9331c9a17acca3f53 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 1 Aug 2017 17:25:43 +0200 Subject: [PATCH 03/18] remove notes strings as well --- app/src/main/java/info/nightscout/utils/NSUpload.java | 3 --- app/src/main/res/values-bg/strings.xml | 2 -- app/src/main/res/values-cs/strings.xml | 2 -- app/src/main/res/values-de/strings.xml | 2 -- app/src/main/res/values-es/strings.xml | 2 -- app/src/main/res/values-ko/strings.xml | 2 -- app/src/main/res/values-ru/strings.xml | 2 -- app/src/main/res/values/strings.xml | 2 -- 8 files changed, 17 deletions(-) diff --git a/app/src/main/java/info/nightscout/utils/NSUpload.java b/app/src/main/java/info/nightscout/utils/NSUpload.java index ac9d636bab..aeb1f7181d 100644 --- a/app/src/main/java/info/nightscout/utils/NSUpload.java +++ b/app/src/main/java/info/nightscout/utils/NSUpload.java @@ -49,7 +49,6 @@ public class NSUpload { data.put("pumpId", temporaryBasal.pumpId); data.put("created_at", DateUtil.toISOString(temporaryBasal.date)); data.put("enteredBy", "openaps://" + MainApp.instance().getString(R.string.app_name)); - //data.put("notes", MainApp.sResources.getString(R.string.androidaps_tempbasalstartnote) + " " + temporaryBasal.absoluteRate + "u/h " + temporaryBasal.durationInMinutes + " min"); // ECOR if (originalExtendedAmount != null) data.put("originalExtendedAmount", originalExtendedAmount); // for back synchronization Bundle bundle = new Bundle(); @@ -88,7 +87,6 @@ public class NSUpload { data.put("pumpId", temporaryBasal.pumpId); data.put("created_at", DateUtil.toISOString(temporaryBasal.date)); data.put("enteredBy", "openaps://" + MainApp.instance().getString(R.string.app_name)); - //data.put("notes", MainApp.sResources.getString(R.string.androidaps_tempbasalstartnote) + " " + temporaryBasal.percentRate + "% " + temporaryBasal.durationInMinutes + " min"); // ECOR Bundle bundle = new Bundle(); bundle.putString("action", "dbAdd"); bundle.putString("collection", "treatments"); @@ -111,7 +109,6 @@ public class NSUpload { data.put("eventType", CareportalEvent.TEMPBASAL); data.put("created_at", DateUtil.toISOString(time)); data.put("enteredBy", "openaps://" + MainApp.instance().getString(R.string.app_name)); - //data.put("notes", MainApp.sResources.getString(R.string.androidaps_tempbasalendnote)); // ECOR if (isFakedTempBasal) data.put("isFakedTempBasal", isFakedTempBasal); if (pumpId != 0) diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index 460e57d226..db3990a054 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -374,8 +374,6 @@ Редактирай Инс./ВХ Базов профил: Процентен профил - край на временен базал - Старт на временен базал Диапазон за визуализация Стойност на линиите за ниска и висока КЗ (mmol/l) за телефона и часовника Ниска КЗ под diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 9dfb85f9a4..d8a82d0fd8 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -313,8 +313,6 @@ Korekce Akce AndroidAPS restartován - Dočasný bazál konec - Dočasný bazál začátek Prosím restartujte Váš telefon nebo restartujte AndroidAPS z nastavení systému jinak nebudou zaznamenány ladící informace (důležité pro sledování a kontrolu, zda algoritmus pracuje správně) Bazální profil: Baterie v pumpě vybitá diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 6fa152a194..a9a9218a5f 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -286,7 +286,6 @@ Basalrate: Basisprofil: Pumpenbatterie entladen - Basal Temp Ende neu laden Hoch Markierung Niedrig Markierung @@ -332,7 +331,6 @@ Bitte starte dein Telefon neu oder starte AndroidAPS in den System-Einstellungen neu. Anderenfalls hat AndroidAPS kein logging (wichtig zum Nachverfolgen und Verifizieren, dass der Algorithmus korrekt funktioniert) Immer das kurze Durchschnitts-Delta statt dem einfachen Delta verwenden Sinnvoll, wenn die Daten von einer ungefilterten Quelle Signalrauschen haben. - Basal Temp Anfang Tagesinsulin-Limit wird erreicht. BR Kalibrierung an xDrip gesendet diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index cb011f510e..ea27778ca7 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -332,8 +332,6 @@ Comando desconocido o respuesta incorrecta ¡Por favor asegurar que la cantidad coincide con la especificación del set de infusión! Para iniciar basal %.2fU/h responder con código %s - Inicio Basal Temporal - Fin Basal Temporal " " " " " " diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index be4ded3526..c8fe48a2eb 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -358,8 +358,6 @@ Edit Base-IC: Base Profile: CircadianPercentageProfile - Basal Temp End - Basal Temp Start 차트 표시 범위 Overview/스마트워치 차트 표시용 고/저혈당 선 저혈당 선 diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 7f797ea3a5..e92c1aa7c9 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -12,8 +12,6 @@ всегда используйте укороченное среднее приращение вместо простого AndroidAPS запущен полезно когда данные из нефильтруемых источников вроде Xdrip зашумляются - конец действия временного базала - начало действия временного базала приближается суточный лимит инсулина режим APS массив %d элементов. актуальная величина: diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8fe3621541..de56d5ee1d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -375,8 +375,6 @@ Edit Base-IC: Base Profile: CircadianPercentageProfile - Basal Temp End - Basal Temp Start Range for Visualization High and low mark for the charts in Overview and Smartwatch LOW mark From a24cbfda500aaead3a049571b2d55432902336ae Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 1 Aug 2017 17:37:32 +0200 Subject: [PATCH 04/18] Disconnect pump: cancel temp before setting new to make sure it will last as expected --- .../androidaps/plugins/Overview/OverviewFragment.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java index 71f205551e..94472ce9f4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java @@ -506,6 +506,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, sHandler.post(new Runnable() { @Override public void run() { + MainApp.getConfigBuilder().cancelTempBasal(); PumpEnactResult result = MainApp.getConfigBuilder().setTempBasalAbsolute(0d, 30); if (!result.success) { ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror)); @@ -520,6 +521,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, sHandler.post(new Runnable() { @Override public void run() { + MainApp.getConfigBuilder().cancelTempBasal(); PumpEnactResult result = MainApp.getConfigBuilder().setTempBasalAbsolute(0d, 60); if (!result.success) { ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror)); @@ -534,6 +536,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, sHandler.post(new Runnable() { @Override public void run() { + MainApp.getConfigBuilder().cancelTempBasal(); PumpEnactResult result = MainApp.getConfigBuilder().setTempBasalAbsolute(0d, 2 * 60); if (!result.success) { ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror)); @@ -548,6 +551,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, sHandler.post(new Runnable() { @Override public void run() { + MainApp.getConfigBuilder().cancelTempBasal(); PumpEnactResult result = MainApp.getConfigBuilder().setTempBasalAbsolute(0d, 3 * 60); if (!result.success) { ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror)); From d2a5939ce327633cd5cd958f1d379b54d1b2b930 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 1 Aug 2017 17:53:28 +0200 Subject: [PATCH 05/18] fix virtual pump crash --- .../plugins/PumpVirtual/VirtualPumpFragment.java | 15 ++++++++++----- .../plugins/PumpVirtual/VirtualPumpPlugin.java | 6 +++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpFragment.java index 2dfaefe482..47dcbd4d96 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpFragment.java @@ -57,7 +57,6 @@ public class VirtualPumpFragment extends SubscriberFragment { batteryView = (TextView) view.findViewById(R.id.virtualpump_battery); reservoirView = (TextView) view.findViewById(R.id.virtualpump_reservoir); - updateGUI(); return view; } @@ -66,6 +65,12 @@ public class VirtualPumpFragment extends SubscriberFragment { updateGUI(); } + @Override + public void onResume() { + super.onResume(); + updateGUI(); + } + @Override protected void updateGUI() { Activity activity = getActivity(); @@ -73,8 +78,8 @@ public class VirtualPumpFragment extends SubscriberFragment { activity.runOnUiThread(new Runnable() { @Override public void run() { - - basaBasalRateView.setText(VirtualPumpPlugin.getInstance().getBaseBasalRate() + "U"); + VirtualPumpPlugin virtualPump = VirtualPumpPlugin.getInstance(); + basaBasalRateView.setText(virtualPump.getBaseBasalRate() + "U"); if (MainApp.getConfigBuilder().isTempBasalInProgress()) { tempBasalView.setText(MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis()).toStringFull()); } else { @@ -85,8 +90,8 @@ public class VirtualPumpFragment extends SubscriberFragment { } else { extendedBolusView.setText(""); } - batteryView.setText(VirtualPumpPlugin.getInstance().batteryPercent + "%"); - reservoirView.setText(VirtualPumpPlugin.getInstance().reservoirInUnits + "U"); + batteryView.setText(virtualPump.batteryPercent + "%"); + reservoirView.setText(virtualPump.reservoirInUnits + "U"); } }); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java index b42d1abfd6..6f7a077416 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java @@ -204,7 +204,11 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface { @Override public double getBaseBasalRate() { - return MainApp.getConfigBuilder().getProfile().getBasal(); + Profile profile = MainApp.getConfigBuilder().getProfile(); + if (profile != null) + return profile.getBasal(); + else + return 0d; } @Override From 9596987b352b67d21e9d597b5d9cfd483dd4ed1a Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 1 Aug 2017 20:02:17 +0200 Subject: [PATCH 06/18] new temp basal dialog refactor --- .../Actions/dialogs/NewTempBasalDialog.java | 38 +-- .../PumpVirtual/VirtualPumpFragment.java | 6 - .../layout/overview_newtempbasal_dialog.xml | 294 +++++------------- app/src/main/res/values-bg/strings.xml | 3 +- app/src/main/res/values-cs/strings.xml | 3 +- app/src/main/res/values-de/strings.xml | 3 +- app/src/main/res/values-es/strings.xml | 3 +- app/src/main/res/values-it/strings.xml | 3 +- app/src/main/res/values-ko/strings.xml | 3 +- app/src/main/res/values-ru/strings.xml | 3 +- app/src/main/res/values/strings.xml | 5 +- 11 files changed, 108 insertions(+), 256 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewTempBasalDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewTempBasalDialog.java index 51effccb86..0a379a904d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewTempBasalDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewTempBasalDialog.java @@ -27,6 +27,7 @@ import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.interfaces.PumpDescription; import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.data.Profile; +import info.nightscout.utils.NumberPicker; import info.nightscout.utils.PlusMinusEditText; import info.nightscout.utils.SafeParse; @@ -35,14 +36,14 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi RadioButton percentRadio; RadioButton absoluteRadio; RadioGroup basalTypeRadioGroup; - RelativeLayout typeSelectorLayout; + LinearLayout typeSelectorLayout; LinearLayout percentLayout; LinearLayout absoluteLayout; - PlusMinusEditText basalPercent; - PlusMinusEditText basalAbsolute; - PlusMinusEditText duration; + NumberPicker basalPercent; + NumberPicker basalAbsolute; + NumberPicker duration; Handler mHandler; public static HandlerThread mHandlerThread; @@ -65,22 +66,24 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi percentRadio = (RadioButton) view.findViewById(R.id.overview_newtempbasal_percent_radio); basalTypeRadioGroup = (RadioGroup) view.findViewById(R.id.overview_newtempbasal_radiogroup); absoluteRadio = (RadioButton) view.findViewById(R.id.overview_newtempbasal_absolute_radio); - typeSelectorLayout = (RelativeLayout) view.findViewById(R.id.overview_newtempbasal_typeselector_layout); + typeSelectorLayout = (LinearLayout) view.findViewById(R.id.overview_newtempbasal_typeselector_layout); PumpDescription pumpDescription = MainApp.getConfigBuilder().getPumpDescription(); - basalPercent = new PlusMinusEditText(view, R.id.overview_newtempbasal_basalpercentinput, R.id.overview_newtempbasal_basalpercent_plus, R.id.overview_newtempbasal_basalpercent_minus, - 100d, 0d, (double) pumpDescription.maxTempPercent, (double) pumpDescription.tempPercentStep, new DecimalFormat("0"), true); + basalPercent = (NumberPicker) view.findViewById(R.id.overview_newtempbasal_basalpercentinput); + double maxTempPercent = pumpDescription.maxTempPercent; + double tempPercentStep = pumpDescription.tempPercentStep; + basalPercent.setParams(100d, 0d, maxTempPercent, tempPercentStep, new DecimalFormat("0"), true); Profile profile = MainApp.getConfigBuilder().getProfile(); - Double currentBasal = profile.getBasal(); - basalAbsolute = new PlusMinusEditText(view, R.id.overview_newtempbasal_basalabsoluteinput, R.id.overview_newtempbasal_basalabsolute_plus, R.id.overview_newtempbasal_basalabsolute_minus, - currentBasal, 0d, pumpDescription.maxTempAbsolute, pumpDescription.tempAbsoluteStep, new DecimalFormat("0.00"), true); + Double currentBasal = profile != null ? profile.getBasal() : 0d; + basalAbsolute = (NumberPicker) view.findViewById(R.id.overview_newtempbasal_basalabsoluteinput); + basalAbsolute.setParams(currentBasal, 0d, pumpDescription.maxTempAbsolute, pumpDescription.tempAbsoluteStep, new DecimalFormat("0.00"), true); - double tempDurationStep = MainApp.getConfigBuilder().getPumpDescription().tempDurationStep; - double tempMaxDuration = MainApp.getConfigBuilder().getPumpDescription().tempMaxDuration; - duration = new PlusMinusEditText(view, R.id.overview_newtempbasal_duration, R.id.overview_newtempbasal_duration_plus, R.id.overview_newtempbasal_duration_minus, - tempDurationStep, tempDurationStep, tempMaxDuration, tempDurationStep, new DecimalFormat("0"), false); + double tempDurationStep = pumpDescription.tempDurationStep; + double tempMaxDuration = pumpDescription.tempMaxDuration; + duration = (NumberPicker) view.findViewById(R.id.overview_newtempbasal_duration); + duration.setParams(tempDurationStep, tempDurationStep, tempMaxDuration, tempDurationStep, new DecimalFormat("0"), false); if ((pumpDescription.tempBasalStyle & PumpDescription.PERCENT) == PumpDescription.PERCENT && (pumpDescription.tempBasalStyle & PumpDescription.ABSOLUTE) == PumpDescription.ABSOLUTE) { // Both allowed @@ -107,13 +110,6 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi return view; } - @Override - public void onResume() { - super.onResume(); - if (getDialog() != null) - getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); - } - @Override public void onClick(View view) { switch (view.getId()) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpFragment.java index 47dcbd4d96..b479183b80 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpFragment.java @@ -65,12 +65,6 @@ public class VirtualPumpFragment extends SubscriberFragment { updateGUI(); } - @Override - public void onResume() { - super.onResume(); - updateGUI(); - } - @Override protected void updateGUI() { Activity activity = getActivity(); diff --git a/app/src/main/res/layout/overview_newtempbasal_dialog.xml b/app/src/main/res/layout/overview_newtempbasal_dialog.xml index 04caae43f4..48c20b6809 100644 --- a/app/src/main/res/layout/overview_newtempbasal_dialog.xml +++ b/app/src/main/res/layout/overview_newtempbasal_dialog.xml @@ -12,266 +12,134 @@ android:layout_height="match_parent"> - + + + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:orientation="vertical"> + android:text="@string/overview_newtempbasal_percent_label" /> + - + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_marginTop="15dp" + android:text="@string/overview_newtempbasal_basalpercent" + android:textAppearance="@android:style/TextAppearance.Material.Small" + android:textStyle="bold" /> - + + + + + - - + - + - + - + - - - - - - - + diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index db3990a054..6dafb4cc29 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -114,7 +114,7 @@ Нарушено ограничение Грешка при подаване на болус Грешка при подаване на временен базал - Стойност на базал + Стойност на базал [%] % (100% = текущ) Приложи нов временен базал: Болус @@ -183,7 +183,6 @@ Продължителност Процент Абсолютна - мин Бележки Време на събитие Профил diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index d8a82d0fd8..7b94e05597 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -26,7 +26,6 @@ Sacharidy Čas jídla Trvání - min Zadal Čas Inzulín @@ -116,7 +115,7 @@ Dostupné nové doporučení Přehled Kalkulačka - Hodnota bazálu + Hodnota bazálu [%] % (100% = současný) Bolus NS profil diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index a9a9218a5f..b4ece1b1ca 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -33,7 +33,6 @@ CGM Sensor Start Absolut Kohlehydrate - min Insulin Glukose-Art Ereignis-Typ @@ -119,7 +118,7 @@ Benutze extended Bolus für hohe temps (\>200%)> Pumpen Status verfügbar in NS % (100% = current) - Basal Wert + Basal Wert [%] Extended Bolus Übersicht Neue Empfehlung verfügbar diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index ea27778ca7..2cbba6a3ff 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -108,7 +108,7 @@ Plugin está desactivado Violación restricciones Error de administración del bolo - Valor basal + Valor basal [%] % (100% = actual) Aceptar nueva basal temporal: Bolo @@ -170,7 +170,6 @@ Duración Dosis Absoluto - min Notas Fecha Hora Perfil diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 48cd17b8a1..39d6a7ff6c 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -47,7 +47,6 @@ Tipo di glucosio Insulina Glucometro - Minimo Note Altro Percentuale @@ -310,7 +309,7 @@ Valido: Aggiungere Bolo Esteso - Valore Basale + Valore Basale [%] Uscire Eliminare HOME diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index c8fe48a2eb..1e62068262 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -108,7 +108,7 @@ 제한 위반 식사주입 전송 에러 Tempbasal delivery error - 기초주입 값 + 기초주입 값 [%] % (100% = 현재) 새 임시기초주입 적용: 식사주입 @@ -171,7 +171,6 @@ Duration Percent Absolute - min Notes Event time Profile diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index e92c1aa7c9..f9fb00677d 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -60,7 +60,6 @@ тип глюкозы инсулин глюкометр - минут заметки другое процент @@ -387,7 +386,7 @@ использовать до: добавить расширенный болюс - величина базала + величина базала % (100% = current) редактировать удалить diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index de56d5ee1d..1f0c0a1ddd 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -114,7 +114,7 @@ Constraints violation Bolus delivery error Tempbasal delivery error - Basal value + Basal value [%] % (100% = current) Accept new temp basal: Bolus @@ -183,7 +183,6 @@ Duration Percent Absolute - min Notes Event time Profile @@ -691,5 +690,7 @@ CARBS & BOLUS CGM & OPENAPS PUMP + Basal value [U/h] + Duration [min] From 34d4bec556baebcd5add7543c4b15a5b094d482b Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 1 Aug 2017 20:45:57 +0200 Subject: [PATCH 07/18] move cancel temp to actions --- .../plugins/Actions/ActionsFragment.java | 56 ++++++++++++++----- .../plugins/Overview/OverviewFragment.java | 13 ----- app/src/main/res/layout/actions_fragment.xml | 13 +++++ app/src/main/res/layout/overview_fragment.xml | 14 ----- 4 files changed, 56 insertions(+), 40 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java index b62674c5ae..5a8b7017fa 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java @@ -20,6 +20,7 @@ import info.nightscout.androidaps.Config; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.db.ExtendedBolus; +import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.events.EventExtendedBolusChange; import info.nightscout.androidaps.events.EventInitializationChanged; import info.nightscout.androidaps.events.EventRefreshOverview; @@ -49,6 +50,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL Button extendedBolus; Button extendedBolusCancel; Button tempBasal; + Button tempBasalCancel; Button fill; private static Handler sHandler; @@ -74,6 +76,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL extendedBolus = (Button) view.findViewById(R.id.actions_extendedbolus); extendedBolusCancel = (Button) view.findViewById(R.id.actions_extendedbolus_cancel); tempBasal = (Button) view.findViewById(R.id.actions_settempbasal); + tempBasalCancel = (Button) view.findViewById(R.id.actions_canceltempbasal); fill = (Button) view.findViewById(R.id.actions_fill); profileSwitch.setOnClickListener(this); @@ -81,6 +84,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL extendedBolus.setOnClickListener(this); extendedBolusCancel.setOnClickListener(this); tempBasal.setOnClickListener(this); + tempBasalCancel.setOnClickListener(this); fill.setOnClickListener(this); updateGUI(); @@ -114,33 +118,59 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL activity.runOnUiThread(new Runnable() { @Override public void run() { - if (MainApp.getConfigBuilder().getActiveProfileInterface().getProfile() == null) + if (MainApp.getConfigBuilder().getActiveProfileInterface().getProfile() == null) { + tempTarget.setVisibility(View.GONE); + profileSwitch.setVisibility(View.GONE); + extendedBolus.setVisibility(View.GONE); + extendedBolusCancel.setVisibility(View.GONE); + tempBasal.setVisibility(View.GONE); + tempBasalCancel.setVisibility(View.GONE); + fill.setVisibility(View.GONE); return; + } boolean allowProfileSwitch = MainApp.getConfigBuilder().getActiveProfileInterface().getProfile().getProfileList().size() > 1; if (!MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !allowProfileSwitch) profileSwitch.setVisibility(View.GONE); else profileSwitch.setVisibility(View.VISIBLE); - if (!MainApp.getConfigBuilder().getPumpDescription().isExtendedBolusCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress() || MainApp.getConfigBuilder().isFakingTempsByExtendedBoluses()) + + + if (!MainApp.getConfigBuilder().getPumpDescription().isExtendedBolusCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || MainApp.getConfigBuilder().isFakingTempsByExtendedBoluses()) { extendedBolus.setVisibility(View.GONE); - else { - extendedBolus.setVisibility(View.VISIBLE); - } - if (!MainApp.getConfigBuilder().getPumpDescription().isExtendedBolusCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress() || MainApp.getConfigBuilder().isFakingTempsByExtendedBoluses()) extendedBolusCancel.setVisibility(View.GONE); - else { - extendedBolusCancel.setVisibility(View.VISIBLE); - ExtendedBolus running = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis()); - extendedBolusCancel.setText(MainApp.instance().getString(R.string.cancel) + " " + running.toString()); + } else { + if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) { + extendedBolus.setVisibility(View.GONE); + extendedBolusCancel.setVisibility(View.VISIBLE); + ExtendedBolus running = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis()); + extendedBolusCancel.setText(MainApp.instance().getString(R.string.cancel) + " " + running.toString()); + } else { + extendedBolus.setVisibility(View.VISIBLE); + extendedBolusCancel.setVisibility(View.GONE); + } } - if (!MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || MainApp.getConfigBuilder().isTempBasalInProgress()) + + + if (!MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended()) { tempBasal.setVisibility(View.GONE); - else - tempBasal.setVisibility(View.VISIBLE); + tempBasalCancel.setVisibility(View.GONE); + } else { + if (MainApp.getConfigBuilder().isTempBasalInProgress()) { + tempBasal.setVisibility(View.GONE); + tempBasalCancel.setVisibility(View.VISIBLE); + final TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis()); + tempBasalCancel.setText(MainApp.instance().getString(R.string.cancel) + "\n" + activeTemp.toStringShort()); + } else { + tempBasal.setVisibility(View.VISIBLE); + tempBasalCancel.setVisibility(View.GONE); + } + } + if (!MainApp.getConfigBuilder().getPumpDescription().isRefillingCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended()) fill.setVisibility(View.GONE); else fill.setVisibility(View.VISIBLE); + if (!Config.APS) tempTarget.setVisibility(View.GONE); else diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java index 94472ce9f4..a5b7e9edca 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java @@ -175,7 +175,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, LinearLayoutManager llm; LinearLayout acceptTempLayout; - Button cancelTempButton; Button treatmentButton; Button wizardButton; Button calibrationButton; @@ -269,9 +268,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, bgGraph = (GraphView) view.findViewById(R.id.overview_bggraph); iobGraph = (GraphView) view.findViewById(R.id.overview_iobgraph); - cancelTempButton = (Button) view.findViewById(R.id.overview_canceltempbutton); - if (cancelTempButton != null) - cancelTempButton.setOnClickListener(this); treatmentButton = (Button) view.findViewById(R.id.overview_treatmentbutton); treatmentButton.setOnClickListener(this); wizardButton = (Button) view.findViewById(R.id.overview_wizardbutton); @@ -1020,15 +1016,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, } final TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis()); - if (cancelTempButton != null) { - if (activeTemp != null) { - cancelTempButton.setVisibility(View.VISIBLE); - cancelTempButton.setText(MainApp.instance().getString(R.string.cancel) + "\n" + activeTemp.toStringShort()); - } else { - cancelTempButton.setVisibility(View.GONE); - } - } - String basalText = ""; if (shorttextmode) { if (activeTemp != null) { diff --git a/app/src/main/res/layout/actions_fragment.xml b/app/src/main/res/layout/actions_fragment.xml index e24f69124d..bc8f416770 100644 --- a/app/src/main/res/layout/actions_fragment.xml +++ b/app/src/main/res/layout/actions_fragment.xml @@ -52,6 +52,19 @@ android:drawableTop="@drawable/icon_actions_starttempbasal" android:text="@string/overview_tempbasal_button" /> +