From ede982c8c5e5b50d3b2d223f27ed7edfe2822bf7 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Tue, 8 Nov 2016 06:08:12 +0100 Subject: [PATCH 1/6] Update danar_history_item.xml --- app/src/main/res/layout/danar_history_item.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/res/layout/danar_history_item.xml b/app/src/main/res/layout/danar_history_item.xml index 225df97a22..6df07edd62 100644 --- a/app/src/main/res/layout/danar_history_item.xml +++ b/app/src/main/res/layout/danar_history_item.xml @@ -72,6 +72,14 @@ android:paddingLeft="5dp" android:gravity="right" /> + + Date: Tue, 8 Nov 2016 06:11:50 +0100 Subject: [PATCH 2/6] Add TDD to DanaR daily view ... also don't show the time for the day. It is always 00:00 anyways. --- .../DanaR/History/DanaRHistoryActivity.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/History/DanaRHistoryActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/History/DanaRHistoryActivity.java index e4e9794b3c..1fe6acf43d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/History/DanaRHistoryActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/History/DanaRHistoryActivity.java @@ -281,8 +281,6 @@ public class DanaRHistoryActivity extends Activity { holder.stringvalue.setText(record.getStringRecordValue()); holder.bolustype.setText(record.getBolusType()); holder.duration.setText(DecimalFormatter.to0Decimal(record.getRecordDuration())); - holder.dailybasal.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBasal()) + "U"); - holder.dailybolus.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBolus()) + "U"); holder.alarm.setText(record.getRecordAlarm()); switch (showingType) { case RecordTypes.RECORD_TYPE_ALARM: @@ -293,6 +291,7 @@ public class DanaRHistoryActivity extends Activity { holder.duration.setVisibility(View.GONE); holder.dailybasal.setVisibility(View.GONE); holder.dailybolus.setVisibility(View.GONE); + holder.dailytotal.setVisibility(View.GONE); holder.alarm.setVisibility(View.VISIBLE); break; case RecordTypes.RECORD_TYPE_BOLUS: @@ -303,9 +302,15 @@ public class DanaRHistoryActivity extends Activity { holder.duration.setVisibility(View.VISIBLE); holder.dailybasal.setVisibility(View.GONE); holder.dailybolus.setVisibility(View.GONE); + holder.dailytotal.setVisibility(View.GONE); holder.alarm.setVisibility(View.GONE); break; case RecordTypes.RECORD_TYPE_DAILY: + df = DateFormat.getDateInstance(DateFormat.SHORT); + holder.dailybasal.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBasal()) + "U"); + holder.dailybolus.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBolus()) + "U"); + holder.dailytotal.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBolus()+ record.getRecordDailyBasal()) + "U"); + holder.time.setText(df.format(new Date(record.getRecordDate()))); holder.time.setVisibility(View.VISIBLE); holder.value.setVisibility(View.GONE); holder.stringvalue.setVisibility(View.GONE); @@ -313,6 +318,7 @@ public class DanaRHistoryActivity extends Activity { holder.duration.setVisibility(View.GONE); holder.dailybasal.setVisibility(View.VISIBLE); holder.dailybolus.setVisibility(View.VISIBLE); + holder.dailytotal.setVisibility(View.VISIBLE); holder.alarm.setVisibility(View.GONE); break; case RecordTypes.RECORD_TYPE_GLUCOSE: @@ -331,6 +337,7 @@ public class DanaRHistoryActivity extends Activity { holder.duration.setVisibility(View.GONE); holder.dailybasal.setVisibility(View.GONE); holder.dailybolus.setVisibility(View.GONE); + holder.dailytotal.setVisibility(View.GONE); holder.alarm.setVisibility(View.GONE); break; case RecordTypes.RECORD_TYPE_SUSPEND: @@ -341,6 +348,7 @@ public class DanaRHistoryActivity extends Activity { holder.duration.setVisibility(View.GONE); holder.dailybasal.setVisibility(View.GONE); holder.dailybolus.setVisibility(View.GONE); + holder.dailytotal.setVisibility(View.GONE); holder.alarm.setVisibility(View.GONE); break; } @@ -365,6 +373,7 @@ public class DanaRHistoryActivity extends Activity { TextView duration; TextView dailybasal; TextView dailybolus; + TextView dailytotal; TextView alarm; HistoryViewHolder(View itemView) { @@ -377,6 +386,7 @@ public class DanaRHistoryActivity extends Activity { duration = (TextView) itemView.findViewById(R.id.danar_history_duration); dailybasal = (TextView) itemView.findViewById(R.id.danar_history_dailybasal); dailybolus = (TextView) itemView.findViewById(R.id.danar_history_dailybolus); + dailytotal = (TextView) itemView.findViewById(R.id.danar_history_dailytotal); alarm = (TextView) itemView.findViewById(R.id.danar_history_alarm); } } From 4a4dc04865a590b9664f94663ff06f85fa99449b Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 8 Nov 2016 10:29:24 +0100 Subject: [PATCH 3/6] fix iob reporting to NS --- .../info/nightscout/androidaps/plugins/OpenAPSMA/IobTotal.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/IobTotal.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/IobTotal.java index edd6504219..ecd4ca1e82 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/IobTotal.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/IobTotal.java @@ -64,7 +64,7 @@ public class IobTotal { public JSONObject json() { JSONObject json = new JSONObject(); try { - json.put("iob", iob + basaliob); + json.put("iob", iob); json.put("basaliob", basaliob); json.put("activity", activity); json.put("time", DateUtil.toISOString(new Date())); From a4a9efd812d0adfa8dbdcaf54917f6aa1e908282 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 8 Nov 2016 14:24:02 +0100 Subject: [PATCH 4/6] TAB_VIEW_PADDING_DIPS = 9 --- .../java/info/nightscout/androidaps/tabs/SlidingTabLayout.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/tabs/SlidingTabLayout.java b/app/src/main/java/info/nightscout/androidaps/tabs/SlidingTabLayout.java index fa6571d89a..5c1ef3b25f 100644 --- a/app/src/main/java/info/nightscout/androidaps/tabs/SlidingTabLayout.java +++ b/app/src/main/java/info/nightscout/androidaps/tabs/SlidingTabLayout.java @@ -60,7 +60,7 @@ public class SlidingTabLayout extends HorizontalScrollView { } private static final int TITLE_OFFSET_DIPS = 24; - private static final int TAB_VIEW_PADDING_DIPS = 16; + private static final int TAB_VIEW_PADDING_DIPS = 9; private static final int TAB_VIEW_TEXT_SIZE_SP = 12; private int mTitleOffset; From 94a7033e0c4229dd1845802a79d85f235ce34fb5 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 8 Nov 2016 17:55:39 +0100 Subject: [PATCH 5/6] always upload current basal rate --- .../nightscout/androidaps/plugins/DanaR/DanaRPlugin.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRPlugin.java index 9e530cd236..9c4eba9cf3 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRPlugin.java @@ -592,19 +592,19 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf battery.put("percent", getDanaRPump().batteryRemaining); status.put("status", "normal"); status.put("timestamp", DateUtil.toISOString(getDanaRPump().lastConnection)); + extended.put("PumpIOB", getDanaRPump().iob); + extended.put("LastBolus", getDanaRPump().lastBolusTime.toLocaleString()); + extended.put("LastBolusAmount", getDanaRPump().lastBolusAmount); if (isTempBasalInProgress()) { extended.put("TempBasalAbsoluteRate", getTempBasalAbsoluteRate()); extended.put("TempBasalStart", getTempBasal().timeStart.toLocaleString()); extended.put("TempBasalRemaining", getTempBasal().getPlannedRemainingMinutes()); extended.put("IsExtended", getTempBasal().isExtended); - extended.put("BaseBasalRate", getBaseBasalRate()); try { extended.put("ActiveProfile", MainApp.getConfigBuilder().getActiveProfile().getProfile().getActiveProfile()); } catch (Exception e) {} } - extended.put("PumpIOB", getDanaRPump().iob); - extended.put("LastBolus", getDanaRPump().lastBolusTime.toLocaleString()); - extended.put("LastBolusAmount", getDanaRPump().lastBolusAmount); + extended.put("BaseBasalRate", getBaseBasalRate()); pump.put("battery", battery); pump.put("status", status); From a2d4f22bd707c4fecf80c105156588b7b91dfac8 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 8 Nov 2016 19:10:25 +0100 Subject: [PATCH 6/6] added git HEAD and version to pump status and logs --- app/build.gradle | 21 +++++++++++++++++++ .../info/nightscout/androidaps/MainApp.java | 3 +++ .../androidaps/plugins/DanaR/DanaRPlugin.java | 2 ++ .../VirtualPump/VirtualPumpPlugin.java | 4 ++++ 4 files changed, 30 insertions(+) diff --git a/app/build.gradle b/app/build.gradle index 6d6f7ab7ea..4b0a9e796e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,6 +14,26 @@ repositories { maven { url 'https://maven.fabric.io/public' } } +def generateGitBuild = { -> + + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append('"') + try { + def stdout = new ByteArrayOutputStream() + exec { + commandLine 'git', 'describe', '--always' + standardOutput = stdout + } + String commitObject = stdout.toString().trim() + stringBuilder.append(commitObject) + } catch (ignored) { + return "NoGitSystemAvailable"; + } + stringBuilder.append('-') + stringBuilder.append((new Date()).format('yyyy.MM.dd')) + stringBuilder.append('"') + return stringBuilder.toString() +} android { compileSdkVersion 23 @@ -25,6 +45,7 @@ android { targetSdkVersion 23 versionCode 1020 versionName "1.0.20" + buildConfigField "String", "BUILDVERSION", generateGitBuild() } lintOptions { disable 'MissingTranslation' diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 6c92f385da..171d4b2f94 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -54,6 +54,9 @@ public class MainApp extends Application { public void onCreate() { super.onCreate(); Fabric.with(this, new Crashlytics()); + Crashlytics.setString("BUILDVERSION", BuildConfig.BUILDVERSION); + log.info("Version: " + BuildConfig.VERSION_NAME); + log.info("BuildVersion: " + BuildConfig.BUILDVERSION); sBus = new Bus(ThreadEnforcer.ANY); sInstance = this; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRPlugin.java index 9c4eba9cf3..45dae09603 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRPlugin.java @@ -20,6 +20,7 @@ import java.text.DateFormat; import java.util.Date; import java.util.Objects; +import info.nightscout.androidaps.BuildConfig; import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.MainApp; @@ -592,6 +593,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf battery.put("percent", getDanaRPump().batteryRemaining); status.put("status", "normal"); status.put("timestamp", DateUtil.toISOString(getDanaRPump().lastConnection)); + extended.put("Version", BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION); extended.put("PumpIOB", getDanaRPump().iob); extended.put("LastBolus", getDanaRPump().lastBolusTime.toLocaleString()); extended.put("LastBolusAmount", getDanaRPump().lastBolusAmount); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/VirtualPump/VirtualPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/VirtualPump/VirtualPumpPlugin.java index 805ddad431..4a441e1c76 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/VirtualPump/VirtualPumpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/VirtualPump/VirtualPumpPlugin.java @@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory; import java.sql.SQLException; import java.util.Date; +import info.nightscout.androidaps.BuildConfig; import info.nightscout.androidaps.Config; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; @@ -330,9 +331,11 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface { JSONObject pump = new JSONObject(); JSONObject battery = new JSONObject(); JSONObject status = new JSONObject(); + JSONObject extended = new JSONObject(); try { battery.put("percent", batteryPercent); status.put("status", "normal"); + extended.put("Version", BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION); TempBasal tb; if ((tb = getTempBasal()) != null) { status.put("tempbasalpct", tb.percent); @@ -343,6 +346,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface { pump.put("battery", battery); pump.put("status", status); + pump.put("extended", extended); pump.put("reservoir", reservoirInUnits); pump.put("clock", DateUtil.toISOString(new Date())); } catch (JSONException e) {