diff --git a/wear/src/main/AndroidManifest.xml b/wear/src/main/AndroidManifest.xml
index 9985511e12..e534380a56 100644
--- a/wear/src/main/AndroidManifest.xml
+++ b/wear/src/main/AndroidManifest.xml
@@ -13,6 +13,21 @@
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
bgDataList = new ArrayList<>();
+ public ArrayList tempWatchDataList = new ArrayList<>();
+ public ArrayList basalWatchDataList = new ArrayList<>();
public PowerManager.WakeLock wakeLock;
// related endTime manual layout
public View layoutView;
@@ -253,7 +255,20 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
invalidate();
setColor();
}
+ //basals and temps
+ bundle = intent.getBundleExtra("basals");
+ if (layoutSet && bundle != null) {
+ DataMap dataMap = DataMap.fromBundle(bundle);
+ wakeLock.acquire(500);
+ loadBasalsAndTemps(dataMap);
+
+ mRelativeLayout.measure(specW, specH);
+ mRelativeLayout.layout(0, 0, mRelativeLayout.getMeasuredWidth(),
+ mRelativeLayout.getMeasuredHeight());
+ invalidate();
+ setColor();
+ }
}
}
@@ -376,9 +391,9 @@ protected abstract void setColorDark();
if(bgDataList.size() > 0) { //Dont crash things just because we dont have values, people dont like crashy things
int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3"));
if (singleLine) {
- bgGraphBuilder = new BgGraphBuilder(getApplicationContext(), bgDataList, new ArrayList(), new ArrayList(), pointSize, midColor, timeframe);
+ bgGraphBuilder = new BgGraphBuilder(getApplicationContext(), bgDataList, tempWatchDataList, basalWatchDataList, pointSize, midColor, timeframe);
} else {
- bgGraphBuilder = new BgGraphBuilder(getApplicationContext(), bgDataList, new ArrayList(), new ArrayList(), pointSize, highColor, lowColor, midColor, timeframe);
+ bgGraphBuilder = new BgGraphBuilder(getApplicationContext(), bgDataList, tempWatchDataList, basalWatchDataList, pointSize, highColor, lowColor, midColor, timeframe);
}
chart.setLineChartData(bgGraphBuilder.lineData());
@@ -388,4 +403,31 @@ protected abstract void setColorDark();
ListenerService.requestData(this);
}
}
+
+ private void loadBasalsAndTemps(DataMap dataMap) {
+ ArrayList temps = dataMap.getDataMapArrayList("temps");
+ if (temps != null) {
+ tempWatchDataList = new ArrayList<>();
+ for (DataMap temp : temps) {
+ TempWatchData twd = new TempWatchData();
+ twd.startTime = temp.getLong("starttime");
+ twd.startBasal = temp.getDouble("startBasal");
+ twd.endTime = temp.getLong("endtime");
+ twd.endBasal = temp.getDouble("endbasal");
+ twd.amount = temp.getDouble("amount");
+ tempWatchDataList.add(twd);
+ }
+ }
+ ArrayList basals = dataMap.getDataMapArrayList("basals");
+ if (basals != null) {
+ basalWatchDataList = new ArrayList<>();
+ for (DataMap basal : basals) {
+ BasalWatchData bwd = new BasalWatchData();
+ bwd.startTime = basal.getLong("starttime");
+ bwd.endTime = basal.getLong("endtime");
+ bwd.amount = basal.getDouble("amount");
+ basalWatchDataList.add(bwd);
+ }
+ }
+ }
}
diff --git a/wear/src/main/java/info/nightscout/androidaps/CircleWatchface.java b/wear/src/main/java/info/nightscout/androidaps/CircleWatchface.java
index 232716f678..baf2242042 100644
--- a/wear/src/main/java/info/nightscout/androidaps/CircleWatchface.java
+++ b/wear/src/main/java/info/nightscout/androidaps/CircleWatchface.java
@@ -63,7 +63,7 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
private int sgvLevel = 0;
private String sgvString = "999";
- private String rawString = "x | x | x";
+ private String statusString = "no status";
private int batteryLevel = 0;
@@ -155,12 +155,10 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
textView.setVisibility(View.INVISIBLE);
}
- textView = (TextView) myLayout.findViewById(R.id.rawString);
- if (sharedPrefs.getBoolean("showRaw", false)||
- (sharedPrefs.getBoolean("showRawNoise", true) && getSgvString().equals("???"))
- ) {
+ textView = (TextView) myLayout.findViewById(R.id.statusString);
+ if (sharedPrefs.getBoolean("showExternalStatus", true)) {
textView.setVisibility(View.VISIBLE);
- textView.setText(getRawString());
+ textView.setText(getStatusString());
textView.setTextColor(getTextColor());
} else {
@@ -453,12 +451,12 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
this.sgvString = sgvString;
}
- String getRawString() {
- return rawString;
+ String getStatusString() {
+ return statusString;
}
- void setRawString(String rawString) {
- this.rawString = rawString;
+ void setStatusString(String statusString) {
+ this.statusString = statusString;
}
public String getDelta() {
@@ -527,7 +525,6 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
Log.d("CircleWatchface", "sgv level : " + getSgvLevel());
setSgvString(dataMap.getString("sgvString"));
Log.d("CircleWatchface", "sgv string : " + getSgvString());
- setRawString(dataMap.getString("rawString"));
setDelta(dataMap.getString("delta"));
setDatetime(dataMap.getDouble("timestamp"));
addToWatchSet(dataMap);
@@ -543,6 +540,17 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
prepareDrawTime();
invalidate();
}
+ //status
+ bundle = intent.getBundleExtra("status");
+ if (bundle != null) {
+ DataMap dataMap = DataMap.fromBundle(bundle);
+ wakeLock.acquire(50);
+ setStatusString(dataMap.getString("externalStatusString"));
+
+ prepareLayout();
+ prepareDrawTime();
+ invalidate();
+ }
wakeLock.release();
}
}
diff --git a/wear/src/main/res/layout/modern_layout.xml b/wear/src/main/res/layout/modern_layout.xml
index 835dcfc40d..247de09964 100644
--- a/wear/src/main/res/layout/modern_layout.xml
+++ b/wear/src/main/res/layout/modern_layout.xml
@@ -29,13 +29,13 @@
android:text="999"
android:layout_gravity="center" />
-