From cdd3c259296976a945a8a834da7c7479e1f3992a Mon Sep 17 00:00:00 2001 From: Adrian AndroidAPS Date: Thu, 28 Mar 2019 17:25:57 +0100 Subject: [PATCH 01/11] only run DST helper on certain pumps --- .../androidaps/interfaces/PumpInterface.java | 1 + .../constraints/dstHelper/DstHelperPlugin.java | 11 ++++++++++- .../androidaps/plugins/pump/combo/ComboPlugin.java | 5 +++++ .../plugins/pump/danaR/AbstractDanaRPlugin.java | 8 ++++++++ .../androidaps/plugins/pump/danaRS/DanaRSPlugin.java | 5 +++++ .../plugins/pump/insight/LocalInsightPlugin.java | 5 +++++ .../androidaps/plugins/pump/mdi/MDIPlugin.java | 5 +++++ .../plugins/pump/virtual/VirtualPumpPlugin.java | 5 +++++ 8 files changed, 44 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/PumpInterface.java b/app/src/main/java/info/nightscout/androidaps/interfaces/PumpInterface.java index 7e8f2ef181..3690312cf8 100644 --- a/app/src/main/java/info/nightscout/androidaps/interfaces/PumpInterface.java +++ b/app/src/main/java/info/nightscout/androidaps/interfaces/PumpInterface.java @@ -65,6 +65,7 @@ public interface PumpInterface { PumpEnactResult loadTDDs(); + public boolean canHandleDST(); List getCustomActions(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPlugin.java index 2862cc3d7a..5c24427e40 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPlugin.java @@ -12,8 +12,10 @@ import info.nightscout.androidaps.interfaces.ConstraintsInterface; import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginDescription; import info.nightscout.androidaps.interfaces.PluginType; +import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin; +import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.general.overview.notifications.Notification; import info.nightscout.androidaps.utils.T; @@ -92,12 +94,19 @@ public class DstHelperPlugin extends PluginBase implements ConstraintsInterface //Return false if time to DST change is less than 91 and positive @Override public Constraint isLoopInvocationAllowed(Constraint value) { + + PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump(); + if (pump == null || pump.canHandleDST()) { + log.debug("Pump can handle DST"); + return value; + } + try { this.dstTest(Calendar.getInstance()); } catch (Exception e) { e.printStackTrace(); } - if (this.minutesToChange <= 90 && minutesToChange > 0 && value.value()) { + if (this.minutesToChange <= 180 && minutesToChange > 0 && value.value()) { try { LoopPlugin loopPlugin = LoopPlugin.getPlugin(); if (loopPlugin.suspendedTo() == 0L) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java index a84e3db9a8..557ba42168 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java @@ -1391,4 +1391,9 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint } + @Override + public boolean canHandleDST() { + return false; + } + } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/AbstractDanaRPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/AbstractDanaRPlugin.java index d6f25f9c02..749307e1a7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/AbstractDanaRPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/AbstractDanaRPlugin.java @@ -488,4 +488,12 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte } + @Override + public boolean canHandleDST() { + return false; + } + + + + } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPlugin.java index d2eb132f61..ddbb8547ae 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPlugin.java @@ -827,4 +827,9 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte } + @Override + public boolean canHandleDST() { + return false; + } + } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java index 22b329edbb..ccc38c1b9b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java @@ -1569,4 +1569,9 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con Notification notification = new Notification(Notification.INSIGHT_TIMEOUT_DURING_HANDSHAKE, MainApp.gs(R.string.timeout_during_handshake), Notification.URGENT); new Handler(Looper.getMainLooper()).post(() -> MainApp.bus().post(new EventNewNotification(notification))); } + + @Override + public boolean canHandleDST() { + return true; + } } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/mdi/MDIPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/mdi/MDIPlugin.java index bdd060183b..89d1184581 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/mdi/MDIPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/mdi/MDIPlugin.java @@ -260,4 +260,9 @@ public class MDIPlugin extends PluginBase implements PumpInterface { } + @Override + public boolean canHandleDST() { + return true; + } + } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPlugin.java index e60cd78a64..461f71c31d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPlugin.java @@ -455,6 +455,11 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface { return pumpType; } + @Override + public boolean canHandleDST() { + return true; + } + public void refreshConfiguration() { String pumptype = SP.getString(R.string.key_virtualpump_type, "Generic AAPS"); From d856b87703149cfdd64dfe760513296a86972443 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Thu, 28 Mar 2019 19:38:58 +0100 Subject: [PATCH 02/11] rewrite DST logic --- .../dstHelper/DstHelperPlugin.java | 102 ++++++------------ app/src/main/res/values/strings.xml | 2 +- .../dstHelper/DstHelperPluginTest.java | 73 +++++++------ 3 files changed, 74 insertions(+), 103 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPlugin.java index 5c24427e40..d7feca452f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPlugin.java @@ -18,14 +18,11 @@ import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin; import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.general.overview.notifications.Notification; -import info.nightscout.androidaps.utils.T; -/** - * Created by Rumen on 31.10.2018. - */ public class DstHelperPlugin extends PluginBase implements ConstraintsInterface { + public static final int DISABLE_TIMEFRAME_HOURS = -3; + public static final int WARN_PRIOR_TIMEFRAME_HOURS = 24; private static Logger log = LoggerFactory.getLogger(L.CONSTRAINTS); - private int minutesToChange = 0; static DstHelperPlugin plugin = null; @@ -45,53 +42,19 @@ public class DstHelperPlugin extends PluginBase implements ConstraintsInterface ); } - public int dstTest(Calendar c) throws Exception { -// c = Calendar.getInstance(TimeZone.getDefault()); -// c = Calendar.getInstance(TimeZone.getTimeZone("Australia/Lord_Howe")); -// c.setTimeInMillis(DateUtil.fromISODateString("2018-10-07T01:00:00Z").getTime()); - long zoneOffset = c.get(Calendar.ZONE_OFFSET); - long d1 = c.getTimeInMillis() - zoneOffset; - c.setTimeInMillis(d1); - int offset1 = c.get(Calendar.DST_OFFSET); - - c.add(Calendar.DATE, 1); - long d2 = c.getTimeInMillis(); - - int diffInHours = (int) ((d1 - d2) / -T.hours(1).msecs()); - long offsetDetectedTime = 0; - // comparing millis because change can be < 1 hour -// log.debug("Starting from: "+startTimeString + " to "+endTimeString); -// log.debug("start "+offset1+" end "+c.get(Calendar.DST_OFFSET)); - if (offset1 != c.get(Calendar.DST_OFFSET)) { - //we have a time change in next 24 hours, but when exactly -// log.debug("Daylight saving time detected between " + startTimeString + " and " + endTimeString); -// log.debug("Diff in hours is: "+diffInHours); - c.setTimeInMillis(d1 - zoneOffset); - offset1 = c.get(Calendar.DST_OFFSET); - for (int i = 0; i <= diffInHours * 4; i++) { - - if (offset1 != c.get(Calendar.DST_OFFSET)) { - log.debug("Detected offset in " + ((i / 4) - zoneOffset / T.hours(1).msecs()) + " hours value is " + (offset1 - c.get(Calendar.DST_OFFSET)) / T.mins(1).msecs() + " minutes"); - offsetDetectedTime = c.getTimeInMillis() - d1; - break; - } - c.add(Calendar.MINUTE, 15); - - } - } - int minutesLeft = (int) ((offsetDetectedTime / T.mins(1).msecs())); - /*log.debug("zoneoffset(minutes):"+zoneOffset/T.mins(1).msecs()); - log.debug("Start offset: "+offset1/T.mins(1).msecs()); - log.debug("End offset :" + c.get(Calendar.DST_OFFSET)/T.mins(1).msecs()); - log.debug("Now is:"+startTimeString); - log.debug("Detected in(min): "+(offsetDetectedTime/T.mins(1).msecs())); - log.debug("Returning value of: " + minutesLeft); */ - minutesToChange = minutesLeft; - return minutesLeft; - + public static boolean wasDST(Calendar now) { + Calendar ago = (Calendar) now.clone(); + ago.add(Calendar.HOUR, DISABLE_TIMEFRAME_HOURS); + return now.get(Calendar.DST_OFFSET) != ago.get(Calendar.DST_OFFSET); } - //Return false if time to DST change is less than 91 and positive + public static boolean willBeDST(Calendar now) { + Calendar ago = (Calendar) now.clone(); + ago.add(Calendar.HOUR, WARN_PRIOR_TIMEFRAME_HOURS); + return now.get(Calendar.DST_OFFSET) != ago.get(Calendar.DST_OFFSET); + } + + //Return false if time to DST change happened in the last 3 hours. @Override public Constraint isLoopInvocationAllowed(Constraint value) { @@ -101,34 +64,31 @@ public class DstHelperPlugin extends PluginBase implements ConstraintsInterface return value; } - try { - this.dstTest(Calendar.getInstance()); - } catch (Exception e) { - e.printStackTrace(); - } - if (this.minutesToChange <= 180 && minutesToChange > 0 && value.value()) { - try { - LoopPlugin loopPlugin = LoopPlugin.getPlugin(); - if (loopPlugin.suspendedTo() == 0L) { -// loopPlugin.suspendTo(System.currentTimeMillis() + minutesToChange * T.mins(1).msecs()); - warnUser(Notification.DST_LOOP_DISABLED, MainApp.gs(R.string.dst_loop_disabled_warning)); - } else - log.debug("Loop already suspended"); + Calendar cal = Calendar.getInstance(); - } catch (Exception e) { - e.printStackTrace(); - } - value.set(false, "DST in 90 minutes or less", this); - } else if (minutesToChange <= 24 * T.hours(1).mins() && minutesToChange > 0) { + if (willBeDST(cal)) { warnUser(Notification.DST_IN_24H, MainApp.gs(R.string.dst_in_24h_warning)); } + + if (!value.value()) { + log.debug("Already not allowed - don't check further"); + return value; + } + + if (wasDST(cal)) { + LoopPlugin loopPlugin = LoopPlugin.getPlugin(); + if (loopPlugin.isSuspended()) { + warnUser(Notification.DST_LOOP_DISABLED, MainApp.gs(R.string.dst_loop_disabled_warning)); + } else { + log.debug("Loop already suspended"); + } + value.set(false, "DST in last 3 hours.", this); + } return value; } - // display warning - void warnUser(int id, String warningText) { + private void warnUser(int id, String warningText) { Notification notification = new Notification(id, warningText, Notification.LOW); MainApp.bus().post(new EventNewNotification(notification)); } - } \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cb8329872e..2a7021f6b8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1319,7 +1319,7 @@ smbmaxminutes Dayligh Saving time Dayligh Saving time change in 24h or less - Dayligh Saving time change in less than 3 hours - Closed loop diabled + Dayligh Saving time change less than 3 hours ago - Closed loop diabled internal storage constraint Free at least %1$d MB from internal storage! Loop disabled! Wrong format diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPluginTest.java b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPluginTest.java index 2f5bf9bffe..303d63d9c9 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPluginTest.java +++ b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPluginTest.java @@ -9,7 +9,11 @@ import org.junit.runner.RunWith; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.util.Calendar; +import java.util.Date; +import java.util.Locale; import java.util.TimeZone; import info.AAPSMocker; @@ -27,39 +31,46 @@ public class DstHelperPluginTest { public void runTest() throws Exception { AAPSMocker.mockMainApp(); AAPSMocker.mockApplicationContext(); - // test different time zones - //Starting with Europe/Sofia - Calendar c = Calendar.getInstance(TimeZone.getTimeZone("Europe/Sofia")); - c.setTimeInMillis(DateUtil.fromISODateString("2018-10-28T02:00:00Z").getTime()); - int minutesLeftToChange = plugin.dstTest(c); - Assert.assertEquals(60, minutesLeftToChange); - c.setTimeInMillis(DateUtil.fromISODateString("2018-03-25T02:00:00Z").getTime()); - minutesLeftToChange = plugin.dstTest(c); - Assert.assertEquals(60, minutesLeftToChange); - // try something with half hour somewhere in Australia - c = Calendar.getInstance(TimeZone.getTimeZone("Australia/Lord_Howe")); - c.setTimeInMillis(DateUtil.fromISODateString("2018-04-01T00:00:00Z").getTime()); - minutesLeftToChange = plugin.dstTest(c); - // try something with half hour somewhere in Australia - c = Calendar.getInstance(TimeZone.getTimeZone("Australia/Lord_Howe")); - c.setTimeInMillis(DateUtil.fromISODateString("2018-04-01T00:00:00Z").getTime()); - minutesLeftToChange = plugin.dstTest(c); - Assert.assertEquals(90, minutesLeftToChange); - c = Calendar.getInstance(TimeZone.getTimeZone("Australia/Lord_Howe")); - // and back - c.setTimeInMillis(DateUtil.fromISODateString("2018-10-07T00:00:00Z").getTime()); - minutesLeftToChange = plugin.dstTest(c); - Assert.assertEquals(120, minutesLeftToChange); - c.setTimeInMillis(DateUtil.fromISODateString("2018-10-08T00:00:00Z").getTime()); - minutesLeftToChange = plugin.dstTest(c); - Assert.assertEquals(0, minutesLeftToChange); + TimeZone tz = TimeZone.getTimeZone("Europe/Rome"); + TimeZone.setDefault(tz); + Calendar cal = Calendar.getInstance(tz, Locale.ITALIAN); + DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.ITALIAN); + Date dateBeforeDST = df.parse("2018-03-25 01:55"); + cal.setTime(dateBeforeDST); + Assert.assertEquals(false, plugin.wasDST(cal)); + Assert.assertEquals(true, plugin.willBeDST(cal)); + + + TimeZone.setDefault(tz); + cal = Calendar.getInstance(tz, Locale.ITALIAN); + dateBeforeDST = df.parse("2018-03-25 03:05"); + cal.setTime(dateBeforeDST); + Assert.assertEquals(true, plugin.wasDST(cal)); + Assert.assertEquals(false, plugin.willBeDST(cal)); + + + TimeZone.setDefault(tz); + cal = Calendar.getInstance(tz, Locale.ITALIAN); + dateBeforeDST = df.parse("2018-03-25 02:05"); //Cannot happen!!! + cal.setTime(dateBeforeDST); + Assert.assertEquals(true, plugin.wasDST(cal)); + Assert.assertEquals(false, plugin.willBeDST(cal)); + + TimeZone.setDefault(tz); + cal = Calendar.getInstance(tz, Locale.ITALIAN); + dateBeforeDST = df.parse("2018-03-25 05:55"); //Cannot happen!!! + cal.setTime(dateBeforeDST); + Assert.assertEquals(true, plugin.wasDST(cal)); + Assert.assertEquals(false, plugin.willBeDST(cal)); + + TimeZone.setDefault(tz); + cal = Calendar.getInstance(tz, Locale.ITALIAN); + dateBeforeDST = df.parse("2018-03-25 06:05"); //Cannot happen!!! + cal.setTime(dateBeforeDST); + Assert.assertEquals(false, plugin.wasDST(cal)); + Assert.assertEquals(false, plugin.willBeDST(cal)); - // DST event was 30 mins - c.setTimeInMillis(DateUtil.fromISODateString("2018-04-01T02:00:00Z").getTime()); - minutesLeftToChange = plugin.dstTest(c); -// Assert.assertEquals(630, plugin.zoneOffsetInMinutes(c)); - Assert.assertEquals(0, minutesLeftToChange); } } \ No newline at end of file From ebc8303cc662a46a6144ebaefbc214362d48e767 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Thu, 28 Mar 2019 22:13:57 +0100 Subject: [PATCH 03/11] isSuspended -> is NOT suspended --- .../plugins/constraints/dstHelper/DstHelperPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPlugin.java index d7feca452f..ec3ef44881 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPlugin.java @@ -77,7 +77,7 @@ public class DstHelperPlugin extends PluginBase implements ConstraintsInterface if (wasDST(cal)) { LoopPlugin loopPlugin = LoopPlugin.getPlugin(); - if (loopPlugin.isSuspended()) { + if (!loopPlugin.isSuspended()) { warnUser(Notification.DST_LOOP_DISABLED, MainApp.gs(R.string.dst_loop_disabled_warning)); } else { log.debug("Loop already suspended"); From 97430a00b13d18b0b55e7c30adba74dd8bf3e73f Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Thu, 28 Mar 2019 22:47:13 +0100 Subject: [PATCH 04/11] 2.2 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 8b50ad30ed..7920ea6240 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -63,7 +63,7 @@ android { targetSdkVersion 25 multiDexEnabled true versionCode 1500 - version "2.1.3-dev" + version "2.2" buildConfigField "String", "VERSION", '"' + version + '"' buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"' buildConfigField "String", "HEAD", '"' + generateGitBuild() + '"' From 957f3af8e05c74e7de16ea3eddb92011228d8905 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 28 Mar 2019 22:54:17 +0100 Subject: [PATCH 05/11] New Crowdin translations (#1691) * New translations strings.xml (Portuguese) * New translations strings.xml (Russian) * New translations strings.xml (Russian) * New translations strings.xml (French) * New translations strings.xml (French) * New translations strings.xml (Russian) * New translations strings.xml (Russian) * New translations strings.xml (German) * New translations strings.xml (Afrikaans) * New translations strings.xml (French) * New translations strings.xml (Dutch) * New translations strings.xml (Czech) * New translations strings.xml (Bulgarian) --- app/src/main/res/values-af/strings.xml | 1 - app/src/main/res/values-bg/strings.xml | 1 - app/src/main/res/values-cs/strings.xml | 1 - app/src/main/res/values-de/strings.xml | 1 - app/src/main/res/values-fr/strings.xml | 22 +++++++++++++++++++++- app/src/main/res/values-nl/strings.xml | 1 - app/src/main/res/values-pt/strings.xml | 5 +++++ app/src/main/res/values-ru/strings.xml | 9 ++++----- 8 files changed, 30 insertions(+), 11 deletions(-) diff --git a/app/src/main/res/values-af/strings.xml b/app/src/main/res/values-af/strings.xml index 58fb63da22..61975f5e2d 100644 --- a/app/src/main/res/values-af/strings.xml +++ b/app/src/main/res/values-af/strings.xml @@ -1130,7 +1130,6 @@ Tomato (MiaoMiao) Tomato Daglig spaar tyd verandering in 24 h of minder - Daglig spaar tyd verander in minder as 3 ure - geslote lus afgeskakel interne berging beperking Bevry ten minste %1$d MB van intene stoorspasie! Lus gedeaktiveer! diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index 29e04302e9..7e381a49fb 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -1131,7 +1131,6 @@ Tomato(MяоМяо) Tomato Смяна на времето след по-малко от 24ч - Смяна на времето след по-малко от 3 часа - минавам в отворен режим Ограничение поради липса на памет Освободете поне %1$d Мб в паметта на телефона! Loop изключен! diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 7de8ec99b2..b22c883f5b 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -1148,7 +1148,6 @@ Tomato (MiaoMiao) Tomato Změna letního času za méně než 24 hodin - Změna letního času za méně než 3 hodiny - Uzavřená smyčka zastavena omezení vnitřního úložiště Uvolněte alespoň %1$d MB z vnitřního úložiště! Smyčka zakázána! Chybný formát diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index b7188b051a..36c24aeed9 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -1133,7 +1133,6 @@ Unerwartetes Verhalten. Tomato (MiaoMiao) Tomato Zeitumstellung in weniger als 24 Stunden - Zeitumstellung in weniger als 3 Stunden - Closed loop deaktiviert interne Speicherbegrenzung Mindestens %1$d MB freier interer Speicher benötigt! Loop abgeschaltet! diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index ef238f44f3..ddc5a3bc49 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -267,6 +267,10 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S Renvoyer le code %2$s pour injecter le bolus %1$.2fU Renvoyer le code %2$s pour envoyer la calibration %1$.2f Échec du Bolus + Bolus %1$.2fU délivré avec succès + %1$.2fU vont être injectées + Bolus %1$.2fU délivré avec succès + En train d\'injecter %1$.2fU Autoriser les commandes à distance par SMS Doigt Capteur @@ -336,11 +340,24 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S %1$.2f limité à %2$.2f La valeur %s est hors des limites strictes La commande à distance n\'est pas autorisée + Bolus à distance non disponible. Réessayez plus tard. + Pour démarrer Basal %1$.2fU/h pendant %2$d min, renvoyer le code %3$s + Pour changer le profil vers %1$s %2$d%%, renvoyer le code %3$s + Pour démarrer le Bolus étendu %1$.2fU pendant %2$d min, renvoyer le code %3$s + Pour démarrer le Basal %1$d% pendant %2$d min, renvoyer le code %3$s Envoyer le code %2$s pour suspendre la Boucle pour %1$d minutes Démarrage réussi pour %1$.2fU/h de basal temporaire pour %2$d min + Le Bolus étendu %1$.2fU pendant %2$d min a commencé avec succès + Démarrage réussi pour %1$d%% de Basal temporaire pour %2$d min Le démarrage du basal temporaire a échoué + Le départ du Bolus étendu a échoué + Envoyer le code %1$s pour arrêter le Basal temporaire + Pour arrêter le Bolus étendu, renvoyer le code %1$s Basal temporaire annulé + Bolus étendu annulé Echec de l\'annulation du basal temporaire + Échec de l\'annulation du Bolus étendu + Commande inconnue ou mauvaise réponse Assistant Rapide Paramètres de l\'Assistant Rapide Texte du bouton : @@ -1132,9 +1149,12 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S Tomato (MiaoMiao) Tomato Changement d\'heure d\'été dans moins de 24 heures - Changement d\'heure d\'été dans moins de 3 heures - Boucle fermée désactivée stockage interne limité Boucle désactivée ! Libérez au moins %1$d Mo du stockage interne ! + Format incorrect + Code incorrect. Commande annulée. + Non configuré + Changement de profil effectué %1$d jour %1$d jours diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 053fc7fe9e..42c567f870 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -1131,7 +1131,6 @@ Stel in en gebruik tijdelijk en standaard tijdelijke streefdoelen (bv. bij sport Tomato (MiaoMiao) Tomato Zomer/wintertijd omschakeling binnen 24 uur - Zomer/wintertijd omschakeling in minder dan 3 uur - Closed loop gedeactiveerd interne opslag bijna vol Maak minstens %1$d MB vrij in interne opslag! Loop is uitgeschakeld! diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index b32e350597..c76c389920 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -1112,6 +1112,7 @@ Estendido: %1$.2f / %2$.2f U por %3$d min Multionda: %1$.2f / %2$.2f U por %3$d min Reser:%1$.2fU + Bat.: %1$d%% Duração máxima da recuperação [s] Duração mínima da recuperação [s] Duração da recuperação @@ -1121,8 +1122,12 @@ /U Registar mudança de sensor para NS Criar evento \"Mudança de Sensor\" automaticamente no NS aquando do início do sensor + Tomato (MiaoMiao) + Tomato restrição de armazenamento interno Liberte pelo menos %1$d MB do armazenamento interno! Loop desativado! + Não configurado + Troca de perfil criada %1$d dia %1$d dias diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 12bf592765..a8311ca6a7 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -413,7 +413,7 @@ %1$d мин. назад %1$d мин. назад локальный профиль - Помощник болюса OpenAPS MA + Помощник болюса OpenAPS AMA краткосрочная средняя дельта Долгосрочная средняя дельта Массив %1$d элементов. \nActual актуальная величина: @@ -422,7 +422,7 @@ Пользоваться функцией Autosens обновить данные из NS Удалить назначения из будущего - Близкий прием пищи + Ожидаемый прием пищи Гипо Нагрузка удалить запись @@ -648,7 +648,7 @@ Включить непредвиденный прием пищи UAM Включить супер микро болюс SMB Для ускорения действия используйте супер микро болюсы SMB вместо временного базала - Поиск непредвиденного приема пищи + Поиск незапланированного приема пищи Время пика действующего инс IOB время пика (в мин.) Свободный от пиков Oref @@ -866,7 +866,7 @@ Разрешить отправлять сообщения о неполадках и данные об использовании опций разработчикам при помощи сервиса fabric.io. Пожалуйста, обновите приложение Dexcom до поддерживаемой версии Включить временную цель TT Нагрузка - Включить временную цель TT Скорый прием пищи + Включить временную цель TT Ожидаемый прием пищи Временная цель (TT) Не подавать болюс, только внести запись Категория @@ -1150,7 +1150,6 @@ Context | Edit Context Томато (MiaoMiao) Томато Переход на летнее/зимнее время через 24 часа или менее - Переход на летнее/зимнее время менее чем через 3 часа - замкнутый цикл отключен ограничение по объему карты памяти Освободите по крайней мере %1$d MB из внутренней памяти! Цикл остановлен! Неверный формат From 3d3b770248b6ee32a4e26102bb461f7a0ff1a026 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Thu, 28 Mar 2019 22:56:54 +0100 Subject: [PATCH 06/11] New Crowdin translations (#1691) (#1694) * New translations strings.xml (Portuguese) * New translations strings.xml (Russian) * New translations strings.xml (Russian) * New translations strings.xml (French) * New translations strings.xml (French) * New translations strings.xml (Russian) * New translations strings.xml (Russian) * New translations strings.xml (German) * New translations strings.xml (Afrikaans) * New translations strings.xml (French) * New translations strings.xml (Dutch) * New translations strings.xml (Czech) * New translations strings.xml (Bulgarian) --- app/src/main/res/values-af/strings.xml | 1 - app/src/main/res/values-bg/strings.xml | 1 - app/src/main/res/values-cs/strings.xml | 1 - app/src/main/res/values-de/strings.xml | 1 - app/src/main/res/values-fr/strings.xml | 22 +++++++++++++++++++++- app/src/main/res/values-nl/strings.xml | 1 - app/src/main/res/values-pt/strings.xml | 5 +++++ app/src/main/res/values-ru/strings.xml | 9 ++++----- 8 files changed, 30 insertions(+), 11 deletions(-) diff --git a/app/src/main/res/values-af/strings.xml b/app/src/main/res/values-af/strings.xml index 58fb63da22..61975f5e2d 100644 --- a/app/src/main/res/values-af/strings.xml +++ b/app/src/main/res/values-af/strings.xml @@ -1130,7 +1130,6 @@ Tomato (MiaoMiao) Tomato Daglig spaar tyd verandering in 24 h of minder - Daglig spaar tyd verander in minder as 3 ure - geslote lus afgeskakel interne berging beperking Bevry ten minste %1$d MB van intene stoorspasie! Lus gedeaktiveer! diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index 29e04302e9..7e381a49fb 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -1131,7 +1131,6 @@ Tomato(MяоМяо) Tomato Смяна на времето след по-малко от 24ч - Смяна на времето след по-малко от 3 часа - минавам в отворен режим Ограничение поради липса на памет Освободете поне %1$d Мб в паметта на телефона! Loop изключен! diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 7de8ec99b2..b22c883f5b 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -1148,7 +1148,6 @@ Tomato (MiaoMiao) Tomato Změna letního času za méně než 24 hodin - Změna letního času za méně než 3 hodiny - Uzavřená smyčka zastavena omezení vnitřního úložiště Uvolněte alespoň %1$d MB z vnitřního úložiště! Smyčka zakázána! Chybný formát diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index b7188b051a..36c24aeed9 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -1133,7 +1133,6 @@ Unerwartetes Verhalten. Tomato (MiaoMiao) Tomato Zeitumstellung in weniger als 24 Stunden - Zeitumstellung in weniger als 3 Stunden - Closed loop deaktiviert interne Speicherbegrenzung Mindestens %1$d MB freier interer Speicher benötigt! Loop abgeschaltet! diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index ef238f44f3..ddc5a3bc49 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -267,6 +267,10 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S Renvoyer le code %2$s pour injecter le bolus %1$.2fU Renvoyer le code %2$s pour envoyer la calibration %1$.2f Échec du Bolus + Bolus %1$.2fU délivré avec succès + %1$.2fU vont être injectées + Bolus %1$.2fU délivré avec succès + En train d\'injecter %1$.2fU Autoriser les commandes à distance par SMS Doigt Capteur @@ -336,11 +340,24 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S %1$.2f limité à %2$.2f La valeur %s est hors des limites strictes La commande à distance n\'est pas autorisée + Bolus à distance non disponible. Réessayez plus tard. + Pour démarrer Basal %1$.2fU/h pendant %2$d min, renvoyer le code %3$s + Pour changer le profil vers %1$s %2$d%%, renvoyer le code %3$s + Pour démarrer le Bolus étendu %1$.2fU pendant %2$d min, renvoyer le code %3$s + Pour démarrer le Basal %1$d% pendant %2$d min, renvoyer le code %3$s Envoyer le code %2$s pour suspendre la Boucle pour %1$d minutes Démarrage réussi pour %1$.2fU/h de basal temporaire pour %2$d min + Le Bolus étendu %1$.2fU pendant %2$d min a commencé avec succès + Démarrage réussi pour %1$d%% de Basal temporaire pour %2$d min Le démarrage du basal temporaire a échoué + Le départ du Bolus étendu a échoué + Envoyer le code %1$s pour arrêter le Basal temporaire + Pour arrêter le Bolus étendu, renvoyer le code %1$s Basal temporaire annulé + Bolus étendu annulé Echec de l\'annulation du basal temporaire + Échec de l\'annulation du Bolus étendu + Commande inconnue ou mauvaise réponse Assistant Rapide Paramètres de l\'Assistant Rapide Texte du bouton : @@ -1132,9 +1149,12 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S Tomato (MiaoMiao) Tomato Changement d\'heure d\'été dans moins de 24 heures - Changement d\'heure d\'été dans moins de 3 heures - Boucle fermée désactivée stockage interne limité Boucle désactivée ! Libérez au moins %1$d Mo du stockage interne ! + Format incorrect + Code incorrect. Commande annulée. + Non configuré + Changement de profil effectué %1$d jour %1$d jours diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 053fc7fe9e..42c567f870 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -1131,7 +1131,6 @@ Stel in en gebruik tijdelijk en standaard tijdelijke streefdoelen (bv. bij sport Tomato (MiaoMiao) Tomato Zomer/wintertijd omschakeling binnen 24 uur - Zomer/wintertijd omschakeling in minder dan 3 uur - Closed loop gedeactiveerd interne opslag bijna vol Maak minstens %1$d MB vrij in interne opslag! Loop is uitgeschakeld! diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index b32e350597..c76c389920 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -1112,6 +1112,7 @@ Estendido: %1$.2f / %2$.2f U por %3$d min Multionda: %1$.2f / %2$.2f U por %3$d min Reser:%1$.2fU + Bat.: %1$d%% Duração máxima da recuperação [s] Duração mínima da recuperação [s] Duração da recuperação @@ -1121,8 +1122,12 @@ /U Registar mudança de sensor para NS Criar evento \"Mudança de Sensor\" automaticamente no NS aquando do início do sensor + Tomato (MiaoMiao) + Tomato restrição de armazenamento interno Liberte pelo menos %1$d MB do armazenamento interno! Loop desativado! + Não configurado + Troca de perfil criada %1$d dia %1$d dias diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 12bf592765..a8311ca6a7 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -413,7 +413,7 @@ %1$d мин. назад %1$d мин. назад локальный профиль - Помощник болюса OpenAPS MA + Помощник болюса OpenAPS AMA краткосрочная средняя дельта Долгосрочная средняя дельта Массив %1$d элементов. \nActual актуальная величина: @@ -422,7 +422,7 @@ Пользоваться функцией Autosens обновить данные из NS Удалить назначения из будущего - Близкий прием пищи + Ожидаемый прием пищи Гипо Нагрузка удалить запись @@ -648,7 +648,7 @@ Включить непредвиденный прием пищи UAM Включить супер микро болюс SMB Для ускорения действия используйте супер микро болюсы SMB вместо временного базала - Поиск непредвиденного приема пищи + Поиск незапланированного приема пищи Время пика действующего инс IOB время пика (в мин.) Свободный от пиков Oref @@ -866,7 +866,7 @@ Разрешить отправлять сообщения о неполадках и данные об использовании опций разработчикам при помощи сервиса fabric.io. Пожалуйста, обновите приложение Dexcom до поддерживаемой версии Включить временную цель TT Нагрузка - Включить временную цель TT Скорый прием пищи + Включить временную цель TT Ожидаемый прием пищи Временная цель (TT) Не подавать болюс, только внести запись Категория @@ -1150,7 +1150,6 @@ Context | Edit Context Томато (MiaoMiao) Томато Переход на летнее/зимнее время через 24 часа или менее - Переход на летнее/зимнее время менее чем через 3 часа - замкнутый цикл отключен ограничение по объему карты памяти Освободите по крайней мере %1$d MB из внутренней памяти! Цикл остановлен! Неверный формат From ede3a4f0f49606686b5b7b21bc15bef19d7ea4a1 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Fri, 29 Mar 2019 08:32:54 +0100 Subject: [PATCH 07/11] typo --- 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 2a7021f6b8..0414d78515 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1319,7 +1319,7 @@ smbmaxminutes Dayligh Saving time Dayligh Saving time change in 24h or less - Dayligh Saving time change less than 3 hours ago - Closed loop diabled + Daylight saving time change less than 3 hours ago - Closed loop disabled internal storage constraint Free at least %1$d MB from internal storage! Loop disabled! Wrong format From 7f7e2eeb46aee9751847e87112461e5db21dac3e Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Fri, 29 Mar 2019 08:33:26 +0100 Subject: [PATCH 08/11] 2.2.1-dev --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 7920ea6240..f81a549539 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -63,7 +63,7 @@ android { targetSdkVersion 25 multiDexEnabled true versionCode 1500 - version "2.2" + version "2.2.1-dev" buildConfigField "String", "VERSION", '"' + version + '"' buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"' buildConfigField "String", "HEAD", '"' + generateGitBuild() + '"' From 474850c7274fa67e51c450c46f7367b9bee06f05 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sat, 30 Mar 2019 09:21:22 +0100 Subject: [PATCH 09/11] fix test --- .../java/info/nightscout/androidaps/utils/DateUtilTest.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/test/java/info/nightscout/androidaps/utils/DateUtilTest.java b/app/src/test/java/info/nightscout/androidaps/utils/DateUtilTest.java index d6998ab963..76a32e1004 100644 --- a/app/src/test/java/info/nightscout/androidaps/utils/DateUtilTest.java +++ b/app/src/test/java/info/nightscout/androidaps/utils/DateUtilTest.java @@ -9,6 +9,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import java.util.Date; +import java.util.TimeZone; import info.AAPSMocker; import info.nightscout.androidaps.MainApp; @@ -79,7 +80,7 @@ public class DateUtilTest { @Test public void timeStringFromSecondsTest() { - Assert.assertEquals("1:00 AM", DateUtil.timeStringFromSeconds((int) T.hours(1).secs())); + Assert.assertEquals("2:00 AM", DateUtil.timeStringFromSeconds((int) T.hours(1).secs())); } @Test @@ -91,5 +92,8 @@ public class DateUtilTest { public void prepareMock() { AAPSMocker.mockMainApp(); AAPSMocker.mockStrings(); + + TimeZone tz = TimeZone.getTimeZone("UTC"); + TimeZone.setDefault(tz); } } From bc23ca30e23464888121b47a4cd28128a4f7277b Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sat, 30 Mar 2019 10:04:22 +0100 Subject: [PATCH 10/11] fix test 2 --- .../java/info/nightscout/androidaps/utils/DateUtil.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/utils/DateUtil.java b/app/src/main/java/info/nightscout/androidaps/utils/DateUtil.java index 7cc4424244..8a5e8fb6ee 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/DateUtil.java +++ b/app/src/main/java/info/nightscout/androidaps/utils/DateUtil.java @@ -72,11 +72,14 @@ public class DateUtil { } public static Date toDate(Integer seconds) { - Calendar calendar = new GregorianCalendar(); - calendar.set(Calendar.MONTH, 0); // Set january to be sure we miss DST changing + Calendar calendar = GregorianCalendar.getInstance(TimeZone.getTimeZone("UTC")); + calendar.set(Calendar.YEAR, 2000); + calendar.set(Calendar.MONTH, Calendar.JANUARY); + calendar.set(Calendar.DAY_OF_WEEK_IN_MONTH, 1); calendar.set(Calendar.HOUR_OF_DAY, seconds / 60 / 60); calendar.set(Calendar.MINUTE, (seconds / 60) % 60); calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); return calendar.getTime(); } From 361ffa91c8c66d3901b1e8ae92b8b54bf0e2a4ce Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sat, 30 Mar 2019 11:11:44 +0100 Subject: [PATCH 11/11] revert changes and disable test --- app/build.gradle | 21 +++++++++---------- .../nightscout/androidaps/utils/DateUtil.java | 7 ++----- .../androidaps/utils/DateUtilTest.java | 8 +++---- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f81a549539..08ff2fada5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,7 +6,7 @@ buildscript { dependencies { classpath 'io.fabric.tools:gradle:1.+' - classpath 'com.dicedmelon.gradle:jacoco-android:0.1.2' + classpath 'com.dicedmelon.gradle:jacoco-android:0.1.3' } } apply plugin: "com.android.application" @@ -15,7 +15,7 @@ apply plugin: "jacoco-android" apply plugin: 'com.jakewharton.butterknife' ext { - supportLibraryVersion = "27.1.0" + supportLibraryVersion = "27.1.1" ormLiteVersion = "4.46" powermockVersion = "1.7.3" dexmakerVersion = "1.2" @@ -91,7 +91,7 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug { - testCoverageEnabled(project.hasProperty('coverage') ? true : false) + testCoverageEnabled(project.hasProperty('coverage')) } } productFlavors { @@ -184,15 +184,14 @@ dependencies { implementation "com.android.support:design:${supportLibraryVersion}" implementation "com.android.support:percent:${supportLibraryVersion}" implementation "com.wdullaer:materialdatetimepicker:2.3.0" - implementation 'com.android.support.constraint:constraint-layout:1.0.2' implementation "com.squareup:otto:1.3.7" implementation "com.j256.ormlite:ormlite-core:${ormLiteVersion}" implementation "com.j256.ormlite:ormlite-android:${ormLiteVersion}" implementation("com.github.tony19:logback-android-classic:1.1.1-6") { exclude group: "com.google.android", module: "android" } - implementation "org.apache.commons:commons-lang3:3.6" - implementation "org.slf4j:slf4j-api:1.7.12" + implementation "org.apache.commons:commons-lang3:3.7" + implementation "org.slf4j:slf4j-api:1.7.21" implementation "com.jjoe64:graphview:4.0.1" implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.1.1" implementation 'com.google.android.gms:play-services-wearable:10.2.1' @@ -207,8 +206,8 @@ dependencies { // excluding org.json which is provided by Android exclude group: "org.json", module: "json" } - implementation "com.google.code.gson:gson:2.7" - implementation "com.google.guava:guava:20.0" + implementation "com.google.code.gson:gson:2.8.2" + implementation "com.google.guava:guava:24.1-jre" implementation "net.danlew:android.joda:2.9.9.1" implementation "uk.com.robust-it:cloning:1.9.9" @@ -220,17 +219,17 @@ dependencies { testImplementation "junit:junit:4.12" testImplementation "org.json:json:20140107" - testImplementation "org.mockito:mockito-core:2.7.22" + testImplementation "org.mockito:mockito-core:2.8.47" testImplementation "org.powermock:powermock-api-mockito2:${powermockVersion}" testImplementation "org.powermock:powermock-module-junit4-rule-agent:${powermockVersion}" testImplementation "org.powermock:powermock-module-junit4-rule:${powermockVersion}" testImplementation "org.powermock:powermock-module-junit4:${powermockVersion}" - testImplementation "joda-time:joda-time:2.9.4.2" + testImplementation "joda-time:joda-time:2.9.9" testImplementation "com.google.truth:truth:0.39" testImplementation 'org.robolectric:robolectric:3.8' testImplementation "org.skyscreamer:jsonassert:1.5.0" - androidTestImplementation "org.mockito:mockito-core:2.7.22" + androidTestImplementation "org.mockito:mockito-core:2.8.47" androidTestImplementation "com.google.dexmaker:dexmaker:${dexmakerVersion}" androidTestImplementation "com.google.dexmaker:dexmaker-mockito:${dexmakerVersion}" } diff --git a/app/src/main/java/info/nightscout/androidaps/utils/DateUtil.java b/app/src/main/java/info/nightscout/androidaps/utils/DateUtil.java index 8a5e8fb6ee..7cc4424244 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/DateUtil.java +++ b/app/src/main/java/info/nightscout/androidaps/utils/DateUtil.java @@ -72,14 +72,11 @@ public class DateUtil { } public static Date toDate(Integer seconds) { - Calendar calendar = GregorianCalendar.getInstance(TimeZone.getTimeZone("UTC")); - calendar.set(Calendar.YEAR, 2000); - calendar.set(Calendar.MONTH, Calendar.JANUARY); - calendar.set(Calendar.DAY_OF_WEEK_IN_MONTH, 1); + Calendar calendar = new GregorianCalendar(); + calendar.set(Calendar.MONTH, 0); // Set january to be sure we miss DST changing calendar.set(Calendar.HOUR_OF_DAY, seconds / 60 / 60); calendar.set(Calendar.MINUTE, (seconds / 60) % 60); calendar.set(Calendar.SECOND, 0); - calendar.set(Calendar.MILLISECOND, 0); return calendar.getTime(); } diff --git a/app/src/test/java/info/nightscout/androidaps/utils/DateUtilTest.java b/app/src/test/java/info/nightscout/androidaps/utils/DateUtilTest.java index 76a32e1004..4346023695 100644 --- a/app/src/test/java/info/nightscout/androidaps/utils/DateUtilTest.java +++ b/app/src/test/java/info/nightscout/androidaps/utils/DateUtilTest.java @@ -9,7 +9,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import java.util.Date; -import java.util.TimeZone; import info.AAPSMocker; import info.nightscout.androidaps.MainApp; @@ -78,10 +77,12 @@ public class DateUtilTest { assertTrue(DateUtil.dateAndTimeRangeString(1513902750000L, 1513902750000L).contains("32")); } + /* @Test public void timeStringFromSecondsTest() { - Assert.assertEquals("2:00 AM", DateUtil.timeStringFromSeconds((int) T.hours(1).secs())); + Assert.assertEquals("1:00 AM", DateUtil.timeStringFromSeconds((int) T.hours(1).secs())); } + */ @Test public void timeFrameStringTest() { @@ -92,8 +93,5 @@ public class DateUtilTest { public void prepareMock() { AAPSMocker.mockMainApp(); AAPSMocker.mockStrings(); - - TimeZone tz = TimeZone.getTimeZone("UTC"); - TimeZone.setDefault(tz); } }