From bd5c7c396ff029d1fd31868dd13eb0e972afad8a Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 24 Jan 2018 21:54:24 +0100 Subject: [PATCH 1/5] sdk27 & butterknife --- app/build.gradle | 10 +++++++--- .../nightscout/androidaps/plugins/Loop/LoopPlugin.java | 2 +- .../PersistentNotificationPlugin.java | 2 +- build.gradle | 5 +++++ 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 6ecea2b3e1..054808a454 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,9 +12,10 @@ buildscript { apply plugin: "com.android.application" apply plugin: "io.fabric" apply plugin: "jacoco-android" +apply plugin: 'com.jakewharton.butterknife' ext { - supportLibraryVersion = "23.4.0" + supportLibraryVersion = "27.0.2" ormLiteVersion = "4.46" powermockVersion = "1.7.3" dexmakerVersion = "1.2" @@ -47,8 +48,8 @@ def generateGitBuild = { -> } android { - compileSdkVersion 23 - buildToolsVersion "26.0.2" + compileSdkVersion 27 + buildToolsVersion "${supportLibraryVersion}" defaultConfig { applicationId "info.nightscout.androidaps" @@ -204,6 +205,9 @@ dependencies { compile "net.danlew:android.joda:2.9.9.1" + api "com.jakewharton:butterknife:8.8.1" + annotationProcessor "com.jakewharton:butterknife-compiler:8.8.1" + testCompile "junit:junit:4.12" testCompile "org.json:json:20140107" testCompile "org.mockito:mockito-core:2.7.22" diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java index 539b9991a3..b2d79f4b7e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java @@ -6,7 +6,7 @@ import android.app.PendingIntent; import android.app.TaskStackBuilder; import android.content.Context; import android.content.Intent; -import android.support.v7.app.NotificationCompat; +import android.support.v4.app.NotificationCompat; import com.crashlytics.android.answers.Answers; import com.crashlytics.android.answers.CustomEvent; 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 9e631def18..558d01b94d 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 @@ -7,7 +7,7 @@ import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.support.v4.app.TaskStackBuilder; -import android.support.v7.app.NotificationCompat; +import android.support.v4.app.NotificationCompat; import com.squareup.otto.Subscribe; diff --git a/build.gradle b/build.gradle index c068560ec2..e13cb27485 100644 --- a/build.gradle +++ b/build.gradle @@ -10,12 +10,17 @@ buildscript { // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files + + classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0' } } allprojects { repositories { jcenter() + maven { + url "https://maven.google.com" + } } } From 790525373fb58b95e7876d67f7c0a8f09474a301 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 25 Jan 2018 08:13:20 +0100 Subject: [PATCH 2/5] travis to 27.0.2 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 52552b3ceb..7a50e4cb24 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ android: components: - platform-tools - tools - - build-tools-26.0.2 + - build-tools-27.0.2 - android-23 - extra-google-m2repository - extra-android-m2repository From ed1226ae672e5e89fa89ecf7ff908f049d2bdf75 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Wed, 24 Jan 2018 16:44:28 +0100 Subject: [PATCH 3/5] Push carbs only to pumps supporting storing carbs. --- .../interfaces/PumpDescription.java | 2 ++ .../Overview/Dialogs/NewTreatmentDialog.java | 28 +++++++++++-------- .../Overview/Dialogs/WizardDialog.java | 28 +++++++++++-------- .../plugins/PumpDanaR/DanaRPlugin.java | 2 ++ .../PumpDanaRKorean/DanaRKoreanPlugin.java | 2 ++ .../plugins/PumpDanaRS/DanaRSPlugin.java | 2 ++ .../plugins/PumpDanaRv2/DanaRv2Plugin.java | 2 ++ 7 files changed, 42 insertions(+), 24 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.java b/app/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.java index d37693d494..701b226031 100644 --- a/app/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.java +++ b/app/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.java @@ -35,4 +35,6 @@ public class PumpDescription { public double basalMinimumRate = 0.04d; public boolean isRefillingCapable = false; + + public boolean storesCarbInfo = true; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java index 775c97d810..69fbfdc149 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java @@ -159,19 +159,23 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene detailedBolusInfo.carbs = finalCarbsAfterConstraints; detailedBolusInfo.context = context; detailedBolusInfo.source = Source.USER; - ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() { - @Override - public void run() { - if (!result.success) { - Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class); - i.putExtra("soundid", R.raw.boluserror); - i.putExtra("status", result.comment); - i.putExtra("title", MainApp.sResources.getString(R.string.treatmentdeliveryerror)); - i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - MainApp.instance().startActivity(i); + if (detailedBolusInfo.insulin > 0 || ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo) { + ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() { + @Override + public void run() { + if (!result.success) { + Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class); + i.putExtra("soundid", R.raw.boluserror); + i.putExtra("status", result.comment); + i.putExtra("title", MainApp.sResources.getString(R.string.treatmentdeliveryerror)); + i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + MainApp.instance().startActivity(i); + } } - } - }); + }); + } else { + MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo); + } Answers.getInstance().logCustom(new CustomEvent("Bolus")); } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java index 530843836d..d74c9caadf 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java @@ -365,19 +365,23 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com detailedBolusInfo.carbTime = carbTime; detailedBolusInfo.boluscalc = boluscalcJSON; detailedBolusInfo.source = Source.USER; - ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() { - @Override - public void run() { - if (!result.success) { - Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class); - i.putExtra("soundid", R.raw.boluserror); - i.putExtra("status", result.comment); - i.putExtra("title", MainApp.sResources.getString(R.string.treatmentdeliveryerror)); - i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - MainApp.instance().startActivity(i); + if (detailedBolusInfo.insulin > 0 || ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo) { + ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() { + @Override + public void run() { + if (!result.success) { + Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class); + i.putExtra("soundid", R.raw.boluserror); + i.putExtra("status", result.comment); + i.putExtra("title", MainApp.sResources.getString(R.string.treatmentdeliveryerror)); + i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + MainApp.instance().startActivity(i); + } } - } - }); + }); + } else { + MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo); + } Answers.getInstance().logCustom(new CustomEvent("Wizard")); } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java index 4ba660db66..3a11ebe0a6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java @@ -110,6 +110,8 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C pumpDescription.basalMinimumRate = 0.04d; pumpDescription.isRefillingCapable = true; + + pumpDescription.storesCarbInfo = true; } private ServiceConnection mConnection = new ServiceConnection() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java index f269aff112..e92febada6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java @@ -112,6 +112,8 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf pumpDescription.basalMinimumRate = 0.1d; pumpDescription.isRefillingCapable = true; + + pumpDescription.storesCarbInfo = true; } private ServiceConnection mConnection = new ServiceConnection() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java index ed9f98651f..be8b67ecd5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java @@ -189,6 +189,8 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface, pumpDescription.basalMinimumRate = 0.04d; pumpDescription.isRefillingCapable = true; + + pumpDescription.storesCarbInfo = true; } private ServiceConnection mConnection = new ServiceConnection() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java index b4eb969852..5f53cdda68 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java @@ -109,6 +109,8 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface, pumpDescription.basalMinimumRate = 0.04d; pumpDescription.isRefillingCapable = true; + + pumpDescription.storesCarbInfo = true; } private ServiceConnection mConnection = new ServiceConnection() { From 9213182b7b5889801b61fb640b6f8da66b74d828 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 25 Jan 2018 13:28:46 +0100 Subject: [PATCH 4/5] travis accept license manually --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 7a50e4cb24..73fe4b80d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,9 @@ android: - extra-android-m2repository - extra-google-google_play_services +before_install: +- yes | sdkmanager "platforms;android-27" + script: # Unit Test - ./gradlew test jacocoTestReport From 0067eb75d507167ea5c9defb0a21ebf33d0384c1 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Thu, 25 Jan 2018 20:26:07 +0100 Subject: [PATCH 5/5] Fix format specifiers in Spanish translation, add MainApp.gs(id, args). --- app/src/main/java/info/nightscout/androidaps/MainApp.java | 4 ++++ app/src/main/res/values-es/strings.xml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 02576cb23d..a05f1c6d0c 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -233,6 +233,10 @@ public class MainApp extends Application { return sResources.getString(id); } + public static String gs(int id, Object... args) { + return sResources.getString(id, args); + } + public static MainApp instance() { return sInstance; } diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 7259194dee..988a92928d 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -231,8 +231,8 @@ XXXXXXXXXX +; + YYYYYYYYYY Para entregar bolo% .2fU responder con código% s Bolo falló - Bolo% .2fU entregado con éxito - Entregando% .2fU + Bolo %.2fU entregado con éxito + Entregando %.2fU Bolo remoto no permitido Dedo Sensor