From 13ad74f77b7ffe3296b240cd9297a32eab444b2a Mon Sep 17 00:00:00 2001 From: Andrew Warrington Date: Sat, 6 Jan 2018 14:21:31 +0100 Subject: [PATCH 1/4] Steampunk watch face: Chart readability improvement; point size increases when chert is highly zoomed in (less than 3 hours shown). --- .../nightscout/androidaps/watchfaces/Steampunk.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/Steampunk.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/Steampunk.java index 06f50edfb0..3549b2a67d 100644 --- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/Steampunk.java +++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/Steampunk.java @@ -178,7 +178,11 @@ public class Steampunk extends BaseWatchFace { gridColor = ContextCompat.getColor(getApplicationContext(), R.color.grey_steampunk); basalBackgroundColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark); basalCenterColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark); - pointSize = 1; + if (Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3")) < 3) { + pointSize = 2; + } else { + pointSize = 1; + } setupCharts(); } @@ -237,7 +241,12 @@ public class Steampunk extends BaseWatchFace { private void changeChartTimeframe() { int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3")); timeframe = (timeframe%5) + 1; + if (timeframe < 3) { + pointSize = 2; + } else { + pointSize = 1; + } + setupCharts(); sharedPrefs.edit().putString("chart_timeframe", "" + timeframe).commit(); } - } \ No newline at end of file From 06d949cd8248bcb045975942a8c8c77d842bcff3 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Wed, 10 Jan 2018 10:48:44 +0100 Subject: [PATCH 2/4] Avoid race condition checking for an active TBR. --- .../PersistentNotificationPlugin.java | 4 ++-- .../androidaps/plugins/Treatments/TreatmentsPlugin.java | 6 ++++-- .../plugins/XDripStatusline/StatuslinePlugin.java | 5 ++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationPlugin.java index dc67a1449d..9e631def18 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationPlugin.java @@ -139,8 +139,8 @@ public class PersistentNotificationPlugin implements PluginBase { } } - if (MainApp.getConfigBuilder().isTempBasalInProgress()) { - TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis()); + TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis()); + if (activeTemp != null) { line1 += " " + activeTemp.toStringShort(); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java index 8f0dca4996..1cd45d9f03 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java @@ -403,8 +403,10 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface { @Override public double getTempBasalRemainingMinutesFromHistory() { - if (isTempBasalInProgress()) - return getTempBasalFromHistory(System.currentTimeMillis()).getPlannedRemainingMinutes(); + TemporaryBasal activeTemp = getTempBasalFromHistory(System.currentTimeMillis()); + if (activeTemp != null) { + return activeTemp.getPlannedRemainingMinutes(); + } return 0; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java index 60d784d377..5fb902c2eb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java @@ -182,10 +182,9 @@ public class StatuslinePlugin implements PluginBase { //Temp basal TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder(); - if (treatmentsInterface.isTempBasalInProgress()) { - TemporaryBasal activeTemp = treatmentsInterface.getTempBasalFromHistory(System.currentTimeMillis()); + TemporaryBasal activeTemp = treatmentsInterface.getTempBasalFromHistory(System.currentTimeMillis()); + if (activeTemp != null) { status += activeTemp.toStringShort(); - } //IOB From 27dcb40f48b959c935a7eb90cd34a8df368377b7 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Wed, 10 Jan 2018 22:44:18 +0100 Subject: [PATCH 3/4] Add null check in ConfigBuildPlugin.getTempBasalFromHistory. --- .../androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java index 03f0f60341..62848b7e5e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java @@ -631,7 +631,7 @@ public class ConfigBuilderPlugin implements PluginBase, ConstraintsInterface, Tr @Override @Nullable public TemporaryBasal getTempBasalFromHistory(long time) { - return activeTreatments.getTempBasalFromHistory(time); + return activeTreatments != null ? activeTreatments.getTempBasalFromHistory(time) : null; } @Override From f5cc2debd7f9a69e50dcffd4a88bce57e9f2ba53 Mon Sep 17 00:00:00 2001 From: "Markus M. May" Date: Sat, 13 Jan 2018 21:34:38 +0100 Subject: [PATCH 4/4] Cleanup gradle build files --- app/build.gradle | 94 ++++++++++++++++++++++++++--------------------- wear/build.gradle | 21 +++++++---- 2 files changed, 65 insertions(+), 50 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 524c7af381..e37c577e97 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,9 +9,17 @@ buildscript { classpath 'com.dicedmelon.gradle:jacoco-android:0.1.2' } } -apply plugin: 'com.android.application' -apply plugin: 'io.fabric' -apply plugin: 'jacoco-android' +apply plugin: "com.android.application" +apply plugin: "io.fabric" +apply plugin: "jacoco-android" + +ext { + supportLibraryVersion = "23.4.0" + ormLiteVersion = "4.46" + powermockVersion = "1.7.3" + dexmakerVersion = "1.2" +} + repositories { maven { url 'https://maven.fabric.io/public' } @@ -152,53 +160,55 @@ dependencies { wearApp project(':wear') compile fileTree(include: ['*.jar'], dir: 'libs') - compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') { + compile("com.crashlytics.sdk.android:crashlytics:2.6.7@aar") { transitive = true; } - compile('com.crashlytics.sdk.android:answers:1.3.12@aar') { + compile("com.crashlytics.sdk.android:answers:1.3.12@aar") { transitive = true; } - compile 'com.android.support:appcompat-v7:23.4.0' - compile 'com.android.support:support-v4:23.4.0' - compile 'com.android.support:cardview-v7:23.4.0' - compile 'com.android.support:recyclerview-v7:23.4.0' - compile 'com.android.support:gridlayout-v7:23.4.0' - compile "com.android.support:design:23.4.0" - compile "com.android.support:percent:23.4.0" - compile 'com.wdullaer:materialdatetimepicker:2.3.0' - compile 'com.squareup:otto:1.3.7' - compile 'com.j256.ormlite:ormlite-core:4.46' - compile 'com.j256.ormlite:ormlite-android:4.46' - compile('com.github.tony19:logback-android-classic:1.1.1-6') { - exclude group: 'com.google.android', module: 'android' + compile "com.android.support:appcompat-v7:${supportLibraryVersion}" + compile "com.android.support:support-v4:${supportLibraryVersion}" + compile "com.android.support:cardview-v7:${supportLibraryVersion}" + compile "com.android.support:recyclerview-v7:${supportLibraryVersion}" + compile "com.android.support:gridlayout-v7:${supportLibraryVersion}" + compile "com.android.support:design:${supportLibraryVersion}" + compile "com.android.support:percent:${supportLibraryVersion}" + compile "com.wdullaer:materialdatetimepicker:2.3.0" + compile "com.squareup:otto:1.3.7" + compile "com.j256.ormlite:ormlite-core:${ormLiteVersion}" + compile "com.j256.ormlite:ormlite-android:${ormLiteVersion}" + compile("com.github.tony19:logback-android-classic:1.1.1-6") { + exclude group: "com.google.android", module: "android" } - compile 'org.apache.commons:commons-lang3:3.6' - compile 'org.slf4j:slf4j-api:1.7.12' - compile 'com.jjoe64:graphview:4.0.1' - compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.1.1' - compile 'com.google.android.gms:play-services-wearable:7.5.0' - compile 'junit:junit:4.12' - testCompile 'org.json:json:20140107' - testCompile 'org.mockito:mockito-core:2.7.22' - testCompile 'org.powermock:powermock-api-mockito2:1.7.3' - testCompile 'org.powermock:powermock-module-junit4-rule-agent:1.7.3' - testCompile 'org.powermock:powermock-module-junit4-rule:1.7.3' - testCompile 'org.powermock:powermock-module-junit4:1.7.3' - androidTestCompile 'org.mockito:mockito-core:2.7.22' - androidTestCompile 'com.google.dexmaker:dexmaker:1.2' - androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2' - compile(name: 'android-edittext-validator-v1.3.4-mod', ext: 'aar') - compile('com.google.android:flexbox:0.3.0') { - exclude group: 'com.android.support' + compile "org.apache.commons:commons-lang3:3.6" + compile "org.slf4j:slf4j-api:1.7.12" + compile "com.jjoe64:graphview:4.0.1" + compile "com.joanzapata.iconify:android-iconify-fontawesome:2.1.1" + compile "com.google.android.gms:play-services-wearable:7.5.0" + compile(name: "android-edittext-validator-v1.3.4-mod", ext: "aar") + compile("com.google.android:flexbox:0.3.0") { + exclude group: "com.android.support" } - compile('io.socket:socket.io-client:0.8.3') { + compile("io.socket:socket.io-client:0.8.3") { // excluding org.json which is provided by Android - exclude group: 'org.json', module: 'json' + exclude group: "org.json", module: "json" } - compile 'com.google.code.gson:gson:2.7' - compile 'com.google.guava:guava:20.0' + compile "com.google.code.gson:gson:2.7" + compile "com.google.guava:guava:20.0" - compile 'net.danlew:android.joda:2.9.9.1' - testCompile 'joda-time:joda-time:2.9.4.2' + compile "net.danlew:android.joda:2.9.9.1" + + testCompile "junit:junit:4.12" + testCompile "org.json:json:20140107" + testCompile "org.mockito:mockito-core:2.7.22" + testCompile "org.powermock:powermock-api-mockito2:${powermockVersion}" + testCompile "org.powermock:powermock-module-junit4-rule-agent:${powermockVersion}" + testCompile "org.powermock:powermock-module-junit4-rule:${powermockVersion}" + testCompile "org.powermock:powermock-module-junit4:${powermockVersion}" + testCompile "joda-time:joda-time:2.9.4.2" + + androidTestCompile "org.mockito:mockito-core:2.7.22" + androidTestCompile "com.google.dexmaker:dexmaker:${dexmakerVersion}" + androidTestCompile "com.google.dexmaker:dexmaker-mockito:${dexmakerVersion}" } diff --git a/wear/build.gradle b/wear/build.gradle index 682577fc8e..a28a5cc5cd 100644 --- a/wear/build.gradle +++ b/wear/build.gradle @@ -1,5 +1,10 @@ apply plugin: 'com.android.application' +ext { + supportLibraryVersion = "23.0.1" + wearableVersion = "2.0.1" +} + def generateGitBuild = { -> StringBuilder stringBuilder = new StringBuilder(); @@ -56,12 +61,12 @@ allprojects { dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') - //compile 'com.ustwo.android:clockwise-wearable:1.0.2' - provided 'com.google.android.wearable:wearable:2.0.1' - compile 'com.google.android.support:wearable:2.0.1' - compile 'com.google.android.gms:play-services-wearable:7.3.0' - compile files('libs/hellocharts-library-1.5.5.jar') - compile(name:'ustwo-clockwise-debug', ext:'aar') - compile 'com.android.support:support-v4:23.0.1' - compile 'me.denley.wearpreferenceactivity:wearpreferenceactivity:0.5.0' + compile files("libs/hellocharts-library-1.5.5.jar") + //compile "com.ustwo.android:clockwise-wearable:1.0.2" + provided "com.google.android.wearable:wearable:${wearableVersion}" + compile "com.google.android.support:wearable:${wearableVersion}" + compile "com.google.android.gms:play-services-wearable:7.3.0" + compile(name:"ustwo-clockwise-debug", ext:"aar") + compile "com.android.support:support-v4:23.0.1" + compile "me.denley.wearpreferenceactivity:wearpreferenceactivity:0.5.0" }