diff --git a/Steampunk_graphics_source_link.md b/Steampunk_graphics_source_link.md
new file mode 100644
index 0000000000..a4de5ddcbf
--- /dev/null
+++ b/Steampunk_graphics_source_link.md
@@ -0,0 +1,7 @@
+Follow this link to get the source PSD file for the Steampunk graphics. The file could not be included in the repository as it exceeds Github's 25 mb limit.
+
+Note, the source image size is 1600x1600. The image size should be reduced to 400x400 prior to export of final PNG.
+
+https://drive.google.com/drive/folders/1MrdgnQz3wOniDvRSMhAsqHBYb2WmE5i0
+
+Graphics created by (Github): andrew-warrington
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java
index 73b6692904..91045ba4d6 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java
@@ -243,6 +243,7 @@ public class WatchUpdaterService extends WearableListenerService implements
DataMap dataMap = new DataMap();
dataMap.putString("sgvString", lastBG.valueToUnitsToString(units));
+ dataMap.putString("glucoseUnits", units);
dataMap.putLong("timestamp", lastBG.date);
if (glucoseStatus == null) {
dataMap.putString("slopeArrow", "");
@@ -253,7 +254,6 @@ public class WatchUpdaterService extends WearableListenerService implements
dataMap.putString("delta", deltastring(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units));
dataMap.putString("avgDelta", deltastring(glucoseStatus.avgdelta, glucoseStatus.avgdelta * Constants.MGDL_TO_MMOLL, units));
}
-
dataMap.putLong("sgvLevel", sgvLevel);
dataMap.putDouble("sgvDouble", lastBG.value);
dataMap.putDouble("high", highLine);
diff --git a/wear/src/main/AndroidManifest.xml b/wear/src/main/AndroidManifest.xml
index e6c15d799d..32cf7a5d1d 100644
--- a/wear/src/main/AndroidManifest.xml
+++ b/wear/src/main/AndroidManifest.xml
@@ -111,6 +111,25 @@
+
+
+
+
+
+
+
+
+
+
+
start_time) {
- lines.add(tempValuesLine(twd, (float) minChart, factor, false, highlight?3:2));
+ lines.add(tempValuesLine(twd, (float) minChart, factor, false, highlight?(pointSize+1):pointSize));
if(highlight){
lines.add(tempValuesLine(twd, (float) minChart, factor, true, 1));
}
diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/Steampunk.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/Steampunk.java
new file mode 100644
index 0000000000..06f50edfb0
--- /dev/null
+++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/Steampunk.java
@@ -0,0 +1,243 @@
+package info.nightscout.androidaps.watchfaces;
+
+import android.content.Intent;
+import android.support.v4.content.ContextCompat;
+import android.support.wearable.watchface.WatchFaceStyle;
+import android.view.LayoutInflater;
+import android.view.animation.Animation;
+import android.view.animation.LinearInterpolator;
+import android.view.animation.RotateAnimation;
+
+import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.interaction.menus.MainMenuActivity;
+
+/**
+ * Created by andrew-warrington on 01/12/2017.
+ */
+
+public class Steampunk extends BaseWatchFace {
+
+ private long chartTapTime = 0;
+ private long mainMenuTapTime = 0;
+ private float lastEndDegrees = 0f;
+ private float deltaRotationAngle = 0f;
+
+ @Override
+ public void onCreate() {
+ forceSquareCanvas = true;
+ super.onCreate();
+ LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
+ layoutView = inflater.inflate(R.layout.activity_steampunk, null);
+ performViewSetup();
+ }
+
+ @Override
+ protected void onTapCommand(int tapType, int x, int y, long eventTime) {
+
+ if (tapType == TAP_TYPE_TAP&&
+ x >= mChartTap.getLeft() &&
+ x <= mChartTap.getRight()&&
+ y >= mChartTap.getTop() &&
+ y <= mChartTap.getBottom()){
+ if (eventTime - chartTapTime < 800){
+ changeChartTimeframe();
+ }
+ chartTapTime = eventTime;
+
+ } else if (tapType == TAP_TYPE_TAP&&
+ x >= mMainMenuTap.getLeft() &&
+ x <= mMainMenuTap.getRight()&&
+ y >= mMainMenuTap.getTop() &&
+ y <= mMainMenuTap.getBottom()){
+ if (eventTime - mainMenuTapTime < 800){
+ Intent intent = new Intent(this, MainMenuActivity.class);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ startActivity(intent);
+ }
+ mainMenuTapTime = eventTime;
+ }
+ }
+
+ @Override
+ protected WatchFaceStyle getWatchFaceStyle() {
+ return new WatchFaceStyle.Builder(this).setAcceptsTapEvents(true).build();
+ }
+
+ protected void setColorDark() {
+
+ if (mLinearLayout2 != null) {
+ if (ageLevel() <= 0) {
+ mLinearLayout2.setBackgroundResource(R.drawable.redline);
+ mTimestamp.setTextColor(getResources().getColor(R.color.red_600));
+ } else {
+ mLinearLayout2.setBackgroundResource(0);
+ mTimestamp.setTextColor(getResources().getColor(R.color.black_86p));
+ }
+ }
+
+ if (mLoop != null) {
+ if (loopLevel == 0) {
+ mLoop.setTextColor(getResources().getColor(R.color.red_600));
+ } else {
+ mLoop.setTextColor(getResources().getColor(R.color.black_86p));
+ }
+ }
+
+ if (!sSgv.equals("---")) {
+
+ float rotationAngle = 0f; //by default, show ? on the dial (? is at 0 degrees on the dial)
+
+ if (!sUnits.equals("-")) {
+
+ //ensure the glucose dial is the correct units
+ if (sUnits.equals("mmol")) {
+ mGlucoseDial.setImageResource(R.drawable.steampunk_dial_mmol);
+ } else {
+ mGlucoseDial.setImageResource(R.drawable.steampunk_dial_mgdl);
+ }
+
+ //convert the Sgv to degrees of rotation
+ if (sUnits.equals("mmol")) {
+ 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.
+ }
+
+ }
+
+ if (rotationAngle > 330) rotationAngle = 330; //if the glucose value is higher than 330 then show "HIGH" on the dial. ("HIGH" is at 330 degrees on the dial)
+ if (rotationAngle != 0 && rotationAngle < 30) rotationAngle = 30; //if the glucose value is lower than 30 show "LOW" on the dial. ("LOW" is at 30 degrees on the dial)
+
+ //rotate glucose dial
+ RotateAnimation rotate = new RotateAnimation(
+ lastEndDegrees, rotationAngle - lastEndDegrees,
+ Animation.RELATIVE_TO_SELF, 0.5f,
+ Animation.RELATIVE_TO_SELF, 0.5f);
+ rotate.setFillAfter(true);
+ rotate.setInterpolator(new LinearInterpolator());
+ rotate.setDuration(1);
+ mGlucoseDial.startAnimation(rotate);
+ lastEndDegrees = rotationAngle; //store the final angle as a starting point for the next rotation.
+ }
+
+ //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
+
+ //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 > 40) deltaRotationAngle = 40f;
+ mDeltaGauge.setRotation(deltaRotationAngle * deltaIsNegative);
+ }
+
+ //rotate the minute hand.
+ mMinuteHand.setRotation(Float.valueOf(sMinute) * 6f);
+
+ //rotate the hour hand.
+ mHourHand.setRotation((Float.valueOf(sHour) * 30f) + (Float.valueOf(sMinute) * 0.5f));
+
+ setTextSizes();
+
+ if (mLoop != null) {
+ mLoop.setBackgroundResource(0);
+ }
+
+ if (chart != null) {
+ highColor = ContextCompat.getColor(getApplicationContext(), R.color.black);
+ lowColor = ContextCompat.getColor(getApplicationContext(), R.color.black);
+ midColor = ContextCompat.getColor(getApplicationContext(), R.color.black);
+ 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;
+ setupCharts();
+ }
+
+ invalidate();
+
+ }
+
+ protected void setColorLowRes() {
+ setColorDark();
+ }
+
+ protected void setColorBright() {
+ setColorDark();
+ }
+
+ protected void setTextSizes() {
+
+ float fontSmall = 10f;
+ float fontMedium = 11f;
+ float fontLarge = 12f;
+
+ if (bIsRound) {
+ fontSmall = 11f;
+ fontMedium = 12f;
+ fontLarge = 13f;
+ }
+
+ //top row. large font unless text too big (i.e. detailedIOB)
+ mCOB2.setTextSize(fontLarge);
+ mBasalRate.setTextSize(fontLarge);
+ if (sIOB2.length() < 7) {
+ mIOB2.setTextSize(fontLarge);
+ } else {
+ mIOB2.setTextSize(fontSmall);
+ }
+
+ //bottom row. font medium unless text too long (i.e. longer than 9' timestamp)
+ if (mTimestamp.getText().length() < 3 || mLoop.getText().length() < 3) { //always resize these fields together, for symmetry.
+ mTimestamp.setTextSize(fontMedium);
+ mLoop.setTextSize(fontMedium);
+ } else {
+ mTimestamp.setTextSize(fontSmall);
+ mLoop.setTextSize(fontSmall);
+ }
+
+ //if both batteries are shown, make them smaller.
+ if (sharedPrefs.getBoolean("show_uploader_battery", true) && sharedPrefs.getBoolean("show_rig_battery", false)) {
+ mUploaderBattery.setTextSize(fontSmall);
+ mRigBattery.setTextSize(fontSmall);
+ } else {
+ mUploaderBattery.setTextSize(fontMedium);
+ mRigBattery.setTextSize(fontMedium);
+ }
+ }
+
+ private void changeChartTimeframe() {
+ int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3"));
+ timeframe = (timeframe%5) + 1;
+ sharedPrefs.edit().putString("chart_timeframe", "" + timeframe).commit();
+ }
+
+}
\ No newline at end of file
diff --git a/wear/src/main/res/drawable/redline.png b/wear/src/main/res/drawable/redline.png
new file mode 100644
index 0000000000..37d8859709
Binary files /dev/null and b/wear/src/main/res/drawable/redline.png differ
diff --git a/wear/src/main/res/drawable/steampunk_cover_plate.png b/wear/src/main/res/drawable/steampunk_cover_plate.png
new file mode 100644
index 0000000000..f6d6c0c961
Binary files /dev/null and b/wear/src/main/res/drawable/steampunk_cover_plate.png differ
diff --git a/wear/src/main/res/drawable/steampunk_dial_mgdl.png b/wear/src/main/res/drawable/steampunk_dial_mgdl.png
new file mode 100644
index 0000000000..e6315b1746
Binary files /dev/null and b/wear/src/main/res/drawable/steampunk_dial_mgdl.png differ
diff --git a/wear/src/main/res/drawable/steampunk_dial_mmol.png b/wear/src/main/res/drawable/steampunk_dial_mmol.png
new file mode 100644
index 0000000000..17325212c3
Binary files /dev/null and b/wear/src/main/res/drawable/steampunk_dial_mmol.png differ
diff --git a/wear/src/main/res/drawable/steampunk_gauge_mgdl_10.png b/wear/src/main/res/drawable/steampunk_gauge_mgdl_10.png
new file mode 100644
index 0000000000..6d268bebd7
Binary files /dev/null and b/wear/src/main/res/drawable/steampunk_gauge_mgdl_10.png differ
diff --git a/wear/src/main/res/drawable/steampunk_gauge_mgdl_20.png b/wear/src/main/res/drawable/steampunk_gauge_mgdl_20.png
new file mode 100644
index 0000000000..a509d7b308
Binary files /dev/null and b/wear/src/main/res/drawable/steampunk_gauge_mgdl_20.png differ
diff --git a/wear/src/main/res/drawable/steampunk_gauge_mgdl_5.png b/wear/src/main/res/drawable/steampunk_gauge_mgdl_5.png
new file mode 100644
index 0000000000..9288c4e5ab
Binary files /dev/null and b/wear/src/main/res/drawable/steampunk_gauge_mgdl_5.png differ
diff --git a/wear/src/main/res/drawable/steampunk_gauge_mmol_03.png b/wear/src/main/res/drawable/steampunk_gauge_mmol_03.png
new file mode 100644
index 0000000000..18b8d0bf4e
Binary files /dev/null and b/wear/src/main/res/drawable/steampunk_gauge_mmol_03.png differ
diff --git a/wear/src/main/res/drawable/steampunk_gauge_mmol_05.png b/wear/src/main/res/drawable/steampunk_gauge_mmol_05.png
new file mode 100644
index 0000000000..07a48e8aac
Binary files /dev/null and b/wear/src/main/res/drawable/steampunk_gauge_mmol_05.png differ
diff --git a/wear/src/main/res/drawable/steampunk_gauge_mmol_10.png b/wear/src/main/res/drawable/steampunk_gauge_mmol_10.png
new file mode 100644
index 0000000000..55f5e59b5b
Binary files /dev/null and b/wear/src/main/res/drawable/steampunk_gauge_mmol_10.png differ
diff --git a/wear/src/main/res/drawable/steampunk_hour_hand.png b/wear/src/main/res/drawable/steampunk_hour_hand.png
new file mode 100644
index 0000000000..f0031095d8
Binary files /dev/null and b/wear/src/main/res/drawable/steampunk_hour_hand.png differ
diff --git a/wear/src/main/res/drawable/steampunk_minute_hand.png b/wear/src/main/res/drawable/steampunk_minute_hand.png
new file mode 100644
index 0000000000..8b703d1b21
Binary files /dev/null and b/wear/src/main/res/drawable/steampunk_minute_hand.png differ
diff --git a/wear/src/main/res/drawable/steampunk_pointer.png b/wear/src/main/res/drawable/steampunk_pointer.png
new file mode 100644
index 0000000000..60792cd48a
Binary files /dev/null and b/wear/src/main/res/drawable/steampunk_pointer.png differ
diff --git a/wear/src/main/res/drawable/watchface_steampunk.png b/wear/src/main/res/drawable/watchface_steampunk.png
new file mode 100644
index 0000000000..0db24e5faa
Binary files /dev/null and b/wear/src/main/res/drawable/watchface_steampunk.png differ
diff --git a/wear/src/main/res/layout/activity_steampunk.xml b/wear/src/main/res/layout/activity_steampunk.xml
new file mode 100644
index 0000000000..3fa994d818
--- /dev/null
+++ b/wear/src/main/res/layout/activity_steampunk.xml
@@ -0,0 +1,12 @@
+
+
\ No newline at end of file
diff --git a/wear/src/main/res/layout/rect_steampunk.xml b/wear/src/main/res/layout/rect_steampunk.xml
new file mode 100644
index 0000000000..832c27d005
--- /dev/null
+++ b/wear/src/main/res/layout/rect_steampunk.xml
@@ -0,0 +1,381 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wear/src/main/res/layout/round_steampunk.xml b/wear/src/main/res/layout/round_steampunk.xml
new file mode 100644
index 0000000000..894164db00
--- /dev/null
+++ b/wear/src/main/res/layout/round_steampunk.xml
@@ -0,0 +1,381 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wear/src/main/res/values/colors.xml b/wear/src/main/res/values/colors.xml
index 0a20535687..2280e772d3 100644
--- a/wear/src/main/res/values/colors.xml
+++ b/wear/src/main/res/values/colors.xml
@@ -61,6 +61,7 @@
#FAFAFA
#E0E0E0
#9E9E9E
+ #333333
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" />
+
+