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]