Merge pull request #2 from MilosKozak/dev

Dev
This commit is contained in:
McHoffi 2018-05-06 12:13:46 +02:00 committed by GitHub
commit 491b04d562
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 448 additions and 82 deletions

View file

@ -70,6 +70,9 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
if(!ConfigBuilderPlugin.getCommandQueue().bolusInQueue()) {
bolusEnded = true;
}
if (bolusEnded) { if (bolusEnded) {
dismiss(); dismiss();
} else { } else {

View file

@ -1,9 +1,7 @@
package info.nightscout.androidaps.plugins.Overview.Dialogs; package info.nightscout.androidaps.plugins.Overview.Dialogs;
import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.HandlerThread; import android.os.HandlerThread;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.text.Editable; import android.text.Editable;
@ -33,15 +31,13 @@ import java.util.List;
import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.db.CareportalEvent; import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TempTarget; import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.interfaces.Constraint; 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.plugins.Treatments.TreatmentsPlugin;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.DefaultValueHelper; import info.nightscout.utils.DefaultValueHelper;
@ -395,17 +391,9 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, C
if (carbsAfterConstraints > 0) { if (carbsAfterConstraints > 0) {
if (duration == 0) { if (duration == 0) {
createCarb(carbsAfterConstraints, time, notes); CarbsGenerator.createCarb(carbsAfterConstraints, time, CareportalEvent.CARBCORRECTION, notes);
} else { } else {
long remainingCarbs = carbsAfterConstraints; CarbsGenerator.generateCarbs(carbsAfterConstraints, time, duration, notes);
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);
}
} }
} }
} }
@ -420,31 +408,4 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, C
log.error("Unhandled exception", e); 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);
}
}
} }

View file

@ -436,10 +436,10 @@ public class GraphData {
for (long time = fromTime; time <= toTime; time += 5 * 60 * 1000L) { for (long time = fromTime; time <= toTime; time += 5 * 60 * 1000L) {
AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getAutosensData(time); AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getAutosensData(time);
if (autosensData != null) { if (autosensData != null) {
int color = Color.BLACK; // "=" int color = MainApp.gc(R.color.deviationblack); // "="
if (autosensData.pastSensitivity.equals("C")) color = Color.GRAY; if (autosensData.pastSensitivity.equals("C")) color = MainApp.gc(R.color.deviationgrey);
if (autosensData.pastSensitivity.equals("+")) color = Color.GREEN; if (autosensData.pastSensitivity.equals("+")) color = MainApp.gc(R.color.deviationgreen);
if (autosensData.pastSensitivity.equals("-")) color = Color.RED; if (autosensData.pastSensitivity.equals("-")) color = MainApp.gc(R.color.deviationred);
devArray.add(new DeviationDataPoint(time, autosensData.deviation, color, devScale)); devArray.add(new DeviationDataPoint(time, autosensData.deviation, color, devScale));
maxDevValueFound = Math.max(maxDevValueFound, Math.abs(autosensData.deviation)); maxDevValueFound = Math.max(maxDevValueFound, Math.abs(autosensData.deviation));
} }

View file

@ -124,6 +124,10 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
activityView.setTextColor(Color.WHITE); activityView.setTextColor(Color.WHITE);
activityView.setTextSize(14); activityView.setTextSize(14);
activityView.setText(activity); activityView.setText(activity);
} else if (ConfigBuilderPlugin.getCommandQueue().size() > 0) {
activityView.setTextColor(Color.WHITE);
activityView.setTextSize(14);
activityView.setText("");
} else if (plugin.isInitialized()){ } else if (plugin.isInitialized()){
activityView.setTextColor(Color.WHITE); activityView.setTextColor(Color.WHITE);
activityView.setTextSize(20); activityView.setTextSize(20);

View file

@ -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, CareportalEvent.MEALBOLUS, notes);
}
}
public static void createCarb(int carbs, long time, String eventType, @Nullable String notes) {
DetailedBolusInfo carbInfo = new DetailedBolusInfo();
carbInfo.date = time;
carbInfo.eventType = eventType;
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);
}
}
}

View file

