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 @@ + + + + + + + + + + + 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_light); + pointSize = 2; + 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); + } + } +} \ No newline at end of file diff --git a/wear/src/main/res/drawable/Steampunk_graphics_source_link.md b/wear/src/main/res/drawable/Steampunk_graphics_source_link.md new file mode 100644 index 0000000000..a4de5ddcbf --- /dev/null +++ b/wear/src/main/res/drawable/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/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..c59bbbfef8 --- /dev/null +++ b/wear/src/main/res/layout/rect_steampunk.xml @@ -0,0 +1,379 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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..883d9a5244 --- /dev/null +++ b/wear/src/main/res/layout/round_steampunk.xml @@ -0,0 +1,379 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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" /> + +