From 71db7b60c99c95d4f6bc852d3f4a99f57853eb7a Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Thu, 3 May 2018 20:48:50 +0200 Subject: [PATCH 01/21] ecarb first activity --- .../interaction/actions/ECarbActivity.java | 134 ++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.java diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.java new file mode 100644 index 0000000000..5871059de4 --- /dev/null +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.java @@ -0,0 +1,134 @@ +package info.nightscout.androidaps.interaction.actions; + + +import android.content.res.Resources; +import android.os.Bundle; +import android.support.wearable.view.DotsPageIndicator; +import android.support.wearable.view.GridPagerAdapter; +import android.support.wearable.view.GridViewPager; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; + +import java.text.DecimalFormat; + +import info.nightscout.androidaps.R; +import info.nightscout.androidaps.data.ListenerService; +import info.nightscout.androidaps.interaction.utils.PlusMinusEditText; +import info.nightscout.androidaps.interaction.utils.SafeParse; + +/** + * Created by adrian on 04/08/18. + */ + + +public class ECarbActivity extends ViewSelectorActivity { + + PlusMinusEditText editCarbs; + PlusMinusEditText editStartTime; + PlusMinusEditText editDuration; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.grid_layout); + final Resources res = getResources(); + final GridViewPager pager = (GridViewPager) findViewById(R.id.pager); + + pager.setAdapter(new MyGridViewPagerAdapter()); + DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator); + dotsPageIndicator.setPager(pager); + } + + + @Override + protected void onPause() { + super.onPause(); + finish(); + } + + + private class MyGridViewPagerAdapter extends GridPagerAdapter { + @Override + public int getColumnCount(int arg0) { + return 4; + } + + @Override + public int getRowCount() { + return 1; + } + + @Override + public Object instantiateItem(ViewGroup container, int row, int col) { + + if(col == 0){ + final View view = getInflatedPlusMinusView(container); + double def = 0; + if (editCarbs != null){ + def = SafeParse.stringToDouble(editCarbs.editText.getText().toString()); + } + editCarbs = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 150d, 1d, new DecimalFormat("0"), true); + setLabelToPlusMinusView(view, "carbs"); + container.addView(view); + return view; + } else if(col == 1){ + final View view = getInflatedPlusMinusView(container); + double def = 0; + if (editStartTime != null){ + def = SafeParse.stringToDouble(editStartTime.editText.getText().toString()); + } + editStartTime = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 300d, 10d, new DecimalFormat("0"), true); + setLabelToPlusMinusView(view, "start [min]"); + container.addView(view); + return view; + } else if(col == 2){ + final View view = getInflatedPlusMinusView(container); + double def = 0; + if (editDuration != null){ + def = SafeParse.stringToDouble(editDuration.editText.getText().toString()); + } + editDuration = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 8d, 1d, new DecimalFormat("0"), false); + setLabelToPlusMinusView(view, "duration [h]"); + container.addView(view); + return view; + } else { + + final View view = LayoutInflater.from(getApplicationContext()).inflate(R.layout.action_send_item, container, false); + final ImageView confirmbutton = (ImageView) view.findViewById(R.id.confirmbutton); + confirmbutton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + //check if it can happen that the fagment is never created that hold data? + // (you have to swipe past them anyways - but still) + + String actionstring = "ecarbs " +SafeParse.stringToInt(editCarbs.editText.getText().toString()) + + " " + SafeParse.stringToInt(editStartTime.editText.getText().toString()) + + " " + SafeParse.stringToInt(editDuration.editText.getText().toString()); + ListenerService.initiateAction(ECarbActivity.this, actionstring); + finish(); + } + }); + container.addView(view); + return view; + } + } + + @Override + public void destroyItem(ViewGroup container, int row, int col, Object view) { + // Handle this to get the data before the view is destroyed? + // Object should still be kept by this, just setup for reinit? + container.removeView((View)view); + } + + @Override + public boolean isViewFromObject(View view, Object object) { + return view==object; + } + + + } +} \ No newline at end of file From 76277d11ad5363dfc499a7a8a0b6b9c0bc68ac71 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Thu, 3 May 2018 20:49:40 +0200 Subject: [PATCH 02/21] ecarb hang in activity --- .../androidaps/interaction/menus/MainMenuActivity.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/menus/MainMenuActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/menus/MainMenuActivity.java index da627f93ab..fb8bb61e20 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/menus/MainMenuActivity.java +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/menus/MainMenuActivity.java @@ -7,10 +7,10 @@ import android.preference.PreferenceManager; import java.util.Vector; -import info.nightscout.androidaps.BuildConfig; import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.interaction.AAPSPreferences; import info.nightscout.androidaps.interaction.actions.BolusActivity; +import info.nightscout.androidaps.interaction.actions.ECarbActivity; import info.nightscout.androidaps.interaction.actions.TempTargetActivity; import info.nightscout.androidaps.interaction.utils.MenuListActivity; import info.nightscout.androidaps.interaction.actions.WizardActivity; @@ -47,6 +47,7 @@ public class MainMenuActivity extends MenuListActivity { Vector menuitems = new Vector(); menuitems.add("TempT"); if(showWizard) menuitems.add("Wizard"); + menuitems.add("eCarb"); menuitems.add("Bolus"); menuitems.add("Settings"); menuitems.add("Status"); @@ -86,6 +87,10 @@ public class MainMenuActivity extends MenuListActivity { intent = new Intent(this, FillMenuActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); this.startActivity(intent); - } + } else if ("eCarb".equals(action)) { + intent = new Intent(this, ECarbActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + this.startActivity(intent); + } } } From f2168ff36bb98ba820543de835e3df46a918a013 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Thu, 3 May 2018 20:50:35 +0200 Subject: [PATCH 03/21] ecarb hang in activity again --- wear/src/main/AndroidManifest.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wear/src/main/AndroidManifest.xml b/wear/src/main/AndroidManifest.xml index 32cf7a5d1d..01423985d0 100644 --- a/wear/src/main/AndroidManifest.xml +++ b/wear/src/main/AndroidManifest.xml @@ -208,6 +208,10 @@ android:name=".interaction.actions.FillActivity" android:label="Fill"> + + From c69a541b756822a3dbec6ff7b004098961c3df9b Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Thu, 3 May 2018 20:58:49 +0200 Subject: [PATCH 04/21] ecarb ash first response --- .../plugins/Wear/ActionStringHandler.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java index d64ee24a30..bc58f9e3f9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java @@ -326,6 +326,23 @@ public class ActionStringHandler { } } + } else if ("ecarbs".equals(act[0])) { + ////////////////////////////////////////////// ECARBS + int carbs = SafeParse.stringToInt(act[1]); + int starttime = SafeParse.stringToInt(act[2]); + int duration = SafeParse.stringToInt(act[3]); + long starttimestamp = System.currentTimeMillis() + starttime*60*1000; + Integer carbsAfterConstraints = MainApp.getConstraintChecker().applyCarbsConstraints(new Constraint<>(carbs)).value(); + rMessage += MainApp.gs(R.string.carbs) + ": " + carbsAfterConstraints + "g"; + rMessage += "\n" + MainApp.gs(R.string.time) + ": " + DateUtil.timeString(starttimestamp); + rMessage += "\n" + MainApp.gs(R.string.duration) + ": " + duration + "h"; + + + if ( (carbsAfterConstraints - carbs != 0)) { + rMessage += "\n" + MainApp.gs(R.string.constraintapllied); + } + rAction += "ecarbs " + carbsAfterConstraints + " " + starttimestamp + " " + duration; + } else return; From b05b300fafbacc952095f310cd5812a299972fc4 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Thu, 3 May 2018 21:39:57 +0200 Subject: [PATCH 05/21] ecarb duration format --- .../androidaps/interaction/actions/ECarbActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.java index 5871059de4..a598a39c2c 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.java +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.java @@ -80,7 +80,7 @@ public class ECarbActivity extends ViewSelectorActivity { if (editStartTime != null){ def = SafeParse.stringToDouble(editStartTime.editText.getText().toString()); } - editStartTime = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 300d, 10d, new DecimalFormat("0"), true); + editStartTime = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 300d, 15d, new DecimalFormat("0"), false); setLabelToPlusMinusView(view, "start [min]"); container.addView(view); return view; From 61f07da1a22adf0b9f8210b953ff935e73cf056f Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Thu, 3 May 2018 21:53:46 +0200 Subject: [PATCH 06/21] ecarb doECarb --- .../plugins/Wear/ActionStringHandler.java | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java index bc58f9e3f9..53998e0f90 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java @@ -1,7 +1,9 @@ package info.nightscout.androidaps.plugins.Wear; +import android.content.Intent; import android.os.HandlerThread; import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import java.text.DateFormat; import java.text.DecimalFormat; @@ -19,6 +21,7 @@ import info.nightscout.androidaps.R; import info.nightscout.androidaps.data.DetailedBolusInfo; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.db.BgReading; +import info.nightscout.androidaps.db.CareportalEvent; import info.nightscout.androidaps.db.DatabaseHelper; import info.nightscout.androidaps.db.ProfileSwitch; import info.nightscout.androidaps.db.Source; @@ -35,6 +38,7 @@ import info.nightscout.androidaps.plugins.IobCobCalculator.CobInfo; import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin; import info.nightscout.androidaps.plugins.Loop.APSResult; import info.nightscout.androidaps.plugins.Loop.LoopPlugin; +import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; @@ -52,6 +56,8 @@ import info.nightscout.utils.SP; import info.nightscout.utils.SafeParse; import info.nightscout.utils.ToastUtils; +import static info.nightscout.utils.DateUtil.now; + /** * Created by adrian on 09/02/17. */ @@ -608,12 +614,64 @@ public class ActionStringHandler { int timeshift = SafeParse.stringToInt(act[1]); int percentage = SafeParse.stringToInt(act[2]); setCPP(timeshift, percentage); + } else if ("ecarbs".equals(act[0])) { + int carbs = SafeParse.stringToInt(act[1]); + long starttime = SafeParse.stringToLong(act[2]); + int duration = SafeParse.stringToInt(act[3]); + + doECarbs(carbs, starttime, duration); } else if ("dismissoverviewnotification".equals(act[0])) { MainApp.bus().post(new EventDismissNotification(SafeParse.stringToInt(act[1]))); } lastBolusWizard = null; } + private static void doECarbs(int carbs, long time, int duration) { + if (carbs > 0) { + if (duration == 0) { + createCarb(carbs, time, "watch"); + } else { + long remainingCarbs = carbs; + int ticks = (duration * 4); //duration guaranteed to be integer greater zero + for (int i = 0; i < ticks; i++){ + long carbTime = time + i * 15 * 60 * 1000; + long smallCarbAmount = Math.round((1d * remainingCarbs) / (ticks-i)); //on last iteration (ticks-i) is 1 -> smallCarbAmount == remainingCarbs + remainingCarbs -= smallCarbAmount; + if (smallCarbAmount > 0) + createCarb(smallCarbAmount, carbTime, "watch eCarbs"); + } + } + } + } + + private static void createCarb(long carbs, long time, @Nullable String notes) { + DetailedBolusInfo carbInfo = new DetailedBolusInfo(); + carbInfo.date = time; + carbInfo.eventType = CareportalEvent.CARBCORRECTION; + carbInfo.carbs = carbs; + carbInfo.context = MainApp.instance(); + carbInfo.source = Source.USER; + carbInfo.notes = notes; + if (ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo && carbInfo.date <= now()) { + ConfigBuilderPlugin.getCommandQueue().bolus(carbInfo, new Callback() { + @Override + public void run() { + if (!result.success) { + Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class); + i.putExtra("soundid", R.raw.boluserror); + i.putExtra("status", result.comment); + i.putExtra("title", MainApp.gs(R.string.treatmentdeliveryerror)); + i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + MainApp.instance().startActivity(i); + } + } + }); + } else { + TreatmentsPlugin.getPlugin().addToHistoryTreatment(carbInfo); + } + } + + private static void setCPP(int timeshift, int percentage) { String msg = ""; From fb75346bcd62464251cb6c3c36fef713a4685577 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Thu, 3 May 2018 21:55:54 +0200 Subject: [PATCH 07/21] ecarb make settings consistent --- app/src/main/res/xml/pref_wear.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/xml/pref_wear.xml b/app/src/main/res/xml/pref_wear.xml index 46cbfd7e22..2c3c9f3435 100644 --- a/app/src/main/res/xml/pref_wear.xml +++ b/app/src/main/res/xml/pref_wear.xml @@ -54,7 +54,7 @@ android:key="wearplugin" android:title="@string/wear_display_settings"> From 8d6997f51973bd8195069f85dfe7f5a93f1ee482 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Thu, 3 May 2018 21:58:21 +0200 Subject: [PATCH 08/21] ecarb ignore 0 carbs --- .../androidaps/plugins/Wear/ActionStringHandler.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java index 53998e0f90..c147fef6b0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java @@ -347,6 +347,10 @@ public class ActionStringHandler { if ( (carbsAfterConstraints - carbs != 0)) { rMessage += "\n" + MainApp.gs(R.string.constraintapllied); } + if(carbsAfterConstraints <= 0){ + sendError("Carbs = 0! No action taken!"); + return; + } rAction += "ecarbs " + carbsAfterConstraints + " " + starttimestamp + " " + duration; } else return; From 52411f7afe6687775731fc8575ffc7fa9f31f9d4 Mon Sep 17 00:00:00 2001 From: Radoslav Radev Date: Thu, 3 May 2018 23:34:50 +0300 Subject: [PATCH 09/21] half of the Bulgarian translation --- app/src/main/res/values-bg/strings.xml | 73 ++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index 3929d73dfc..81a1589e47 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -682,4 +682,77 @@ Няма достатъчно инсулин в резервоара Празен Обнови + И + един + вддв + шжо + Добавяне на допълнителни функции за използване през деня, като SMB + Пълнене + Избран APS + Няма базални стойности за някои часове: %s + Предупреждение W31: Ниско ниво в резервоара + Предупреждение W32: Слаба батерия + Предупреждение W33: Невалидно време/дата + Предупреждение W34: Край на гаранцията + Предупреждение W36: Временният базал е прекъснат + Предупреждение W38: Болусът е прекъснат + Временният базал е зададен от помпата + Румънски + Френски + Китайски + Болусът е спрян + Спиране на болус + Хипоглекимия + Настройка на целевата КЗ чрез аутосенс + Възрастни с по-голяма инсулинова резистентност + OpenAPS SMB + SMB + Разреши UAM + Разреши SMB + Използвай супер микро болуси вместо временен базал за по бързо действие + Детекция на необявено хранене (UAM) + Продължителност на вр. цел при хипоглекимия + Временна цел при хипоглекимия + мин. + ч. + Максимални минути за ограничаване на базала от SMB + Програмиране на помпа за болус + Състояние + Активност + Няма връзка от %d мин. + %d%% (%d мин. остават) + Инициализация + Прекратен поради грешка + Прекратен от потребителя + Изпълнява + Отказва временен базал + Задава временен базал (%d%% / %d min) + Болус (%.1f U) + Обновява + Исканата операция не се поддържа от помпата + Опасно използване: удължени или многовълнови болуси са активни. Помпата е изключена за само 6 часа. Само нормални болуси се поддържат. + Опасно използване: помпата използва различни базални нива от първоначалния профил. Loop е спрян. Изберете първоначалния профил и обновете. + Болуси с едно и също количество бяха поискани в последните две минути. За да се предотврати дублиране вече доставен болус, операцията е забранена. + Сега + Ниско ниво на резервоар на помпа + Батерията на помпата е слаба + Помпата отчита грешка E%d: %s + Необходимо е сверяване на часа в помпата + Отказването на временният базал беше потвърдено + Помпата е недостъпна. Не беше доставен болус. + Болусът беше неуспешен. За да сте сигурни, моля, проверете помпата, за да избегнете повторение на вече доставен болус. За да се избегнат бъгове болусите не се повтарят автоматично. + Само %.2f U от искания болус от %.2f U е доставен поради грешка. Моля, проверете помпата, за да потвърдите това и да предприемете съответните действия. + Insight + Insight помпа + Статус + Променено + ПОМПАТА Е СПРЯНА + Статуса е актуализиран + преди + с + Активен временен базал + мин. остават + История + Последно извършено действие + мин. From c34cc73b1e9e333e7456ed94aef6377cce412f18 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Thu, 3 May 2018 23:08:16 +0200 Subject: [PATCH 10/21] fix wear wizard --- .../nightscout/androidaps/plugins/Wear/ActionStringHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java index c147fef6b0..fe6c655aa4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java @@ -605,7 +605,7 @@ public class ActionStringHandler { high *= Constants.MMOLL_TO_MGDL; } generateTempTarget(duration, low, high); - } else if ("wizard".equals(act[0])) { + } else if ("wizard2".equals(act[0])) { //use last calculation as confirmed string matches doBolus(lastBolusWizard.calculatedTotalInsulin, lastBolusWizard.carbs); From 010a2f3fd836834533e32a2ad8b1021b93a3ba0b Mon Sep 17 00:00:00 2001 From: swissalpine Date: Fri, 4 May 2018 10:04:45 +0200 Subject: [PATCH 11/21] Make deviation bars transparent --- .../androidaps/plugins/Overview/graphData/GraphData.java | 6 +++--- app/src/main/res/values/colors.xml | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java index 177e7f9642..837a24d8aa 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java @@ -437,9 +437,9 @@ public class GraphData { AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getAutosensData(time); if (autosensData != null) { int color = Color.BLACK; // "=" - if (autosensData.pastSensitivity.equals("C")) color = Color.GRAY; - if (autosensData.pastSensitivity.equals("+")) color = Color.GREEN; - if (autosensData.pastSensitivity.equals("-")) color = Color.RED; + if (autosensData.pastSensitivity.equals("C")) color = MainApp.gc(R.color.deviationgrey); + if (autosensData.pastSensitivity.equals("+")) color = MainApp.gc(R.color.deviationgreen); + if (autosensData.pastSensitivity.equals("-")) color = MainApp.gc(R.color.deviationred); devArray.add(new DeviationDataPoint(time, autosensData.deviation, color, devScale)); maxDevValueFound = Math.max(maxDevValueFound, Math.abs(autosensData.deviation)); } diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index a5e65e2eda..02d39fe91c 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -64,4 +64,8 @@ #ff827c #009705 + #FF666666 + #7200FF00 + #72FF0000 + From 5c8e99b191502e56b81c0ddad92cd258f5b03aaf Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Fri, 4 May 2018 12:23:51 +0200 Subject: [PATCH 12/21] dismiss bolus progress dialog when Queue is empty --- .../Overview/Dialogs/BolusProgressDialog.java | 3 +++ .../nightscout/androidaps/queue/CommandQueue.java | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/BolusProgressDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/BolusProgressDialog.java index 2ca8e6961a..8ef6ec2fc6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/BolusProgressDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/BolusProgressDialog.java @@ -70,6 +70,9 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL @Override public void onResume() { super.onResume(); + if(!ConfigBuilderPlugin.getCommandQueue().bolusInQueue()) { + bolusEnded = true; + } if (bolusEnded) { dismiss(); } else { diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java index 9085e3f762..b42cc47f13 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java +++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java @@ -162,8 +162,18 @@ public class CommandQueue { tempCommandQueue.readStatus(reason, callback); } + public synchronized boolean bolusInQueue(){ + if(isRunning(Command.CommandType.BOLUS)) return true; + for (int i = 0; i < queue.size(); i++) { + if (queue.get(i).commandType == Command.CommandType.BOLUS) { + return true; + } + } + return false; + } + // returns true if command is queued - public boolean bolus(DetailedBolusInfo detailedBolusInfo, Callback callback) { + public synchronized boolean bolus(DetailedBolusInfo detailedBolusInfo, Callback callback) { Command.CommandType type = detailedBolusInfo.isSMB ? Command.CommandType.SMB_BOLUS : Command.CommandType.BOLUS; if(type.equals(Command.CommandType.BOLUS) && detailedBolusInfo.carbs > 0 && detailedBolusInfo.insulin == 0){ From 7312bf061adf5cb975f30703a24143a19f57f0e4 Mon Sep 17 00:00:00 2001 From: swissalpine Date: Fri, 4 May 2018 12:30:28 +0200 Subject: [PATCH 13/21] Update colors.xml --- app/src/main/res/values/colors.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 02d39fe91c..954184de6a 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -64,8 +64,9 @@ #ff827c #009705 - #FF666666 + #c8666666 #7200FF00 #72FF0000 + #72000000 From 10b67a0c11e3160dc70533e8007e048fe38f3b3c Mon Sep 17 00:00:00 2001 From: swissalpine Date: Fri, 4 May 2018 12:31:11 +0200 Subject: [PATCH 14/21] Update GraphData.java --- .../androidaps/plugins/Overview/graphData/GraphData.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java index 837a24d8aa..8023e86ac0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java @@ -436,7 +436,7 @@ public class GraphData { for (long time = fromTime; time <= toTime; time += 5 * 60 * 1000L) { AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getAutosensData(time); if (autosensData != null) { - int color = Color.BLACK; // "=" + int color = MainApp.gc(R.color.deviationblack); // "=" if (autosensData.pastSensitivity.equals("C")) color = MainApp.gc(R.color.deviationgrey); if (autosensData.pastSensitivity.equals("+")) color = MainApp.gc(R.color.deviationgreen); if (autosensData.pastSensitivity.equals("-")) color = MainApp.gc(R.color.deviationred); From 43cc3c4908089e9dcad62823cc75cdfc4027ab48 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Fri, 4 May 2018 14:18:55 +0200 Subject: [PATCH 15/21] Extract CarbsGenerator class. --- .../Overview/Dialogs/NewCarbsDialog.java | 96 ++++++------------- .../plugins/Treatments/CarbsGenerator.java | 56 +++++++++++ .../plugins/Wear/ActionStringHandler.java | 41 +------- 3 files changed, 90 insertions(+), 103 deletions(-) create mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/Treatments/CarbsGenerator.java diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewCarbsDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewCarbsDialog.java index c60d237882..d591c880b9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewCarbsDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewCarbsDialog.java @@ -40,6 +40,7 @@ import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.TempTarget; import info.nightscout.androidaps.interfaces.Constraint; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; +import info.nightscout.androidaps.plugins.Treatments.CarbsGenerator; import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin; import info.nightscout.androidaps.queue.Callback; import info.nightscout.utils.DateUtil; @@ -364,48 +365,40 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, C } accepted = true; - if (startActivityTTCheckbox.isChecked()) { - TempTarget tempTarget = new TempTarget() - .date(System.currentTimeMillis()) - .duration(finalActivityTTDuration) - .reason(MainApp.gs(R.string.activity)) - .source(Source.USER) - .low(Profile.toMgdl(finalActivityTT, currentProfile.getUnits())) - .high(Profile.toMgdl(finalActivityTT, currentProfile.getUnits())); - TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget); - } else if (startEatingSoonTTCheckbox.isChecked()) { - TempTarget tempTarget = new TempTarget() - .date(System.currentTimeMillis()) - .duration(finalEatingSoonTTDuration) - .reason(MainApp.gs(R.string.eatingsoon)) - .source(Source.USER) - .low(Profile.toMgdl(finalEatigSoonTT, currentProfile.getUnits())) - .high(Profile.toMgdl(finalEatigSoonTT, currentProfile.getUnits())); - TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget); - } else if (startHypoTTCheckbox.isChecked()) { - TempTarget tempTarget = new TempTarget() - .date(System.currentTimeMillis()) - .duration(finalHypoTTDuration) - .reason(MainApp.gs(R.string.hypo)) - .source(Source.USER) - .low(Profile.toMgdl(finalHypoTT, currentProfile.getUnits())) - .high(Profile.toMgdl(finalHypoTT, currentProfile.getUnits())); - TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget); - } + if (startActivityTTCheckbox.isChecked()) { + TempTarget tempTarget = new TempTarget() + .date(System.currentTimeMillis()) + .duration(finalActivityTTDuration) + .reason(MainApp.gs(R.string.activity)) + .source(Source.USER) + .low(Profile.toMgdl(finalActivityTT, currentProfile.getUnits())) + .high(Profile.toMgdl(finalActivityTT, currentProfile.getUnits())); + TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget); + } else if (startEatingSoonTTCheckbox.isChecked()) { + TempTarget tempTarget = new TempTarget() + .date(System.currentTimeMillis()) + .duration(finalEatingSoonTTDuration) + .reason(MainApp.gs(R.string.eatingsoon)) + .source(Source.USER) + .low(Profile.toMgdl(finalEatigSoonTT, currentProfile.getUnits())) + .high(Profile.toMgdl(finalEatigSoonTT, currentProfile.getUnits())); + TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget); + } else if (startHypoTTCheckbox.isChecked()) { + TempTarget tempTarget = new TempTarget() + .date(System.currentTimeMillis()) + .duration(finalHypoTTDuration) + .reason(MainApp.gs(R.string.hypo)) + .source(Source.USER) + .low(Profile.toMgdl(finalHypoTT, currentProfile.getUnits())) + .high(Profile.toMgdl(finalHypoTT, currentProfile.getUnits())); + TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget); + } if (carbsAfterConstraints > 0) { if (duration == 0) { - createCarb(carbsAfterConstraints, time, notes); + CarbsGenerator.createCarb(carbsAfterConstraints, time, notes); } else { - long remainingCarbs = carbsAfterConstraints; - int ticks = (duration * 4); //duration guaranteed to be integer greater zero - for (int i = 0; i < ticks; i++){ - long carbTime = time + i * 15 * 60 * 1000; - long smallCarbAmount = Math.round((1d * remainingCarbs) / (ticks-i)); //on last iteration (ticks-i) is 1 -> smallCarbAmount == remainingCarbs - remainingCarbs -= smallCarbAmount; - if (smallCarbAmount > 0) - createCarb(smallCarbAmount, carbTime, notes); - } + CarbsGenerator.generateCarbs(carbsAfterConstraints, time, duration, notes); } } } @@ -420,31 +413,4 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, C log.error("Unhandled exception", e); } } - - private void createCarb(long carbs, long time, @Nullable String notes) { - DetailedBolusInfo carbInfo = new DetailedBolusInfo(); - carbInfo.date = time; - carbInfo.eventType = CareportalEvent.CARBCORRECTION; - carbInfo.carbs = carbs; - carbInfo.context = getContext(); - carbInfo.source = Source.USER; - carbInfo.notes = notes; - if (ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo && carbInfo.date <= now()) { - ConfigBuilderPlugin.getCommandQueue().bolus(carbInfo, new Callback() { - @Override - public void run() { - if (!result.success) { - Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class); - i.putExtra("soundid", R.raw.boluserror); - i.putExtra("status", result.comment); - i.putExtra("title", MainApp.gs(R.string.treatmentdeliveryerror)); - i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - MainApp.instance().startActivity(i); - } - } - }); - } else { - TreatmentsPlugin.getPlugin().addToHistoryTreatment(carbInfo); - } - } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/CarbsGenerator.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/CarbsGenerator.java new file mode 100644 index 0000000000..d270187eca --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/CarbsGenerator.java @@ -0,0 +1,56 @@ +package info.nightscout.androidaps.plugins.Treatments; + +import android.content.Intent; +import android.support.annotation.Nullable; + +import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; +import info.nightscout.androidaps.data.DetailedBolusInfo; +import info.nightscout.androidaps.db.CareportalEvent; +import info.nightscout.androidaps.db.Source; +import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; +import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity; +import info.nightscout.androidaps.queue.Callback; + +import static info.nightscout.utils.DateUtil.now; + +public class CarbsGenerator { + public static void generateCarbs(int amount, long startTime, int duration, @Nullable String notes) { + long remainingCarbs = amount; + int ticks = (duration * 4); //duration guaranteed to be integer greater zero + for (int i = 0; i < ticks; i++){ + long carbTime = startTime + i * 15 * 60 * 1000; + int smallCarbAmount = (int) Math.round((1d * remainingCarbs) / (ticks-i)); //on last iteration (ticks-i) is 1 -> smallCarbAmount == remainingCarbs + remainingCarbs -= smallCarbAmount; + if (smallCarbAmount > 0) + createCarb(smallCarbAmount, carbTime, notes); + } + } + + public static void createCarb(int carbs, long time, @Nullable String notes) { + DetailedBolusInfo carbInfo = new DetailedBolusInfo(); + carbInfo.date = time; + carbInfo.eventType = CareportalEvent.CARBCORRECTION; + carbInfo.carbs = carbs; + carbInfo.context = MainApp.instance(); + carbInfo.source = Source.USER; + carbInfo.notes = notes; + if (ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo && carbInfo.date <= now()) { + ConfigBuilderPlugin.getCommandQueue().bolus(carbInfo, new Callback() { + @Override + public void run() { + if (!result.success) { + Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class); + i.putExtra("soundid", R.raw.boluserror); + i.putExtra("status", result.comment); + i.putExtra("title", MainApp.gs(R.string.treatmentdeliveryerror)); + i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + MainApp.instance().startActivity(i); + } + } + }); + } else { + TreatmentsPlugin.getPlugin().addToHistoryTreatment(carbInfo); + } + } +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java index fe6c655aa4..35b8fe72c2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java @@ -46,6 +46,7 @@ import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin; import info.nightscout.androidaps.plugins.PumpDanaRS.DanaRSPlugin; import info.nightscout.androidaps.plugins.PumpDanaRv2.DanaRv2Plugin; import info.nightscout.androidaps.plugins.PumpInsight.InsightPlugin; +import info.nightscout.androidaps.plugins.Treatments.CarbsGenerator; import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin; import info.nightscout.androidaps.queue.Callback; import info.nightscout.utils.BolusWizard; @@ -633,49 +634,13 @@ public class ActionStringHandler { private static void doECarbs(int carbs, long time, int duration) { if (carbs > 0) { if (duration == 0) { - createCarb(carbs, time, "watch"); + CarbsGenerator.createCarb(carbs, time, "watch"); } else { - long remainingCarbs = carbs; - int ticks = (duration * 4); //duration guaranteed to be integer greater zero - for (int i = 0; i < ticks; i++){ - long carbTime = time + i * 15 * 60 * 1000; - long smallCarbAmount = Math.round((1d * remainingCarbs) / (ticks-i)); //on last iteration (ticks-i) is 1 -> smallCarbAmount == remainingCarbs - remainingCarbs -= smallCarbAmount; - if (smallCarbAmount > 0) - createCarb(smallCarbAmount, carbTime, "watch eCarbs"); - } + CarbsGenerator.generateCarbs(carbs, time, duration, "watch eCarbs"); } } } - private static void createCarb(long carbs, long time, @Nullable String notes) { - DetailedBolusInfo carbInfo = new DetailedBolusInfo(); - carbInfo.date = time; - carbInfo.eventType = CareportalEvent.CARBCORRECTION; - carbInfo.carbs = carbs; - carbInfo.context = MainApp.instance(); - carbInfo.source = Source.USER; - carbInfo.notes = notes; - if (ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo && carbInfo.date <= now()) { - ConfigBuilderPlugin.getCommandQueue().bolus(carbInfo, new Callback() { - @Override - public void run() { - if (!result.success) { - Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class); - i.putExtra("soundid", R.raw.boluserror); - i.putExtra("status", result.comment); - i.putExtra("title", MainApp.gs(R.string.treatmentdeliveryerror)); - i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - MainApp.instance().startActivity(i); - } - } - }); - } else { - TreatmentsPlugin.getPlugin().addToHistoryTreatment(carbInfo); - } - } - - private static void setCPP(int timeshift, int percentage) { String msg = ""; From 35a6bbb6a7be8613e5ca6b389ce6b87c48859db8 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Fri, 4 May 2018 14:22:43 +0200 Subject: [PATCH 16/21] Set CareportalEvent.MEALBOLUS for eCarbs. --- .../plugins/Overview/Dialogs/NewCarbsDialog.java | 7 +------ .../androidaps/plugins/Treatments/CarbsGenerator.java | 6 +++--- .../androidaps/plugins/Wear/ActionStringHandler.java | 7 +------ 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewCarbsDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewCarbsDialog.java index d591c880b9..2ebab6caab 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewCarbsDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewCarbsDialog.java @@ -1,9 +1,7 @@ package info.nightscout.androidaps.plugins.Overview.Dialogs; -import android.content.Intent; import android.os.Bundle; import android.os.HandlerThread; -import android.support.annotation.Nullable; import android.support.v4.app.DialogFragment; import android.support.v7.app.AlertDialog; import android.text.Editable; @@ -33,16 +31,13 @@ import java.util.List; import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; -import info.nightscout.androidaps.data.DetailedBolusInfo; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.db.CareportalEvent; import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.TempTarget; import info.nightscout.androidaps.interfaces.Constraint; -import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.Treatments.CarbsGenerator; import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin; -import info.nightscout.androidaps.queue.Callback; import info.nightscout.utils.DateUtil; import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DefaultValueHelper; @@ -396,7 +391,7 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, C if (carbsAfterConstraints > 0) { if (duration == 0) { - CarbsGenerator.createCarb(carbsAfterConstraints, time, notes); + CarbsGenerator.createCarb(carbsAfterConstraints, time, CareportalEvent.CARBCORRECTION, notes); } else { CarbsGenerator.generateCarbs(carbsAfterConstraints, time, duration, notes); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/CarbsGenerator.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/CarbsGenerator.java index d270187eca..99168a2776 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/CarbsGenerator.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/CarbsGenerator.java @@ -23,14 +23,14 @@ public class CarbsGenerator { int smallCarbAmount = (int) Math.round((1d * remainingCarbs) / (ticks-i)); //on last iteration (ticks-i) is 1 -> smallCarbAmount == remainingCarbs remainingCarbs -= smallCarbAmount; if (smallCarbAmount > 0) - createCarb(smallCarbAmount, carbTime, notes); + createCarb(smallCarbAmount, carbTime, CareportalEvent.MEALBOLUS, notes); } } - public static void createCarb(int carbs, long time, @Nullable String notes) { + public static void createCarb(int carbs, long time, String eventType, @Nullable String notes) { DetailedBolusInfo carbInfo = new DetailedBolusInfo(); carbInfo.date = time; - carbInfo.eventType = CareportalEvent.CARBCORRECTION; + carbInfo.eventType = eventType; carbInfo.carbs = carbs; carbInfo.context = MainApp.instance(); carbInfo.source = Source.USER; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java index 35b8fe72c2..5ec2723fa4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java @@ -1,9 +1,7 @@ package info.nightscout.androidaps.plugins.Wear; -import android.content.Intent; import android.os.HandlerThread; import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import java.text.DateFormat; import java.text.DecimalFormat; @@ -38,7 +36,6 @@ import info.nightscout.androidaps.plugins.IobCobCalculator.CobInfo; import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin; import info.nightscout.androidaps.plugins.Loop.APSResult; import info.nightscout.androidaps.plugins.Loop.LoopPlugin; -import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; @@ -57,8 +54,6 @@ import info.nightscout.utils.SP; import info.nightscout.utils.SafeParse; import info.nightscout.utils.ToastUtils; -import static info.nightscout.utils.DateUtil.now; - /** * Created by adrian on 09/02/17. */ @@ -634,7 +629,7 @@ public class ActionStringHandler { private static void doECarbs(int carbs, long time, int duration) { if (carbs > 0) { if (duration == 0) { - CarbsGenerator.createCarb(carbs, time, "watch"); + CarbsGenerator.createCarb(carbs, time, CareportalEvent.CARBCORRECTION, "watch"); } else { CarbsGenerator.generateCarbs(carbs, time, duration, "watch eCarbs"); } From d15ada5cd9b2377a9832d387388c6fa2db3e13d5 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Fri, 4 May 2018 21:13:49 +0200 Subject: [PATCH 17/21] Combo: Fix visual glitch in fragment. --- .../androidaps/plugins/PumpCombo/ComboFragment.java | 4 ++++ .../java/info/nightscout/androidaps/queue/CommandQueue.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java index 455f1f7015..a37069c71d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java @@ -124,6 +124,10 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis activityView.setTextColor(Color.WHITE); activityView.setTextSize(14); activityView.setText(activity); + } else if (ConfigBuilderPlugin.getCommandQueue().size() > 0) { + activityView.setTextColor(Color.WHITE); + activityView.setTextSize(14); + activityView.setText(""); } else if (plugin.isInitialized()){ activityView.setTextColor(Color.WHITE); activityView.setTextSize(20); diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java index b42cc47f13..d2fd2a5e24 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java +++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java @@ -75,7 +75,7 @@ import info.nightscout.androidaps.queue.commands.CommandTempBasalPercent; public class CommandQueue { private static Logger log = LoggerFactory.getLogger(CommandQueue.class); - private LinkedList queue = new LinkedList<>(); + private final LinkedList queue = new LinkedList<>(); protected Command performing; private QueueThread thread = null; From 9aeb2b6ede572da58dcd8ddfbb96762ce4ba4385 Mon Sep 17 00:00:00 2001 From: Radoslav Radev Date: Fri, 4 May 2018 23:51:08 +0300 Subject: [PATCH 18/21] Update strings.xml --- app/src/main/res/values-bg/strings.xml | 93 +++++++++++++++++++++++--- 1 file changed, 83 insertions(+), 10 deletions(-) diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index 81a1589e47..7fda8a4da9 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -682,20 +682,12 @@ Няма достатъчно инсулин в резервоара Празен Обнови - И един - вддв - шжо + %.2f U/h Добавяне на допълнителни функции за използване през деня, като SMB Пълнене Избран APS Няма базални стойности за някои часове: %s - Предупреждение W31: Ниско ниво в резервоара - Предупреждение W32: Слаба батерия - Предупреждение W33: Невалидно време/дата - Предупреждение W34: Край на гаранцията - Предупреждение W36: Временният базал е прекъснат - Предупреждение W38: Болусът е прекъснат Временният базал е зададен от помпата Румънски Френски @@ -704,7 +696,7 @@ Спиране на болус Хипоглекимия Настройка на целевата КЗ чрез аутосенс - Възрастни с по-голяма инсулинова резистентност + Възрастни с голяма инсулинова резистентност OpenAPS SMB SMB Разреши UAM @@ -755,4 +747,85 @@ История Последно извършено действие мин. + Предупреждение за измерване на КЗ + Маз. + гр. + kJ + Бел. + ]]> + BT Watchdog + Изключва Bluetooth на телефона за една секунда, ако няма връзка с помпата. Това може да помогне на някои телефони, където Bluetooth блокира. + Bluetooth + G5 настройки за upload + Настройки на съветник + Изтегляне КЗ от Найтскаут + --- + Макс. множител за настоящ базал + Макс. множител за най-големия базал за денонощието + Мин. стойност за аутосенс + Макс. стойност за аутосенс + Позволи връзка в роуминг + Настройки за свързване + Само при зареждане + Настройки за визуализация + Основни настройки + Използвай само WiFi + CGM + секунда + минута + час + ден + седмица + %ds изтича %s + Статистика + Предварително свързване + Автоматично свързване при отваряне на AndroidAPS, преди връзка с помпата за намаляване на първоначалното забавяне + Не се препоръчва поради голяма консумация на батерия + Разреши SMB постоянно + "Разрешава SMB постоянно и независимо от болусите. Възможно само с източник на КЗ с добра филтрация като G5 " + Разреши SMB след въглехидрати + Разрешава SMB 6 часа след въглехидрати, дори при COB=0. Възможно само с източник на КЗ с добра филтрация като G5 + Разреши SMB с COB + Разрешава SMB, когато има активни COB + Разреши SMB с временни цели + Разрешава SMB, когато има активна временна цел на КЗ + Разреши SMB с по-високи временни цели на КЗ + "Разрешава SMB когато има активна по-висока временна цел " + Заглушаване + Инсулин + Въглехидрати + Бутони + Изпраща калибрация към xDrip+ или отваря G5 диалог за калибрация + Отваря xDrip+, бутонът назад връща към AAPS + Количество въглехидрати за добавяне при натискане на бутона + Количество инсулин за добавяне при натискане на бутона + Не може да се използва CGM приложението. Уверете се, че е инсталирано. + CGM + Браузър за исторя + Уведомяване при SMB + Покажи SMB на часовника като стандартен болус. + Създаване на известие при грешки + Създаване на Nightscout известие при грешки и локални аларми (също видими в Кеърпортал при Лечения) + Покажи предвиждане на часовника + Предвиждане + Избор на данни + Позволява автоматично изпращане на данни за грешки и статистически данни до разработчиците чрез fabric.io service. + Моля обновете G5 приложението до поддържана версия. + Не доставяй болус, само запис + Категория + Подкатегория + Болусът ще бъде само записан + Допълни липсващи данни за КЗ от Nightscout + SMB чрез помпата + Чувствителност + Отклонение + Активни въглехидрати + Базали + Няма избрано действие, нищо няма да се случи + Използвате dev версия. Closed loop е деактивиран. + Engineering mode не е активиран и не е release версия + Прочита базалният профил + "Историята на помпата се промени след извършване на изчислението за болус. Болусът не беше доставен. Моля, преизчислете дали все още е необходим болус. Ако се изисква същото болусно количество, моля, изчакайте две минути, тъй за това време болусите с едно и също количество са блокирани от съображения за безопасност " + " http://www.androidaps.org facebook: http://facebook.androidaps.org" + From 3a0c34e7b68aae60a64e7038dfd7354ec97d8acd Mon Sep 17 00:00:00 2001 From: Heiner1 Date: Sat, 5 May 2018 09:45:10 +0200 Subject: [PATCH 19/21] Update strings.xml --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e9482171b7..e0ce1ebbf0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,5 +1,5 @@  - Tratments safety + Treatments safety Max allowed bolus [U] Max allowed carbs [g] From fb04250c90528b91f41f4a30884e4ec282bcfc8f Mon Sep 17 00:00:00 2001 From: swissalpine Date: Sat, 5 May 2018 10:00:30 +0200 Subject: [PATCH 20/21] Elliminat syntax error --- app/src/main/res/values-bg/strings.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index 7fda8a4da9..6437f3fa35 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -828,4 +828,3 @@ "Историята на помпата се промени след извършване на изчислението за болус. Болусът не беше доставен. Моля, преизчислете дали все още е необходим болус. Ако се изисква същото болусно количество, моля, изчакайте две минути, тъй за това време болусите с едно и също количество са блокирани от съображения за безопасност " " http://www.androidaps.org facebook: http://facebook.androidaps.org" - From 260e259fb0f7e44dc5601a91aaf91c327409da0a Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Sat, 5 May 2018 15:17:03 +0200 Subject: [PATCH 21/21] Update strings.xml --- app/src/main/res/values-de/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index b078523a63..3aedbbddac 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -582,7 +582,7 @@ Setzte Basalschritt zu 0.01 IE/h Tägl. Basalmenge Tägl. Basalmenge * 2 - Tägl. Gesamtdosis + TDD Gerät noch nicht gefunden DanaRS Dana