Steampunk watchface (interim commit)

This commit is contained in:
Andrew Warrington 2017-12-12 23:17:25 +01:00
parent ac37d691ee
commit 9e6f124097
12 changed files with 24 additions and 5 deletions

View file

@ -248,10 +248,12 @@ public class WatchUpdaterService extends WearableListenerService implements
dataMap.putString("slopeArrow", ""); dataMap.putString("slopeArrow", "");
dataMap.putString("delta", "--"); dataMap.putString("delta", "--");
dataMap.putString("avgDelta", "--"); dataMap.putString("avgDelta", "--");
dataMap.putString("glucoseUnits", "-");
} else { } else {
dataMap.putString("slopeArrow", slopeArrow(glucoseStatus.delta)); dataMap.putString("slopeArrow", slopeArrow(glucoseStatus.delta));
dataMap.putString("delta", deltastring(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units)); 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.putString("avgDelta", deltastring(glucoseStatus.avgdelta, glucoseStatus.avgdelta * Constants.MGDL_TO_MMOLL, units));
dataMap.putString("glucoseUnits", units);
} }
dataMap.putLong("sgvLevel", sgvLevel); dataMap.putLong("sgvLevel", sgvLevel);

View file

@ -103,6 +103,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
public String sBgi = "--"; public String sBgi = "--";
public String sMinute = "0"; public String sMinute = "0";
public String sHour = "0"; public String sHour = "0";
public String sUnits = "-";
@Override @Override
public void onCreate() { public void onCreate() {
@ -257,6 +258,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
sDirection = dataMap.getString("slopeArrow"); sDirection = dataMap.getString("slopeArrow");
sDelta = dataMap.getString("delta"); sDelta = dataMap.getString("delta");
sAvgDelta = dataMap.getString("avgDelta"); sAvgDelta = dataMap.getString("avgDelta");
sUnits = dataMap.getString("glucoseUnits");
if (chart != null) { if (chart != null) {
addToWatchSet(dataMap); addToWatchSet(dataMap);
setupCharts(); setupCharts();

View file

@ -57,9 +57,24 @@ public class Steampunk extends BaseWatchFace {
protected void setColorDark() { protected void setColorDark() {
//ensure the glucose dial is the right units
if (!sUnits.equals("-")) {
if (sUnits.equals("mmol")) {
mGlucoseDial.setImageResource(R.drawable.steampunk_dial_mmol);
} else {
mGlucoseDial.setImageResource(R.drawable.steampunk_dial_mgdl);
}
}
//rotate glucose dial. //rotate glucose dial.
float rotationAngle = 0f; //by default, show ? on the dial (? is at 0 degrees on the dial) float rotationAngle = 0f; //by default, show ? on the dial (? is at 0 degrees on the dial)
if (!sSgv.equals("---")) rotationAngle = Float.valueOf(sSgv); //if glucose a value is received, use it to determine the amount of rotation of the dial. if (!sSgv.equals("---")) {
if (sUnits.equals("mmol")) {
rotationAngle = Float.valueOf(sSgv) * 18f;
} 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 > 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) 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)

View file

Before

Width:  |  Height:  |  Size: 645 KiB

After

Width:  |  Height:  |  Size: 645 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 KiB

View file

Before

Width:  |  Height:  |  Size: 645 KiB

After

Width:  |  Height:  |  Size: 645 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 KiB

View file

@ -16,7 +16,7 @@
android:id="@+id/glucose_dial" android:id="@+id/glucose_dial"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:src="@drawable/steampunk_dial" android:src="@drawable/steampunk_dial_mgdl"
android:layout_gravity="center" android:layout_gravity="center"
android:gravity="center"/> android:gravity="center"/>
@ -27,7 +27,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center" android:layout_gravity="center"
android:background="@drawable/steampunk_gauge" android:background="@drawable/steampunk_gauge_mgdl_20"
android:gravity="center" android:gravity="center"
android:orientation="vertical" android:orientation="vertical"
android:weightSum="1"> android:weightSum="1">

View file

@ -16,7 +16,7 @@
android:id="@+id/glucose_dial" android:id="@+id/glucose_dial"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:src="@drawable/steampunk_dial" android:src="@drawable/steampunk_dial_mgdl"
android:layout_gravity="center" android:layout_gravity="center"
android:gravity="center"/> android:gravity="center"/>
@ -27,7 +27,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center" android:layout_gravity="center"
android:background="@drawable/steampunk_gauge" android:background="@drawable/steampunk_gauge_mgdl_20"
android:gravity="center" android:gravity="center"
android:orientation="vertical" android:orientation="vertical"
android:weightSum="1"> android:weightSum="1">