diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java
index bc0ffc82ce..e22404fbe5 100644
--- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java
+++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java
@@ -553,6 +553,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
if(layoutSet){
setDataFields();
+ setColor();
}
invalidate();
}
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 d34c0cc7ed..f8b6b06dc2 100644
--- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/Steampunk.java
+++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/Steampunk.java
@@ -1,6 +1,8 @@
package info.nightscout.androidaps.watchfaces;
import android.content.Intent;
+import android.graphics.Canvas;
+import android.graphics.Rect;
import android.support.v4.content.ContextCompat;
import android.support.wearable.watchface.WatchFaceStyle;
import android.view.LayoutInflater;
@@ -70,7 +72,7 @@ public class Steampunk extends BaseWatchFace {
float rotationAngle = 0f; //by default, show ? on the dial (? is at 0 degrees on the dial)
if (!sSgv.equals("---")) {
if (sUnits.equals("mmol")) {
- rotationAngle = Float.valueOf(sSgv) * 18f;
+ rotationAngle = Float.valueOf(sSgv) * 18f; //convert to mg/dL, which is equivalent to degrees
} else {
rotationAngle = Float.valueOf(sSgv); //if glucose a value is received, use it to determine the amount of rotation of the dial.
}
@@ -88,13 +90,42 @@ public class Steampunk extends BaseWatchFace {
mGlucoseDial.startAnimation(rotate);
lastEndDegrees = rotationAngle; //store the final angle as a starting point for the next rotation.
- //rotate delta pointer.
+ //set the delta gauge and rotate the delta pointer
float deltaIsNegative = 1f; //by default go clockwise
if (!sAvgDelta.equals("--")) { //if a legitimate delta value is received, then...
if (sAvgDelta.substring(0,1).equals("-")) deltaIsNegative = -1f; //if the delta is negative, go counter-clockwise
- deltaRotationAngle = (Float.valueOf(sAvgDelta.substring(1)) * 1.5f); //get rid of the sign so it can be converted to float. then, for each 10 in avgDelta we need to move 15 degrees, hence multiply avgDelta by 1.5.
+
+ //ensure the delta gauge is the right units and granularity
+ if (!sUnits.equals("-")) {
+ if (sUnits.equals("mmol")) {
+ if (sharedPrefs.getString("delta_granularity", "2").equals("1")) { //low
+ mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_10);
+ deltaRotationAngle = (Float.valueOf(sAvgDelta.substring(1)) * 30f); //get rid of the sign so it can be converted to float.
+ }
+ if (sharedPrefs.getString("delta_granularity", "2").equals("2")) { //medium
+ mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_05);
+ deltaRotationAngle = (Float.valueOf(sAvgDelta.substring(1)) * 60f); //get rid of the sign so it can be converted to float.
+ }
+ if (sharedPrefs.getString("delta_granularity", "2").equals("3")) { //high
+ mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_03);
+ deltaRotationAngle = (Float.valueOf(sAvgDelta.substring(1)) * 100f); //get rid of the sign so it can be converted to float.
+ }
+ } else {
+ if (sharedPrefs.getString("delta_granularity", "2").equals("1")) { //low
+ mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_20);
+ deltaRotationAngle = (Float.valueOf(sAvgDelta.substring(1)) * 1.5f); //get rid of the sign so it can be converted to float.
+ }
+ if (sharedPrefs.getString("delta_granularity", "2").equals("2")) { //medium
+ mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_10);
+ deltaRotationAngle = (Float.valueOf(sAvgDelta.substring(1)) * 3f); //get rid of the sign so it can be converted to float.
+ }
+ if (sharedPrefs.getString("delta_granularity", "2").equals("3")) { //high
+ mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_5);
+ deltaRotationAngle = (Float.valueOf(sAvgDelta.substring(1)) * 6f); //get rid of the sign so it can be converted to float.
+ }
+ }
+ }
if (deltaRotationAngle > 35) deltaRotationAngle = 35f;
- if (deltaRotationAngle < -35) deltaRotationAngle = -35f; //if the needle will go off the chart in either direction, make it stop at the end of the gauge.
mDeltaGauge.setRotation(deltaRotationAngle * deltaIsNegative);
}
diff --git a/wear/src/main/res/drawable/steampunk_cover_plate.png b/wear/src/main/res/drawable/steampunk_cover_plate.png
index 30eeed1a10..31f073139d 100644
Binary files a/wear/src/main/res/drawable/steampunk_cover_plate.png and b/wear/src/main/res/drawable/steampunk_cover_plate.png differ
diff --git a/wear/src/main/res/layout/round_steampunk.xml b/wear/src/main/res/layout/round_steampunk.xml
index d47052d8b5..0f939983a2 100644
--- a/wear/src/main/res/layout/round_steampunk.xml
+++ b/wear/src/main/res/layout/round_steampunk.xml
@@ -245,7 +245,7 @@
android:text="-'"
android:textAlignment="center"
android:textColor="@color/black_86p"
- android:textSize="12sp"
+ android:textSize="11sp"
android:textStyle="bold" />
@@ -303,7 +303,7 @@
android:text="-'"
android:textAlignment="center"
android:textColor="@color/black_86p"
- android:textSize="12sp"
+ android:textSize="11sp"
android:textStyle="bold" />
diff --git a/wear/src/main/res/values/strings.xml b/wear/src/main/res/values/strings.xml
index a7f34c08b1..0256d3a11f 100644
--- a/wear/src/main/res/values/strings.xml
+++ b/wear/src/main/res/values/strings.xml
@@ -20,6 +20,18 @@
- 5
+
+ - Low
+ - Medium
+ - High
+
+
+
+ - 1
+ - 2
+ - 3
+
+
- Default
- Quick righty
diff --git a/wear/src/main/res/xml/preferences.xml b/wear/src/main/res/xml/preferences.xml
index 1846ce4939..0befaddfd0 100644
--- a/wear/src/main/res/xml/preferences.xml
+++ b/wear/src/main/res/xml/preferences.xml
@@ -141,6 +141,14 @@
android:summary="Input Design"
android:title="Input Design" />
+
+