diff --git a/app/src/main/java/info/nightscout/androidaps/data/PumpEnactResult.java b/app/src/main/java/info/nightscout/androidaps/data/PumpEnactResult.java index 404833b77c..280c948a6a 100644 --- a/app/src/main/java/info/nightscout/androidaps/data/PumpEnactResult.java +++ b/app/src/main/java/info/nightscout/androidaps/data/PumpEnactResult.java @@ -48,6 +48,11 @@ public class PumpEnactResult { return this; } + public PumpEnactResult comment(int comment) { + this.comment = MainApp.gs(comment); + return this; + } + public PumpEnactResult duration(int duration) { this.duration = duration; return this; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/connector/Connector.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/connector/Connector.java index fdc2aff0a6..4a90cd92ca 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/connector/Connector.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/connector/Connector.java @@ -421,7 +421,7 @@ public class Connector { } if (lastStatus == null) { - return MainApp.gs(R.string.insight_unknown); + return MainApp.gs(R.string.unknown); } switch (lastStatus) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java index 1d36eea817..e5e1a6c18e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java @@ -242,6 +242,7 @@ public class SmsCommunicatorPlugin extends PluginBase { LoopPlugin loopPlugin = MainApp.getSpecificPlugin(LoopPlugin.class); if (loopPlugin != null && loopPlugin.isEnabled(PluginType.LOOP)) { loopPlugin.setPluginEnabled(PluginType.LOOP, false); + ConfigBuilderPlugin.getPlugin().storeSettings("SMS_LOOP_STOP"); ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, new Callback() { @Override public void run() { @@ -260,6 +261,7 @@ public class SmsCommunicatorPlugin extends PluginBase { loopPlugin = MainApp.getSpecificPlugin(LoopPlugin.class); if (loopPlugin != null && !loopPlugin.isEnabled(PluginType.LOOP)) { loopPlugin.setPluginEnabled(PluginType.LOOP, true); + ConfigBuilderPlugin.getPlugin().storeSettings("SMS_LOOP_START"); reply = MainApp.gs(R.string.smscommunicator_loophasbeenenabled); sendSMS(new Sms(receivedSms.phoneNumber, reply, System.currentTimeMillis())); MainApp.bus().post(new EventRefreshOverview("SMS_LOOP_START")); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationEvent.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationEvent.java new file mode 100644 index 0000000000..c0de76ee37 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationEvent.java @@ -0,0 +1,16 @@ +package info.nightscout.androidaps.plugins.general.automation; + +import java.util.ArrayList; +import java.util.List; + +import info.nightscout.androidaps.plugins.general.automation.actions.Action; +import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger; + +public class AutomationEvent { + + Trigger trigger; + List actions = new ArrayList<>(); + + AutomationEvent() { + } +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.java index 3bf4042512..15853a44eb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.java @@ -19,7 +19,7 @@ public class AutomationPlugin extends PluginBase { return plugin; } - List actions = new ArrayList<>(); + List automationEvents = new ArrayList<>(); private AutomationPlugin() { super(new PluginDescription() diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/Action.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/Action.java index 5523edf15f..b74243326e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/Action.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/Action.java @@ -1,6 +1,9 @@ package info.nightscout.androidaps.plugins.general.automation.actions; +import info.nightscout.androidaps.queue.Callback; + public abstract class Action { - abstract void doAction(); + abstract int friendlyName(); + abstract void doAction(Callback callback); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopDisable.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopDisable.java new file mode 100644 index 0000000000..059bdacaf3 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopDisable.java @@ -0,0 +1,36 @@ +package info.nightscout.androidaps.plugins.general.automation.actions; + +import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; +import info.nightscout.androidaps.data.PumpEnactResult; +import info.nightscout.androidaps.events.EventRefreshOverview; +import info.nightscout.androidaps.interfaces.PluginType; +import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; +import info.nightscout.androidaps.plugins.Loop.LoopPlugin; +import info.nightscout.androidaps.queue.Callback; + +public class ActionLoopDisable extends Action { + @Override + int friendlyName() { + return R.string.disableloop; + } + + @Override + void doAction(Callback callback) { + if (LoopPlugin.getPlugin().isEnabled(PluginType.LOOP)) { + LoopPlugin.getPlugin().setPluginEnabled(PluginType.LOOP, false); + ConfigBuilderPlugin.getPlugin().storeSettings("ActionLoopDisable"); + ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, new Callback() { + @Override + public void run() { + MainApp.bus().post(new EventRefreshOverview("ActionLoopDisable")); + if (callback != null) + callback.result(result).run(); + } + }); + } else { + if (callback != null) + callback.result(new PumpEnactResult().success(true).comment(R.string.alreadydisabled)).run(); + } + } +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopEnable.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopEnable.java new file mode 100644 index 0000000000..1ef1ec81a6 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopEnable.java @@ -0,0 +1,31 @@ +package info.nightscout.androidaps.plugins.general.automation.actions; + +import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; +import info.nightscout.androidaps.data.PumpEnactResult; +import info.nightscout.androidaps.events.EventRefreshOverview; +import info.nightscout.androidaps.interfaces.PluginType; +import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; +import info.nightscout.androidaps.plugins.Loop.LoopPlugin; +import info.nightscout.androidaps.queue.Callback; + +public class ActionLoopEnable extends Action { + @Override + int friendlyName() { + return R.string.enableloop; + } + + @Override + void doAction(Callback callback) { + if (!LoopPlugin.getPlugin().isEnabled(PluginType.LOOP)) { + LoopPlugin.getPlugin().setPluginEnabled(PluginType.LOOP, true); + ConfigBuilderPlugin.getPlugin().storeSettings("ActionLoopEnable"); + MainApp.bus().post(new EventRefreshOverview("ActionLoopEnable")); + if (callback != null) + callback.result(new PumpEnactResult().success(true).comment(R.string.ok)).run(); + } else { + if (callback != null) + callback.result(new PumpEnactResult().success(true).comment(R.string.alreadyenabled)).run(); + } + } +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopResume.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopResume.java new file mode 100644 index 0000000000..71244c70f4 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopResume.java @@ -0,0 +1,33 @@ +package info.nightscout.androidaps.plugins.general.automation.actions; + +import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; +import info.nightscout.androidaps.data.PumpEnactResult; +import info.nightscout.androidaps.events.EventRefreshOverview; +import info.nightscout.androidaps.interfaces.PluginType; +import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; +import info.nightscout.androidaps.plugins.Loop.LoopPlugin; +import info.nightscout.androidaps.plugins.NSClientInternal.NSUpload; +import info.nightscout.androidaps.queue.Callback; + +public class ActionLoopResume extends Action { + @Override + int friendlyName() { + return R.string.resumeloop; + } + + @Override + void doAction(Callback callback) { + if (LoopPlugin.getPlugin().isSuspended()) { + LoopPlugin.getPlugin().suspendTo(0); + ConfigBuilderPlugin.getPlugin().storeSettings("ActionLoopResume"); + NSUpload.uploadOpenAPSOffline(0); + MainApp.bus().post(new EventRefreshOverview("ActionLoopResume")); + if (callback != null) + callback.result(new PumpEnactResult().success(true).comment(R.string.ok)).run(); + } else { + if (callback != null) + callback.result(new PumpEnactResult().success(true).comment(R.string.notsuspended)).run(); + } + } +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopSuspend.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopSuspend.java new file mode 100644 index 0000000000..eb9ddfd79c --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopSuspend.java @@ -0,0 +1,30 @@ +package info.nightscout.androidaps.plugins.general.automation.actions; + +import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; +import info.nightscout.androidaps.data.PumpEnactResult; +import info.nightscout.androidaps.events.EventRefreshOverview; +import info.nightscout.androidaps.plugins.Loop.LoopPlugin; +import info.nightscout.androidaps.queue.Callback; + +public class ActionLoopSuspend extends Action { + int minutes; + + @Override + int friendlyName() { + return R.string.disableloop; + } + + @Override + void doAction(Callback callback) { + if (!LoopPlugin.getPlugin().isSuspended()) { + LoopPlugin.getPlugin().suspendLoop(minutes); + MainApp.bus().post(new EventRefreshOverview("ActionLoopSuspend")); + if (callback != null) + callback.result(new PumpEnactResult().success(true).comment(R.string.ok)).run(); + } else { + if (callback != null) + callback.result(new PumpEnactResult().success(true).comment(R.string.alreadysuspended)).run(); + } + } +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTarget.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTarget.java new file mode 100644 index 0000000000..8cd8db0f4e --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTarget.java @@ -0,0 +1,33 @@ +package info.nightscout.androidaps.plugins.general.automation.actions; + +import info.nightscout.androidaps.Constants; +import info.nightscout.androidaps.R; +import info.nightscout.androidaps.data.Profile; +import info.nightscout.androidaps.data.PumpEnactResult; +import info.nightscout.androidaps.db.Source; +import info.nightscout.androidaps.db.TempTarget; +import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin; +import info.nightscout.androidaps.queue.Callback; +import info.nightscout.utils.DateUtil; + +public class ActionStartTempTarget extends Action { + + double value; + int durationInMinutes; + String reason; + String units = Constants.MGDL; + + @Override + int friendlyName() { + return R.string.starttemptarget; + } + + @Override + void doAction(Callback callback) { + double converted = Profile.toMgdl(value, units); + TempTarget tempTarget = new TempTarget().date(DateUtil.now()).duration(durationInMinutes).reason(reason).source(Source.USER).low(converted).high(converted); + TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget); + if (callback != null) + callback.result(new PumpEnactResult().success(true).comment(R.string.ok)).run(); + } +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/AutomationEvent.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/AutomationEvent.java deleted file mode 100644 index 904cc78a4e..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/AutomationEvent.java +++ /dev/null @@ -1,13 +0,0 @@ -package info.nightscout.androidaps.plugins.general.automation.actions; - -import java.util.ArrayList; -import java.util.List; - -public class AutomationEvent { - - Trigger trigger; - List actions = new ArrayList<>(); - - AutomationEvent() { - } -} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/Trigger.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/Trigger.java similarity index 52% rename from app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/Trigger.java rename to app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/Trigger.java index cfff99f6ab..8cfa2156d9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/Trigger.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/Trigger.java @@ -1,9 +1,11 @@ -package info.nightscout.androidaps.plugins.general.automation.actions; +package info.nightscout.androidaps.plugins.general.automation.triggers; import org.json.JSONException; import org.json.JSONObject; -abstract class Trigger { +import info.nightscout.androidaps.R; + +public abstract class Trigger { protected static final int ISLOWER = -2; protected static final int ISEQUALORLOWER = -1; @@ -11,7 +13,7 @@ abstract class Trigger { protected static final int ISEQUALORGREATER = 1; protected static final int ISGREATER = 2; - protected static final int NOTAVAILABLE = 10; + protected static final int ISNOTAVAILABLE = 10; Trigger() { } @@ -22,6 +24,10 @@ abstract class Trigger { abstract Trigger fromJSON(String data); + abstract int friendlyName(); + + abstract String friendlyDescription(); + void notifyAboutRun(long time) { } @@ -38,4 +44,21 @@ abstract class Trigger { } + public static int toComparatorString(int comparator) { + switch (comparator) { + case ISLOWER: + return R.string.islower; + case ISEQUALORLOWER: + return R.string.isequalorlower; + case ISEQUAL: + return R.string.isequal; + case ISEQUALORGREATER: + return R.string.isequalorgreater; + case ISGREATER: + return R.string.isgreater; + case ISNOTAVAILABLE: + return R.string.isnotavailable; + } + return R.string.unknown; + } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerAnd.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerAnd.java similarity index 75% rename from app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerAnd.java rename to app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerAnd.java index ec4111c9ce..3e791afcc7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerAnd.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerAnd.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.general.automation.actions; +package info.nightscout.androidaps.plugins.general.automation.triggers; import org.json.JSONArray; import org.json.JSONException; @@ -7,6 +7,8 @@ import org.json.JSONObject; import java.util.ArrayList; import java.util.List; +import info.nightscout.androidaps.R; + public class TriggerAnd extends Trigger { private List list = new ArrayList<>(); @@ -51,6 +53,22 @@ public class TriggerAnd extends Trigger { return this; } + @Override + int friendlyName() { + return R.string.and; + } + + @Override + String friendlyDescription() { + int counter = 0; + StringBuilder result = new StringBuilder(); + for (Trigger t : list) { + if (counter++ > 0) result.append(R.string.and); + result.append(t.friendlyDescription()); + } + return result.toString(); + } + synchronized void add(Trigger t) { list.add(t); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerBg.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBg.java similarity index 79% rename from app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerBg.java rename to app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBg.java index 4e945cacfa..5939502163 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerBg.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBg.java @@ -1,8 +1,10 @@ -package info.nightscout.androidaps.plugins.general.automation.actions; +package info.nightscout.androidaps.plugins.general.automation.triggers; import org.json.JSONException; import org.json.JSONObject; +import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; import info.nightscout.androidaps.data.GlucoseStatus; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.plugins.ConfigBuilder.ProfileFunctions; @@ -18,7 +20,7 @@ public class TriggerBg extends Trigger { synchronized boolean shouldRun() { GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData(); - if (glucoseStatus == null && comparator == NOTAVAILABLE) + if (glucoseStatus == null && comparator == ISNOTAVAILABLE) return true; if (glucoseStatus == null) return false; @@ -61,12 +63,25 @@ public class TriggerBg extends Trigger { threshold = JsonHelper.safeGetDouble(d, "threshold"); comparator = JsonHelper.safeGetInt(d, "comparator"); units = JsonHelper.safeGetString(d, "units"); - } catch (JSONException e) { + } catch (JSONException e) { e.printStackTrace(); } return this; } + @Override + int friendlyName() { + return R.string.glucose; + } + + @Override + String friendlyDescription() { + if (comparator == Trigger.ISNOTAVAILABLE) + return MainApp.gs(R.string.glucoseisnotavailable); + else + return MainApp.gs(R.string.glucosecompared, Trigger.toComparatorString(comparator), threshold, units); + } + TriggerBg threshold(double threshold) { this.threshold = threshold; return this; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerOr.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerOr.java similarity index 75% rename from app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerOr.java rename to app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerOr.java index 45c181cf8b..309838b25f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerOr.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerOr.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.general.automation.actions; +package info.nightscout.androidaps.plugins.general.automation.triggers; import org.json.JSONArray; import org.json.JSONException; @@ -7,6 +7,8 @@ import org.json.JSONObject; import java.util.ArrayList; import java.util.List; +import info.nightscout.androidaps.R; + public class TriggerOr extends Trigger { private List list = new ArrayList<>(); @@ -51,6 +53,22 @@ public class TriggerOr extends Trigger { return this; } + @Override + int friendlyName() { + return R.string.or; + } + + @Override + String friendlyDescription() { + int counter = 0; + StringBuilder result = new StringBuilder(); + for (Trigger t : list) { + if (counter++ > 0) result.append(R.string.or); + result.append(t.friendlyDescription()); + } + return result.toString(); + } + synchronized void add(Trigger t) { list.add(t); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerTime.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTime.java similarity index 91% rename from app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerTime.java rename to app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTime.java index 8281edb906..b5f0e6e072 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerTime.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTime.java @@ -1,10 +1,12 @@ -package info.nightscout.androidaps.plugins.general.automation.actions; +package info.nightscout.androidaps.plugins.general.automation.triggers; import org.json.JSONException; import org.json.JSONObject; import java.util.Calendar; +import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; import info.nightscout.utils.DateUtil; import info.nightscout.utils.JsonHelper; import info.nightscout.utils.T; @@ -115,6 +117,21 @@ public class TriggerTime extends Trigger { return this; } + @Override + int friendlyName() { + return R.string.time; + } + + @Override + String friendlyDescription() { + if (recurring) { + // TODO + return "Every "; + } else { + return MainApp.gs(R.string.atspecifiedtime, DateUtil.dateAndTimeString(runAt)); + } + } + @Override void notifyAboutRun(long time) { lastRun = time; diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index d57fa1a13c..cb71a297cd 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -796,7 +796,7 @@ Не е свързан към приложението! Приложението изглежда не е инсталирано! Несъвместимо приложение, нужна е версия - Неизвестно + Неизвестно Изчаква се потвърждение на кода Кодът е отхвърлен Свързване с апликацията diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 28fa6eaabd..c68b4b1845 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -796,7 +796,7 @@ Nepřipojen k podpůrné aplikaci! Podpůrná aplikace patrně není nainstalovaná! Nekompatibilní podpůrná aplikace, je požadována verze - Neznámý + Neznámý Čekám na potvrzení kódu Kód odmítnut Připojování aplikace diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 9af4aae9a0..04e65c77e7 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -797,7 +797,7 @@ maxIOB = durchschnittlicher Essensbolus + 3 x maximale Basalrate Keine Verbindung zur Begleit-App! Begleit-App scheint nicht installiert zu sein! Nicht kompatible Begleit-App, wir benötigen Version - Unbekannt + Unbekannt Warte auf Code-Bestätigung Code abgelehnt Verbinden zur App diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index ab5bdf0d2e..65c245f895 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -793,7 +793,7 @@ No conectado a la aplicación companion! ¡La aplicación Companion no parece estar instalada! Aplicación Companion incompatible, necesitamos la versión - Desconocido + Desconocido Esperando código de confirmación Código rechazado Vincular con aplicación diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 58da7d951d..8b05f2d7d5 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -755,7 +755,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S Non connectée à l\'application compagnon L\'application compagnon ne semble pas être installée Application compagnon incompatible, besoin d\'une autre version - Inconnue + Inconnue Attente du code de confirmation Code rejeté Liaison avec app diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 3ae470a845..2f114fcdc3 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -796,7 +796,7 @@ Non collegato all\'app! Gruppo dell\'app non sembra essere installato! App incompatibili, abbiamo bisogno di versione - Sconosciuto + Sconosciuto In attesa di conferma Codice rifiutato App di unione diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 634dffe18b..279fce1b79 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -796,7 +796,7 @@ 앱에 연결되지 않았습니다. 앱이 설치되지 않았습니다. 호환되지 않는 앱입니다. 이 버전이 필요합니다 - 알 수 없는 + 알 수 없는 코드 승인 대기중 코드가 거부되었습니다. 앱 연결중 diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 18ad8b2ac6..d2410a8017 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -797,7 +797,7 @@ Stel in en gebruik tijdelijk en standaard tijdelijke streefdoelen (bv. bij sport Niet verbonden met de Companion app! Companion app lijkt niet geïnstalleerd! Incompatiebele Companion app, we hebben deze versie nodig - Onbekend + Onbekend Wacht op confirmatie van code Code geweigerd app koppeling diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 74760d065d..49cbaab98e 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -797,7 +797,7 @@ Brak połączenia z aplikacją towarzyszącą! Aplikacja towarzysząca prawdopodobnie nie jest zainstalowana! Niezgodna aplikacja towarzysząca, potrzebujemy wersji - Nieznany + Nieznany Oczekuję na potwierdzenie kodu Kod odrzucony Wiązanie aplikacji diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index adf8819a74..e9bad5ab5d 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -796,7 +796,7 @@ Nãp conectado com a aplicação acompanhante! Aplicação acompanhante aparentemente não instalada! Aplicação acompanhante incompatível. Versão necessitada - Desconhecido + Desconhecido A aguardar por código de confirmação Codigo rejeitado Associação de aplicação diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index f2e60784be..aaa7e6adf8 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -796,7 +796,7 @@ Aplicația nu este conectată! Aplicația pare să nu fie instalată! Aplicație incompatibila, este necesară versiunea - Necunoscut + Necunoscut Se așteaptă confirmarea codului Cod respins Conectare aplicație diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 18b0a72853..db6a9c61d3 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -796,7 +796,7 @@ Нет подключения к сопутствующему приложению! Сопутствующее приложение по-видимому не установлено! Несовместимое сопутствующее приложение, нужна версия - Неизвестно + Неизвестно Ожидание подтверждения кода Код отклонен Соединение с приложением diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index ca452725a9..0e9aefdc51 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -797,7 +797,7 @@ Nepripojený k sprievodnej aplikácii! Sprievodná aplikácia pravdepodobne nie je nainštalovaná! Nekompatibilná sprievodná aplikácia, je požadovaná verzia - Neznámy + Neznámy Čakám na potvrdenie kódu Kód odmietnutý Pripájanie aplikácie diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 322d206e13..10e3250f2d 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -796,7 +796,7 @@ Inte ansluten till hjälp-app! Hjälp-app verkar inte vara installerad! Inkompatibel hjälp-app. Vi behöver version - Okänd + Okänd Inväntar kodverifiering Kod ej godkänd Appbindning diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 6dd67b910e..01fa980a86 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -796,7 +796,7 @@ 没有连接到companion app! 好像没有安装companion app! 和companion app不兼容,我们需要版本 - 未知的 + 未知的 正在等待代码确认 代码被拒绝 App绑定中 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8e74db6510..76e8a4bf27 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -893,7 +893,7 @@ Not connected to companion app! Companion app does not appear to be installed! Incompatible companion app, we need version - Unknown + Unknown Waiting for code confirmation Code rejected App binding @@ -1208,6 +1208,23 @@ Automation Auto User defined automation tasks + Already enabled + Already disabled + Already suspended + Resume loop + Not suspended + Start temp target + is lower than + is equal or lower than + is equal to + is equal or greater than + is greater than + is not available + Glucose is not available + Glucose %1$s %2$.2f %3$s + And + Or + At %1$s %1$d day diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerAndTest.java b/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerAndTest.java similarity index 79% rename from app/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerAndTest.java rename to app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerAndTest.java index ca226f3d88..930cf64f89 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerAndTest.java +++ b/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerAndTest.java @@ -1,14 +1,16 @@ -package info.nightscout.androidaps.plugins.general.automation.actions; +package info.nightscout.androidaps.plugins.general.automation.triggers; import org.json.JSONException; import org.json.JSONObject; import org.junit.Assert; -import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; +import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger; +import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerAnd; + @RunWith(PowerMockRunner.class) @PrepareForTest({}) public class TriggerAndTest { @@ -37,8 +39,8 @@ public class TriggerAndTest { Assert.assertTrue(t.shouldRun()); } - String empty = "{\"data\":\"[]\",\"type\":\"info.nightscout.androidaps.plugins.general.automation.actions.TriggerAnd\"}"; - String oneItem = "{\"data\":\"[\\\"{\\\\\\\"data\\\\\\\":\\\\\\\"[]\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"info.nightscout.androidaps.plugins.general.automation.actions.TriggerAnd\\\\\\\"}\\\"]\",\"type\":\"info.nightscout.androidaps.plugins.general.automation.actions.TriggerAnd\"}"; + String empty = "{\"data\":\"[]\",\"type\":\"info.nightscout.androidaps.plugins.general.automation.triggers.TriggerAnd\"}"; + String oneItem = "{\"data\":\"[\\\"{\\\\\\\"data\\\\\\\":\\\\\\\"[]\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"info.nightscout.androidaps.plugins.general.automation.triggers.TriggerAnd\\\\\\\"}\\\"]\",\"type\":\"info.nightscout.androidaps.plugins.general.automation.triggers.TriggerAnd\"}"; @Test public void toJSONTest() { diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerBgTest.java b/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBgTest.java similarity index 95% rename from app/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerBgTest.java rename to app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBgTest.java index 7215ee8d3e..fa6d03ed69 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerBgTest.java +++ b/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBgTest.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.general.automation.actions; +package info.nightscout.androidaps.plugins.general.automation.triggers; import com.squareup.otto.Bus; @@ -58,11 +58,11 @@ public class TriggerBgTest { when(MainApp.getDbHelper().getBgreadingsDataFromTime(anyLong(), anyBoolean())).thenReturn(new ArrayList<>()); t = new TriggerBg().units(Constants.MGDL).threshold(213).comparator(Trigger.ISEQUALORLOWER); Assert.assertFalse(t.shouldRun()); - t = new TriggerBg().comparator(Trigger.NOTAVAILABLE); + t = new TriggerBg().comparator(Trigger.ISNOTAVAILABLE); Assert.assertTrue(t.shouldRun()); } - String bgJson = "{\"data\":\"{\\\"comparator\\\":0,\\\"threshold\\\":4.1,\\\"units\\\":\\\"mmol\\\"}\",\"type\":\"info.nightscout.androidaps.plugins.general.automation.actions.TriggerBg\"}"; + String bgJson = "{\"data\":\"{\\\"comparator\\\":0,\\\"threshold\\\":4.1,\\\"units\\\":\\\"mmol\\\"}\",\"type\":\"info.nightscout.androidaps.plugins.general.automation.triggers.TriggerBg\"}"; @Test public void toJSONTest() { diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerOrTest.java b/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerOrTest.java similarity index 79% rename from app/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerOrTest.java rename to app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerOrTest.java index b359e5ca15..0417e702aa 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerOrTest.java +++ b/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerOrTest.java @@ -1,14 +1,16 @@ -package info.nightscout.androidaps.plugins.general.automation.actions; +package info.nightscout.androidaps.plugins.general.automation.triggers; import org.json.JSONException; import org.json.JSONObject; import org.junit.Assert; -import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; +import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger; +import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerOr; + @RunWith(PowerMockRunner.class) @PrepareForTest({}) public class TriggerOrTest { @@ -37,8 +39,8 @@ public class TriggerOrTest { Assert.assertFalse(t.shouldRun()); } - String empty = "{\"data\":\"[]\",\"type\":\"info.nightscout.androidaps.plugins.general.automation.actions.TriggerOr\"}"; - String oneItem = "{\"data\":\"[\\\"{\\\\\\\"data\\\\\\\":\\\\\\\"[]\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"info.nightscout.androidaps.plugins.general.automation.actions.TriggerOr\\\\\\\"}\\\"]\",\"type\":\"info.nightscout.androidaps.plugins.general.automation.actions.TriggerOr\"}"; + String empty = "{\"data\":\"[]\",\"type\":\"info.nightscout.androidaps.plugins.general.automation.triggers.TriggerOr\"}"; + String oneItem = "{\"data\":\"[\\\"{\\\\\\\"data\\\\\\\":\\\\\\\"[]\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"info.nightscout.androidaps.plugins.general.automation.triggers.TriggerOr\\\\\\\"}\\\"]\",\"type\":\"info.nightscout.androidaps.plugins.general.automation.triggers.TriggerOr\"}"; @Test public void toJSONTest() { diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerTimeTest.java b/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTimeTest.java similarity index 89% rename from app/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerTimeTest.java rename to app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTimeTest.java index c8a53fa30a..4aa94e2f8c 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/TriggerTimeTest.java +++ b/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTimeTest.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.general.automation.actions; +package info.nightscout.androidaps.plugins.general.automation.triggers; import com.squareup.otto.Bus; @@ -16,6 +16,8 @@ import java.util.GregorianCalendar; import info.AAPSMocker; import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger; +import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerTime; import info.nightscout.utils.DateUtil; import info.nightscout.utils.T; @@ -51,7 +53,7 @@ public class TriggerTimeTest { } - String timeJson = "{\"data\":\"{\\\"saturday\\\":true,\\\"runAt\\\":1514766840000,\\\"lastRun\\\":0,\\\"recurring\\\":false,\\\"thursday\\\":true,\\\"minute\\\":0,\\\"sunday\\\":true,\\\"tuesday\\\":true,\\\"hour\\\":0,\\\"wednesday\\\":true,\\\"friday\\\":true,\\\"monday\\\":true,\\\"validTo\\\":0}\",\"type\":\"info.nightscout.androidaps.plugins.general.automation.actions.TriggerTime\"}"; + String timeJson = "{\"data\":\"{\\\"saturday\\\":true,\\\"runAt\\\":1514766840000,\\\"lastRun\\\":0,\\\"recurring\\\":false,\\\"thursday\\\":true,\\\"minute\\\":0,\\\"sunday\\\":true,\\\"tuesday\\\":true,\\\"hour\\\":0,\\\"wednesday\\\":true,\\\"friday\\\":true,\\\"monday\\\":true,\\\"validTo\\\":0}\",\"type\":\"info.nightscout.androidaps.plugins.general.automation.triggers.TriggerTime\"}"; @Test public void toJSONTest() {