@ -19,6 +19,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.DetailedBolusInfo; import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.db.BgReading; import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.db.DatabaseHelper; import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.db.ProfileSwitch; import info.nightscout.androidaps.db.ProfileSwitch;
import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.Source;
@ -42,6 +43,7 @@ import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin;
import info.nightscout.androidaps.plugins.PumpDanaRS.DanaRSPlugin; import info.nightscout.androidaps.plugins.PumpDanaRS.DanaRSPlugin;
import info.nightscout.androidaps.plugins.PumpDanaRv2.DanaRv2Plugin; import info.nightscout.androidaps.plugins.PumpDanaRv2.DanaRv2Plugin;
import info.nightscout.androidaps.plugins.PumpInsight.InsightPlugin; 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.plugins.Treatments.TreatmentsPlugin;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.BolusWizard; import info.nightscout.utils.BolusWizard;
@ -326,6 +328,27 @@ 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);
}
if(carbsAfterConstraints <= 0){
sendError("Carbs = 0! No action taken!");
return;
}
rAction += "ecarbs " + carbsAfterConstraints + " " + starttimestamp + " " + duration;
} else return; } else return;
@ -578,7 +601,7 @@ public class ActionStringHandler {
high *= Constants.MMOLL_TO_MGDL; high *= Constants.MMOLL_TO_MGDL;
} }
generateTempTarget(duration, low, high); generateTempTarget(duration, low, high);
} else if ("wizard".equals(act[0])) { } else if ("wizard2".equals(act[0])) {
//use last calculation as confirmed string matches //use last calculation as confirmed string matches
doBolus(lastBolusWizard.calculatedTotalInsulin, lastBolusWizard.carbs); doBolus(lastBolusWizard.calculatedTotalInsulin, lastBolusWizard.carbs);
@ -591,12 +614,28 @@ public class ActionStringHandler {
int timeshift = SafeParse.stringToInt(act[1]); int timeshift = SafeParse.stringToInt(act[1]);
int percentage = SafeParse.stringToInt(act[2]); int percentage = SafeParse.stringToInt(act[2]);
setCPP(timeshift, percentage); 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])) { } else if ("dismissoverviewnotification".equals(act[0])) {
MainApp.bus().post(new EventDismissNotification(SafeParse.stringToInt(act[1]))); MainApp.bus().post(new EventDismissNotification(SafeParse.stringToInt(act[1])));
} }
lastBolusWizard = null; lastBolusWizard = null;
} }
private static void doECarbs(int carbs, long time, int duration) {
if (carbs > 0) {
if (duration == 0) {
CarbsGenerator.createCarb(carbs, time, CareportalEvent.CARBCORRECTION, "watch");
} else {
CarbsGenerator.generateCarbs(carbs, time, duration, "watch eCarbs");
}
}
}
private static void setCPP(int timeshift, int percentage) { private static void setCPP(int timeshift, int percentage) {
String msg = ""; String msg = "";

View file

@ -75,7 +75,7 @@ import info.nightscout.androidaps.queue.commands.CommandTempBasalPercent;
public class CommandQueue { public class CommandQueue {
private static Logger log = LoggerFactory.getLogger(CommandQueue.class); private static Logger log = LoggerFactory.getLogger(CommandQueue.class);
private LinkedList<Command> queue = new LinkedList<>(); private final LinkedList<Command> queue = new LinkedList<>();
protected Command performing; protected Command performing;
private QueueThread thread = null; private QueueThread thread = null;
@ -162,8 +162,18 @@ public class CommandQueue {
tempCommandQueue.readStatus(reason, callback); 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 // 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; Command.CommandType type = detailedBolusInfo.isSMB ? Command.CommandType.SMB_BOLUS : Command.CommandType.BOLUS;
if(type.equals(Command.CommandType.BOLUS) && detailedBolusInfo.carbs > 0 && detailedBolusInfo.insulin == 0){ if(type.equals(Command.CommandType.BOLUS) && detailedBolusInfo.carbs > 0 && detailedBolusInfo.insulin == 0){

View file

@ -682,4 +682,149 @@
<string name="combo_reservoir_level_insufficient_for_bolus">Няма достатъчно инсулин в резервоара</string> <string name="combo_reservoir_level_insufficient_for_bolus">Няма достатъчно инсулин в резервоара</string>
<string name="combo_reservoir_empty">Празен</string> <string name="combo_reservoir_empty">Празен</string>
<string name="combo_refresh">Обнови</string> <string name="combo_refresh">Обнови</string>
<string name="hoursago">един</string>
<string name="pump_basebasalrate">%.2f U/h</string>
<string name="objectives_7_objective">Добавяне на допълнителни функции за използване през деня, като SMB</string>
<string name="danar_history_prime">Пълнене</string>
<string name="apsselected">Избран APS</string>
<string name="basalprofilenotaligned" formatted="false">Няма базални стойности за някои часове: %s</string>
<string name="loop_tbrsetbypump_label">Временният базал е зададен от помпата</string>
<string name="ro_lang">Румънски</string>
<string name="fr_lang">Френски</string>
<string name="zh_lang">Китайски</string>
<string name="bolusstopped">Болусът е спрян</string>
<string name="bolusstopping">Спиране на болус</string>
<string name="hypo">Хипоглекимия</string>
<string name="openapsama_autosens_adjusttargets">Настройка на целевата КЗ чрез аутосенс</string>
<string name="resistantadult">Възрастни с голяма инсулинова резистентност</string>
<string name="openapssmb">OpenAPS SMB</string>
<string name="smb_shortname">SMB</string>
<string name="enableuam">Разреши UAM</string>
<string name="enablesmb">Разреши SMB</string>
<string name="enablesmb_summary">Използвай супер микро болуси вместо временен базал за по бързо действие</string>
<string name="enableuam_summary">Детекция на необявено хранене (UAM)</string>
<string name="hypo_duration">Продължителност на вр. цел при хипоглекимия</string>
<string name="hypo_target">Временна цел при хипоглекимия</string>
<string name="shortminute">мин.</string>
<string name="shorthour">ч.</string>
<string name="smbmaxminutes_summary">Максимални минути за ограничаване на базала от SMB</string>
<string name="combo_programming_bolus">Програмиране на помпа за болус</string>
<string name="combo_pump_state_label">Състояние</string>
<string name="combo_pump_activity_label">Активност</string>
<string name="combo_no_pump_connection" formatted="false">Няма връзка от %d мин.</string>
<string name="combo_tbr_remaining" formatted="false">%d%% (%d мин. остават)</string>
<string name="combo_pump_state_initializing">Инициализация</string>
<string name="combo_pump_state_suspended_due_to_error">Прекратен поради грешка</string>
<string name="combo_pump_state_suspended_by_user">Прекратен от потребителя</string>
<string name="combo_pump_state_running">Изпълнява</string>
<string name="combo_pump_action_cancelling_tbr">Отказва временен базал</string>
<string name="combo_pump_action_setting_tbr" formatted="false">Задава временен базал (%d%% / %d min)</string>
<string name="combo_pump_action_bolusing" formatted="false">Болус (%.1f U)</string>
<string name="combo_pump_action_refreshing">Обновява</string>
<string name="combo_pump_unsupported_operation">Исканата операция не се поддържа от помпата</string>
<string name="combo_low_suspend_forced_notification">Опасно използване: удължени или многовълнови болуси са активни. Помпата е изключена за само 6 часа. Само нормални болуси се поддържат.</string>
<string name="combo_force_disabled_notification">Опасно използване: помпата използва различни базални нива от първоначалния профил. Loop е спрян. Изберете първоначалния профил и обновете.</string>
<string name="bolus_frequency_exceeded">Болуси с едно и също количество бяха поискани в последните две минути. За да се предотврати дублиране вече доставен болус, операцията е забранена.</string>
<string name="combo_pump_connected_now">Сега</string>
<string name="combo_pump_cartridge_low_warrning">Ниско ниво на резервоар на помпа</string>
<string name="combo_pump_battery_low_warrning">Батерията на помпата е слаба</string>
<string name="combo_is_in_error_state" formatted="false">Помпата отчита грешка E%d: %s</string>
<string name="combo_notification_check_time_date">Необходимо е сверяване на часа в помпата</string>
<string name="combo_pump_tbr_cancelled_warrning">Отказването на временният базал беше потвърдено</string>
<string name="combo_error_no_connection_no_bolus_delivered">Помпата е недостъпна. Не беше доставен болус.</string>
<string name="combo_error_no_bolus_delivered">Болусът беше неуспешен. За да сте сигурни, моля, проверете помпата, за да избегнете повторение на вече доставен болус. За да се избегнат бъгове болусите не се повтарят автоматично.</string>
<string name="combo_error_partial_bolus_delivered" formatted="false">Само %.2f U от искания болус от %.2f U е доставен поради грешка. Моля, проверете помпата, за да потвърдите това и да предприемете съответните действия.</string>
<string name="insightpump_shortname">Insight</string>
<string name="insightpump">Insight помпа</string>
<string name="status_no_colon">Статус</string>
<string name="changed">Променено</string>
<string name="pump_stopped_uppercase">ПОМПАТА Е СПРЯНА</string>
<string name="status_updated">Статуса е актуализиран</string>
<string name="ago">преди</string>
<string name="with">с</string>
<string name="insight_active_tbr">Активен временен базал</string>
<string name="insight_min_left">мин. остават</string>
<string name="log_book">История</string>
<string name="insight_last_completed_action">Последно извършено действие</string>
<string name="insight_min">мин.</string>
<string name="bloodsugarmeasurementalert">Предупреждение за измерване на КЗ</string>
<string name="shortfat">Маз.</string>
<string name="shortgramm">гр.</string>
<string name="shortkilojoul">kJ</string>
<string name="shortprotein">Бел.</string>
<string name="active"><![CDATA[<Активно>]]></string>
<string name="btwatchdog_title">BT Watchdog</string>
<string name="btwatchdog_summary">Изключва Bluetooth на телефона за една секунда, ако няма връзка с помпата. Това може да помогне на някои телефони, където Bluetooth блокира.</string>
<string name="bluetooth">Bluetooth</string>
<string name="dexcomg5_upload">G5 настройки за upload</string>
<string name="wear_wizard_settings">Настройки на съветник</string>
<string name="ns_autobackfill_title">Изтегляне КЗ от Найтскаут</string>
<string name="value_unavailable_short">---</string>
<string name="openapsama_current_basal_safety_multiplier">Макс. множител за настоящ базал</string>
<string name="openapsama_max_daily_safety_multiplier">Макс. множител за най-големия базал за денонощието</string>
<string name="openapsama_autosens_min">Мин. стойност за аутосенс</string>
<string name="openapsama_autosens_max">Макс. стойност за аутосенс</string>
<string name="ns_allowroaming">Позволи връзка в роуминг</string>
<string name="connectionsettings_title">Настройки за свързване</string>
<string name="ns_chargingonly">Само при зареждане</string>
<string name="wear_display_settings">Настройки за визуализация</string>
<string name="wear_general_settings">Основни настройки</string>
<string name="ns_wifionly">Използвай само WiFi</string>
<string name="cgm">CGM</string>
<string name="second">секунда</string>
<string name="minute">минута</string>
<string name="hour">час</string>
<string name="day">ден</string>
<string name="week">седмица</string>
<string name="insight_keepalive_format_string">%ds изтича %s</string>
<string name="statistics">Статистика</string>
<string name="connect_preemptively">Предварително свързване</string>
<string name="automatically_connect_when">Автоматично свързване при отваряне на AndroidAPS, преди връзка с помпата за намаляване на първоначалното забавяне</string>
<string name="not_recommended_due_to_battery_drain">Не се препоръчва поради голяма консумация на батерия</string>
<string name="enablesmbalways">Разреши SMB постоянно</string>
<string name="enablesmbalways_summary">"Разрешава SMB постоянно и независимо от болусите. Възможно само с източник на КЗ с добра филтрация като G5 "</string>
<string name="enablesmbaftercarbs">Разреши SMB след въглехидрати</string>
<string name="enablesmbaftercarbs_summary">Разрешава SMB 6 часа след въглехидрати, дори при COB=0. Възможно само с източник на КЗ с добра филтрация като G5</string>
<string name="enablesmbwithcob">Разреши SMB с COB</string>
<string name="enablesmbwithcob_summary">Разрешава SMB, когато има активни COB</string>
<string name="enablesmbwithtemptarget">Разреши SMB с временни цели</string>
<string name="enablesmbwithtemptarget_summary">Разрешава SMB, когато има активна временна цел на КЗ</string>
<string name="enablesmbwithhightemptarget">Разреши SMB с по-високи временни цели на КЗ</string>
<string name="enablesmbwithhightemptarget_summary">"Разрешава SMB когато има активна по-висока временна цел "</string>
<string name="mute">Заглушаване</string>
<string name="overview_insulin_label">Инсулин</string>
<string name="overview_carbs_label">Въглехидрати</string>
<string name="overview_buttons_selection">Бутони</string>
<string name="show_calibration_button_summary">Изпраща калибрация към xDrip+ или отваря G5 диалог за калибрация</string>
<string name="show_cgm_button_summary">Отваря xDrip+, бутонът назад връща към AAPS</string>
<string name="carb_increment_button_message">Количество въглехидрати за добавяне при натискане на бутона</string>
<string name="insulin_increment_button_message">Количество инсулин за добавяне при натискане на бутона</string>
<string name="error_starting_cgm">Не може да се използва CGM приложението. Уверете се, че е инсталирано.</string>
<string name="overview_cgm">CGM</string>
<string name="nav_historybrowser">Браузър за исторя</string>
<string name="wear_notifysmb_title">Уведомяване при SMB</string>
<string name="wear_notifysmb_summary">Покажи SMB на часовника като стандартен болус.</string>
<string name="ns_create_announcements_from_errors_title">Създаване на известие при грешки</string>
<string name="ns_create_announcements_from_errors_summary">Създаване на Nightscout известие при грешки и локални аларми (също видими в Кеърпортал при Лечения)</string>
<string name="wear_predictions_summary">Покажи предвиждане на часовника</string>
<string name="wear_predictions_title">Предвиждане</string>
<string name="data_choices">Избор на данни</string>
<string name="allow_automated_crash_reporting">Позволява автоматично изпращане на данни за грешки и статистически данни до разработчиците чрез fabric.io service.</string>
<string name="g5appnotdetected">Моля обновете G5 приложението до поддържана версия.</string>
<string name="don_t_bolus_record_only">Не доставяй болус, само запис</string>
<string name="category">Категория</string>
<string name="subcategory">Подкатегория</string>
<string name="bolusrecordedonly">Болусът ще бъде само записан</string>
<string name="ns_autobackfill_summary">Допълни липсващи данни за КЗ от Nightscout</string>
<string name="loop_smbsetbypump_label">SMB чрез помпата</string>
<string name="overview_show_sensitivity">Чувствителност</string>
<string name="overview_show_deviations">Отклонение</string>
<string name="overview_show_cob">Активни въглехидрати</string>
<string name="overview_show_basals">Базали</string>
<string name="no_action_selected">Няма избрано действие, нищо няма да се случи</string>
<string name="closed_loop_disabled_on_dev_branch">Използвате dev версия. Closed loop е деактивиран.</string>
<string name="not_eng_mode_or_release">Engineering mode не е активиран и не е release версия</string>
<string name="combo_actvity_reading_basal_profile">Прочита базалният профил</string>
<string name="combo_bolus_rejected_due_to_pump_history_change">"Историята на помпата се промени след извършване на изчислението за болус. Болусът не беше доставен. Моля, преизчислете дали все още е необходим болус. Ако се изисква същото болусно количество, моля, изчакайте две минути, тъй за това време болусите с едно и също количество са блокирани от съображения за безопасност "</string>
<string name="about_link_urls">" http://www.androidaps.org facebook: http://facebook.androidaps.org"</string>
</resources> </resources>

View file

@ -582,7 +582,7 @@
<string name="danar_setbasalstep001">Setzte Basalschritt zu 0.01 IE/h</string> <string name="danar_setbasalstep001">Setzte Basalschritt zu 0.01 IE/h</string>
<string name="danar_stats_tbb">Tägl. Basalmenge</string> <string name="danar_stats_tbb">Tägl. Basalmenge</string>
<string name="danar_stats_tbb2">Tägl. Basalmenge * 2</string> <string name="danar_stats_tbb2">Tägl. Basalmenge * 2</string>
<string name="danar_stats_tdd">Tägl. Gesamtdosis</string> <string name="danar_stats_tdd">TDD</string>
<string name="danars_nodeviceavailable">Gerät noch nicht gefunden</string> <string name="danars_nodeviceavailable">Gerät noch nicht gefunden</string>
<string name="danarspump">DanaRS</string> <string name="danarspump">DanaRS</string>
<string name="danarspump_shortname">Dana</string> <string name="danarspump_shortname">Dana</string>

View file

@ -64,4 +64,9 @@
<color name="notificationLow">#ff827c</color> <color name="notificationLow">#ff827c</color>
<color name="notificationInfo">#009705</color> <color name="notificationInfo">#009705</color>
<color name="deviationgrey">#c8666666</color>
<color name="deviationgreen">#7200FF00</color>
<color name="deviationred">#72FF0000</color>
<color name="deviationblack">#72000000</color>
</resources> </resources>

View file

@ -1,5 +1,5 @@
<resources> <resources>
<string name="treatmentssafety_title">Tratments safety</string> <string name="treatmentssafety_title">Treatments safety</string>
<string name="treatmentssafety_maxbolus_title">Max allowed bolus [U]</string> <string name="treatmentssafety_maxbolus_title">Max allowed bolus [U]</string>
<string name="treatmentssafety_maxcarbs_title">Max allowed carbs [g]</string> <string name="treatmentssafety_maxcarbs_title">Max allowed carbs [g]</string>

View file

@ -54,7 +54,7 @@
android:key="wearplugin" android:key="wearplugin"
android:title="@string/wear_display_settings"> android:title="@string/wear_display_settings">
<SwitchPreference <SwitchPreference
android:defaultValue="true" android:defaultValue="false"
android:key="wear_detailediob" android:key="wear_detailediob"
android:summary="@string/wear_detailedIOB_summary" android:summary="@string/wear_detailedIOB_summary"
android:title="@string/wear_detailedIOB_title" /> android:title="@string/wear_detailedIOB_title" />

View file

@ -208,6 +208,10 @@
android:name=".interaction.actions.FillActivity" android:name=".interaction.actions.FillActivity"
android:label="Fill"> android:label="Fill">
</activity> </activity>
<activity
android:name=".interaction.actions.ECarbActivity"
android:label="Fill">
</activity>
<activity <activity
android:name=".interaction.actions.TempTargetActivity" android:name=".interaction.actions.TempTargetActivity"
android:label="TempTarget"> android:label="TempTarget">

View file

@ -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, 15d, new DecimalFormat("0"), false);
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;
}
}
}

View file

@ -7,10 +7,10 @@ import android.preference.PreferenceManager;
import java.util.Vector; import java.util.Vector;
import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.data.ListenerService;
import info.nightscout.androidaps.interaction.AAPSPreferences; import info.nightscout.androidaps.interaction.AAPSPreferences;
import info.nightscout.androidaps.interaction.actions.BolusActivity; 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.actions.TempTargetActivity;
import info.nightscout.androidaps.interaction.utils.MenuListActivity; import info.nightscout.androidaps.interaction.utils.MenuListActivity;
import info.nightscout.androidaps.interaction.actions.WizardActivity; import info.nightscout.androidaps.interaction.actions.WizardActivity;
@ -47,6 +47,7 @@ public class MainMenuActivity extends MenuListActivity {
Vector<String> menuitems = new Vector<String>(); Vector<String> menuitems = new Vector<String>();
menuitems.add("TempT"); menuitems.add("TempT");
if(showWizard) menuitems.add("Wizard"); if(showWizard) menuitems.add("Wizard");
menuitems.add("eCarb");
menuitems.add("Bolus"); menuitems.add("Bolus");
menuitems.add("Settings"); menuitems.add("Settings");
menuitems.add("Status"); menuitems.add("Status");
@ -86,6 +87,10 @@ public class MainMenuActivity extends MenuListActivity {
intent = new Intent(this, FillMenuActivity.class); intent = new Intent(this, FillMenuActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent); this.startActivity(intent);
} else if ("eCarb".equals(action)) {
intent = new Intent(this, ECarbActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
} }
} }
} }