Inclusion of the new watch face "AAPSv2" which: 1) has larger text, 2) shows COB, 3) allows to choose between showing phone battery level (AAPS) or rig battery level (OpenAPS) via watch Settings menu.
Most changes are either minor or are completely new files. The largest changes were to the WatchUpdaterService.java, which required several new blocks of code in order to expose COB, IOB, and current temp basal independently of the main status string.
This commit is contained in:
parent
d70860bd97
commit
45a26da8b3
|
@ -246,37 +246,6 @@ public class WatchUpdaterService extends WearableListenerService implements
|
||||||
sgvLevel = -1;
|
sgvLevel = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//IOB
|
|
||||||
MainApp.getConfigBuilder().updateTotalIOBTreatments();
|
|
||||||
MainApp.getConfigBuilder().updateTotalIOBTempBasals();
|
|
||||||
final IobTotal bolusIob = MainApp.getConfigBuilder().getLastCalculationTreatments().round();
|
|
||||||
final IobTotal basalIob = MainApp.getConfigBuilder().getLastCalculationTempBasals().round();
|
|
||||||
String iobText = DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "U";
|
|
||||||
|
|
||||||
if (mPrefs.getBoolean("wear_detailediob", true)) {
|
|
||||||
iobText = DecimalFormatter.to2Decimal(bolusIob.iob) + "|"
|
|
||||||
+ DecimalFormatter.to2Decimal(basalIob.basaliob);
|
|
||||||
}
|
|
||||||
|
|
||||||
//COB
|
|
||||||
String cobText = "0g";
|
|
||||||
AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(System.currentTimeMillis());
|
|
||||||
if (autosensData != null) {
|
|
||||||
cobText = (int) autosensData.cob + "g";
|
|
||||||
}
|
|
||||||
|
|
||||||
//battery
|
|
||||||
int phoneBattery = getBatteryLevel(getApplicationContext());
|
|
||||||
String rigBattery = NSDeviceStatus.getInstance().getUploaderStatus().trim();
|
|
||||||
|
|
||||||
//Temp basal
|
|
||||||
String temp_basal = "-.--U/h";
|
|
||||||
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
|
|
||||||
TemporaryBasal activeTemp = treatmentsInterface.getTempBasalFromHistory(System.currentTimeMillis());
|
|
||||||
if (activeTemp != null) {
|
|
||||||
temp_basal= activeTemp.toStringShort();
|
|
||||||
}
|
|
||||||
|
|
||||||
DataMap dataMap = new DataMap();
|
DataMap dataMap = new DataMap();
|
||||||
dataMap.putString("sgvString", lastBG.valueToUnitsToString(units));
|
dataMap.putString("sgvString", lastBG.valueToUnitsToString(units));
|
||||||
dataMap.putDouble("timestamp", lastBG.date);
|
dataMap.putDouble("timestamp", lastBG.date);
|
||||||
|
@ -289,16 +258,11 @@ public class WatchUpdaterService extends WearableListenerService implements
|
||||||
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.putLong("sgvLevel", sgvLevel);
|
dataMap.putLong("sgvLevel", sgvLevel);
|
||||||
dataMap.putString("battery", "" + phoneBattery);
|
|
||||||
dataMap.putString("rigBattery", rigBattery);
|
|
||||||
dataMap.putInt("batteryLevel", (phoneBattery >= 30) ? 1 : 0);
|
|
||||||
dataMap.putDouble("sgvDouble", lastBG.value);
|
dataMap.putDouble("sgvDouble", lastBG.value);
|
||||||
dataMap.putDouble("high", highLine);
|
dataMap.putDouble("high", highLine);
|
||||||
dataMap.putDouble("low", lowLine);
|
dataMap.putDouble("low", lowLine);
|
||||||
dataMap.putString("cob", "" + cobText);
|
|
||||||
dataMap.putString("iob", "" + iobText);
|
|
||||||
dataMap.putString("tempBasal", "" + temp_basal);
|
|
||||||
return dataMap;
|
return dataMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,14 +516,54 @@ public class WatchUpdaterService extends WearableListenerService implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendStatus() {
|
private void sendStatus() {
|
||||||
|
|
||||||
if (googleApiClient.isConnected()) {
|
if (googleApiClient.isConnected()) {
|
||||||
|
|
||||||
String status = generateStatusString();
|
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
|
||||||
|
treatmentsInterface.updateTotalIOBTreatments();
|
||||||
|
IobTotal bolusIob = treatmentsInterface.getLastCalculationTreatments().round();
|
||||||
|
treatmentsInterface.updateTotalIOBTempBasals();
|
||||||
|
IobTotal basalIob = treatmentsInterface.getLastCalculationTempBasals().round();
|
||||||
|
|
||||||
|
String iobTotal = DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob);
|
||||||
|
String iobDetail = "(" + DecimalFormatter.to2Decimal(bolusIob.iob) + "|" + DecimalFormatter.to2Decimal(basalIob.basaliob) + ")";
|
||||||
|
String iobString = iobTotal + " " + iobDetail; //for generateStatusString()
|
||||||
|
String cobString = generateCOBString();
|
||||||
|
String tempBasal = generateBasalString(treatmentsInterface);
|
||||||
|
String status = generateStatusString(iobString,tempBasal,bolusIob,basalIob);
|
||||||
|
|
||||||
|
//batteries
|
||||||
|
int phoneBattery = getBatteryLevel(getApplicationContext());
|
||||||
|
String rigBattery = NSDeviceStatus.getInstance().getUploaderStatus().trim();
|
||||||
|
|
||||||
|
//OpenAPS status
|
||||||
|
String openApsString = String.valueOf(NSDeviceStatus.getInstance().getOpenApsStatus());
|
||||||
|
String openApsStatus = openApsString.substring(0,openApsString.indexOf("m"));
|
||||||
|
|
||||||
PutDataMapRequest dataMapRequest = PutDataMapRequest.create(NEW_STATUS_PATH);
|
PutDataMapRequest dataMapRequest = PutDataMapRequest.create(NEW_STATUS_PATH);
|
||||||
//unique content
|
//unique content
|
||||||
dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis());
|
dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis());
|
||||||
|
//Log.e("SendStatus", "timestamp is " + System.currentTimeMillis());
|
||||||
dataMapRequest.getDataMap().putString("externalStatusString", status);
|
dataMapRequest.getDataMap().putString("externalStatusString", status);
|
||||||
|
//Log.e("SendStatus", "externalStatusString is " + status);
|
||||||
|
dataMapRequest.getDataMap().putString("iobTotal", iobTotal);
|
||||||
|
//Log.e("SendStatus", "iobTotal is " + iobTotal);
|
||||||
|
dataMapRequest.getDataMap().putString("iobDetail", iobDetail);
|
||||||
|
//Log.e("SendStatus", "iobDetail is " + iobDetail);
|
||||||
|
dataMapRequest.getDataMap().putBoolean("detailedIob", mPrefs.getBoolean("wear_detailediob", false));
|
||||||
|
//Log.e("SendStatus", "cob is " + cobString);
|
||||||
|
dataMapRequest.getDataMap().putString("cob", cobString);
|
||||||
|
//Log.e("SendStatus", "cob is " + cobString);
|
||||||
|
dataMapRequest.getDataMap().putString("tempBasal", tempBasal);
|
||||||
|
//Log.e("SendStatus", "tempBasal is " + tempBasal);
|
||||||
|
dataMapRequest.getDataMap().putString("battery", "" + phoneBattery);
|
||||||
|
//Log.e("SendStatus", "battery is " + phoneBattery);
|
||||||
|
dataMapRequest.getDataMap().putString("rigBattery", rigBattery);
|
||||||
|
//Log.e("SendStatus", "rigBattery is " + rigBattery);
|
||||||
|
dataMapRequest.getDataMap().putString("openApsStatus", openApsStatus);
|
||||||
|
//Log.e("SendStatus", "openApsStatus is " + openApsStatus);
|
||||||
|
dataMapRequest.getDataMap().putInt("batteryLevel", (phoneBattery >= 30) ? 1 : 0);
|
||||||
|
//Log.e("SendStatus", "batteryLevel is " + ((phoneBattery >= 30) ? 1 : 0));
|
||||||
PutDataRequest putDataRequest = dataMapRequest.asPutDataRequest();
|
PutDataRequest putDataRequest = dataMapRequest.asPutDataRequest();
|
||||||
Wearable.DataApi.putDataItem(googleApiClient, putDataRequest);
|
Wearable.DataApi.putDataItem(googleApiClient, putDataRequest);
|
||||||
} else {
|
} else {
|
||||||
|
@ -584,7 +588,8 @@ public class WatchUpdaterService extends WearableListenerService implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private String generateStatusString() {
|
private String generateStatusString(String iobString, String tempBasal, IobTotal bolusIob, IobTotal basalIob) {
|
||||||
|
|
||||||
String status = "";
|
String status = "";
|
||||||
|
|
||||||
Profile profile = MainApp.getConfigBuilder().getProfile();
|
Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||||
|
@ -602,38 +607,40 @@ public class WatchUpdaterService extends WearableListenerService implements
|
||||||
lastLoopStatus = true;
|
lastLoopStatus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Temp basal
|
status += tempBasal + " " + iobString;
|
||||||
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
|
|
||||||
|
|
||||||
TemporaryBasal activeTemp = treatmentsInterface.getTempBasalFromHistory(System.currentTimeMillis());
|
//add BGI if shown, otherwise return
|
||||||
if (activeTemp != null) {
|
|
||||||
status += activeTemp.toStringShort();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//IOB
|
|
||||||
treatmentsInterface.updateTotalIOBTreatments();
|
|
||||||
IobTotal bolusIob = treatmentsInterface.getLastCalculationTreatments().round();
|
|
||||||
treatmentsInterface.updateTotalIOBTempBasals();
|
|
||||||
IobTotal basalIob = treatmentsInterface.getLastCalculationTempBasals().round();
|
|
||||||
status += DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob);
|
|
||||||
|
|
||||||
if (mPrefs.getBoolean("wear_detailediob", true)) {
|
|
||||||
status += "("
|
|
||||||
+ DecimalFormatter.to2Decimal(bolusIob.iob) + "|"
|
|
||||||
+ DecimalFormatter.to2Decimal(basalIob.basaliob) + ")";
|
|
||||||
}
|
|
||||||
if (!mPrefs.getBoolean("wear_showbgi", false)) {
|
if (!mPrefs.getBoolean("wear_showbgi", false)) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
double bgi = -(bolusIob.activity + basalIob.activity) * 5 * profile.getIsf();
|
double bgi = -(bolusIob.activity + basalIob.activity) * 5 * profile.getIsf();
|
||||||
|
|
||||||
status += " " + ((bgi >= 0) ? "+" : "") + DecimalFormatter.to2Decimal(bgi);
|
status += " " + ((bgi >= 0) ? "+" : "") + DecimalFormatter.to2Decimal(bgi);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private String generateBasalString(TreatmentsInterface treatmentsInterface) {
|
||||||
|
|
||||||
|
String basalStringResult = "-.--U/h";
|
||||||
|
TemporaryBasal activeTemp = treatmentsInterface.getTempBasalFromHistory(System.currentTimeMillis());
|
||||||
|
if (activeTemp != null) {
|
||||||
|
basalStringResult = activeTemp.toStringShort();
|
||||||
|
}
|
||||||
|
return basalStringResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private String generateCOBString() {
|
||||||
|
|
||||||
|
String cobStringResult = "--";
|
||||||
|
AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(System.currentTimeMillis());
|
||||||
|
if (autosensData != null) {
|
||||||
|
cobStringResult = (int) autosensData.cob + "g";
|
||||||
|
}
|
||||||
|
return cobStringResult;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
if (googleApiClient != null && googleApiClient.isConnected()) {
|
if (googleApiClient != null && googleApiClient.isConnected()) {
|
||||||
|
|
|
@ -31,6 +31,7 @@ import com.ustwo.clockwise.wearable.WatchFace;
|
||||||
import com.ustwo.clockwise.common.WatchFaceTime;
|
import com.ustwo.clockwise.common.WatchFaceTime;
|
||||||
import com.ustwo.clockwise.common.WatchShape;
|
import com.ustwo.clockwise.common.WatchShape;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
@ -48,12 +49,13 @@ import lecho.lib.hellocharts.view.LineChartView;
|
||||||
public abstract class BaseWatchFace2 extends WatchFace implements SharedPreferences.OnSharedPreferenceChangeListener {
|
public abstract class BaseWatchFace2 extends WatchFace implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
public final static IntentFilter INTENT_FILTER;
|
public final static IntentFilter INTENT_FILTER;
|
||||||
public static final long[] vibratePattern = {0,400,300,400,300,400};
|
public static final long[] vibratePattern = {0,400,300,400,300,400};
|
||||||
public TextView mTime, mSgv, mDirection, mTimestamp, mUploaderBattery, mDelta, mStatus, mIOB, mCOB;
|
public TextView mTime, mSgv, mDirection, mTimestamp, mUploaderBattery, mRigBattery, mDelta, mStatus, mIOB1, mIOB2, mCOB, mLoop, mDay, mMonth;
|
||||||
public RelativeLayout mRelativeLayout;
|
public RelativeLayout mRelativeLayout;
|
||||||
public LinearLayout mLinearLayout, mLinearLayout2;
|
public LinearLayout mLinearLayout, mLinearLayout2, mDate;
|
||||||
public long sgvLevel = 0;
|
public long sgvLevel = 0;
|
||||||
public int batteryLevel = 1;
|
public int batteryLevel = 1;
|
||||||
public int ageLevel = 1;
|
public int ageLevel = 1;
|
||||||
|
public int loopLevel = 1;
|
||||||
public int highColor = Color.YELLOW;
|
public int highColor = Color.YELLOW;
|
||||||
public int lowColor = Color.RED;
|
public int lowColor = Color.RED;
|
||||||
public int midColor = Color.WHITE;
|
public int midColor = Color.WHITE;
|
||||||
|
@ -80,13 +82,7 @@ public abstract class BaseWatchFace2 extends WatchFace implements SharedPrefere
|
||||||
private MessageReceiver messageReceiver;
|
private MessageReceiver messageReceiver;
|
||||||
|
|
||||||
protected SharedPreferences sharedPrefs;
|
protected SharedPreferences sharedPrefs;
|
||||||
private String avgDelta = "";
|
private String openApsStatus = "--";
|
||||||
private String delta = "";
|
|
||||||
private String sgvString = "--";
|
|
||||||
//private String batteryString = "--%"; --- replaced with local variable
|
|
||||||
//private String IOB = "--U"; --- not used
|
|
||||||
//private String COB = "--g"; --- not used
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
|
@ -123,17 +119,23 @@ public abstract class BaseWatchFace2 extends WatchFace implements SharedPrefere
|
||||||
@Override
|
@Override
|
||||||
public void onLayoutInflated(WatchViewStub stub) {
|
public void onLayoutInflated(WatchViewStub stub) {
|
||||||
mTime = (TextView) stub.findViewById(R.id.watch_time);
|
mTime = (TextView) stub.findViewById(R.id.watch_time);
|
||||||
|
mDay = (TextView) stub.findViewById(R.id.day);
|
||||||
|
mMonth = (TextView) stub.findViewById(R.id.month);
|
||||||
|
mLoop = (TextView) stub.findViewById(R.id.loop);
|
||||||
mSgv = (TextView) stub.findViewById(R.id.sgv);
|
mSgv = (TextView) stub.findViewById(R.id.sgv);
|
||||||
mDirection = (TextView) stub.findViewById(R.id.direction);
|
mDirection = (TextView) stub.findViewById(R.id.direction);
|
||||||
mTimestamp = (TextView) stub.findViewById(R.id.timestamp);
|
mTimestamp = (TextView) stub.findViewById(R.id.timestamp);
|
||||||
mIOB = (TextView) stub.findViewById(R.id.iobView);
|
mIOB1 = (TextView) stub.findViewById(R.id.iob_text);
|
||||||
|
mIOB2 = (TextView) stub.findViewById(R.id.iobView);
|
||||||
mCOB = (TextView) stub.findViewById(R.id.cobView);
|
mCOB = (TextView) stub.findViewById(R.id.cobView);
|
||||||
mStatus = (TextView) stub.findViewById(R.id.tmpBasal);
|
mStatus = (TextView) stub.findViewById(R.id.tmpBasal);
|
||||||
mUploaderBattery = (TextView) stub.findViewById(R.id.uploader_battery);
|
mUploaderBattery = (TextView) stub.findViewById(R.id.uploader_battery);
|
||||||
|
mRigBattery = (TextView) stub.findViewById(R.id.rig_battery);
|
||||||
mDelta = (TextView) stub.findViewById(R.id.delta);
|
mDelta = (TextView) stub.findViewById(R.id.delta);
|
||||||
mRelativeLayout = (RelativeLayout) stub.findViewById(R.id.main_layout);
|
mRelativeLayout = (RelativeLayout) stub.findViewById(R.id.main_layout);
|
||||||
mLinearLayout = (LinearLayout) stub.findViewById(R.id.secondary_layout);
|
mLinearLayout = (LinearLayout) stub.findViewById(R.id.secondary_layout);
|
||||||
mLinearLayout2 = (LinearLayout) stub.findViewById(R.id.tertiary_layout);
|
mLinearLayout2 = (LinearLayout) stub.findViewById(R.id.tertiary_layout);
|
||||||
|
mDate = (LinearLayout) stub.findViewById(R.id.date_time);
|
||||||
chart = (LineChartView) stub.findViewById(R.id.chart);
|
chart = (LineChartView) stub.findViewById(R.id.chart);
|
||||||
layoutSet = true;
|
layoutSet = true;
|
||||||
mRelativeLayout.measure(specW, specH);
|
mRelativeLayout.measure(specW, specH);
|
||||||
|
@ -158,12 +160,12 @@ public abstract class BaseWatchFace2 extends WatchFace implements SharedPrefere
|
||||||
}
|
}
|
||||||
|
|
||||||
public String readingAge(boolean shortString) {
|
public String readingAge(boolean shortString) {
|
||||||
if (datetime == 0) { return "--' ago"; }
|
if (datetime == 0) { return shortString?"--'":"-- Minute ago"; }
|
||||||
int minutesAgo = (int) Math.floor(timeSince()/(1000*60));
|
int minutesAgo = (int) Math.floor(timeSince()/(1000*60));
|
||||||
//if (minutesAgo == 1) {
|
if (minutesAgo == 1) {
|
||||||
// return minutesAgo + "' ago";
|
return minutesAgo + (shortString?"'":" Minute ago");
|
||||||
//}
|
}
|
||||||
return minutesAgo + "' ago";
|
return minutesAgo + (shortString?"'":" Minutes ago");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -199,6 +201,19 @@ public abstract class BaseWatchFace2 extends WatchFace implements SharedPrefere
|
||||||
mTime.setText(timeFormat.format(System.currentTimeMillis()));
|
mTime.setText(timeFormat.format(System.currentTimeMillis()));
|
||||||
mTimestamp.setText(readingAge(true));
|
mTimestamp.setText(readingAge(true));
|
||||||
|
|
||||||
|
if (sharedPrefs.getBoolean("show_date", false)) {
|
||||||
|
Date today = new Date();
|
||||||
|
SimpleDateFormat sdfDay = new SimpleDateFormat("dd");
|
||||||
|
SimpleDateFormat sdfMonth = new SimpleDateFormat("MMM");
|
||||||
|
mDay.setText(sdfDay.format(today));
|
||||||
|
mMonth.setText(sdfMonth.format(today));
|
||||||
|
mDate.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
//mDay.setText("");
|
||||||
|
//mMonth.setText("");
|
||||||
|
mDate.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
if(ageLevel()<=0) {
|
if(ageLevel()<=0) {
|
||||||
mSgv.setPaintFlags(mSgv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
|
mSgv.setPaintFlags(mSgv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
} else {
|
} else {
|
||||||
|
@ -222,20 +237,8 @@ public abstract class BaseWatchFace2 extends WatchFace implements SharedPrefere
|
||||||
DataMap dataMap = DataMap.fromBundle(bundle);
|
DataMap dataMap = DataMap.fromBundle(bundle);
|
||||||
wakeLock.acquire(50);
|
wakeLock.acquire(50);
|
||||||
sgvLevel = dataMap.getLong("sgvLevel");
|
sgvLevel = dataMap.getLong("sgvLevel");
|
||||||
batteryLevel = dataMap.getInt("batteryLevel");
|
|
||||||
datetime = dataMap.getDouble("timestamp");
|
datetime = dataMap.getDouble("timestamp");
|
||||||
sgvString = dataMap.getString("sgvString");
|
|
||||||
mSgv.setText(dataMap.getString("sgvString"));
|
mSgv.setText(dataMap.getString("sgvString"));
|
||||||
mIOB.setText(dataMap.getString("iob"));
|
|
||||||
mCOB.setText(dataMap.getString("cob"));
|
|
||||||
|
|
||||||
String batteryString;
|
|
||||||
if (Boolean.valueOf(sharedPrefs.getString("battery_choice","true"))) {
|
|
||||||
batteryString = dataMap.getString("battery") + "%";
|
|
||||||
} else {
|
|
||||||
batteryString = dataMap.getString("rigBattery");
|
|
||||||
}
|
|
||||||
mUploaderBattery.setText("" + batteryString);
|
|
||||||
|
|
||||||
if(ageLevel()<=0) {
|
if(ageLevel()<=0) {
|
||||||
mSgv.setPaintFlags(mSgv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
|
mSgv.setPaintFlags(mSgv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
|
@ -247,21 +250,21 @@ public abstract class BaseWatchFace2 extends WatchFace implements SharedPrefere
|
||||||
mTime.setText(timeFormat.format(System.currentTimeMillis()));
|
mTime.setText(timeFormat.format(System.currentTimeMillis()));
|
||||||
|
|
||||||
mDirection.setText(dataMap.getString("slopeArrow"));
|
mDirection.setText(dataMap.getString("slopeArrow"));
|
||||||
avgDelta = dataMap.getString("avgDelta");
|
String avgDelta = dataMap.getString("avgDelta");
|
||||||
delta = dataMap.getString("delta");
|
String delta = dataMap.getString("delta");
|
||||||
|
|
||||||
|
if (sharedPrefs.getBoolean("showDelta", true)) {
|
||||||
mDelta.setText(delta);
|
mDelta.setText(delta);
|
||||||
|
mDelta.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
mDelta.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
boolean showAvgDelta = sharedPrefs.getBoolean("showAvgDelta", true);
|
boolean showAvgDelta = sharedPrefs.getBoolean("showAvgDelta", true);
|
||||||
if(showAvgDelta){
|
if(showAvgDelta){
|
||||||
mDelta.append(" " + avgDelta);
|
mDelta.append(" " + avgDelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mTimestamp != null && mStatus != null) {
|
|
||||||
mTimestamp.setText(readingAge(true));
|
|
||||||
mStatus.setVisibility(View.VISIBLE);
|
|
||||||
mStatus.setText("" + dataMap.getString("tempBasal"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chart != null) {
|
if (chart != null) {
|
||||||
addToWatchSet(dataMap);
|
addToWatchSet(dataMap);
|
||||||
setupCharts();
|
setupCharts();
|
||||||
|
@ -273,6 +276,89 @@ public abstract class BaseWatchFace2 extends WatchFace implements SharedPrefere
|
||||||
setColor();
|
setColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//status
|
||||||
|
bundle = intent.getBundleExtra("status");
|
||||||
|
if (layoutSet && bundle != null) {
|
||||||
|
DataMap dataMap = DataMap.fromBundle(bundle);
|
||||||
|
wakeLock.acquire(50);
|
||||||
|
///externalStatusString = dataMap.getString("externalStatusString");
|
||||||
|
batteryLevel = dataMap.getInt("batteryLevel");
|
||||||
|
openApsStatus = dataMap.getString("openApsStatus");
|
||||||
|
mCOB.setText(dataMap.getString("cob"));
|
||||||
|
|
||||||
|
if (dataMap.getBoolean("detailedIob")) {
|
||||||
|
mIOB1.setTextSize(14);
|
||||||
|
mIOB2.setTextSize(10);
|
||||||
|
mIOB1.setText("IOB " + dataMap.getString("iobTotal"));
|
||||||
|
mIOB2.setText(dataMap.getString("iobDetail"));
|
||||||
|
} else {
|
||||||
|
mIOB1.setTextSize(10);
|
||||||
|
mIOB2.setTextSize(14);
|
||||||
|
mIOB1.setText("IOB");
|
||||||
|
mIOB2.setText(dataMap.getString("iobTotal"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//use Config.APS to determine mode?
|
||||||
|
if (sharedPrefs.getBoolean("show_uploader_battery", true)) {
|
||||||
|
mUploaderBattery.setText(dataMap.getString("battery") + "%");
|
||||||
|
mUploaderBattery.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
mUploaderBattery.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sharedPrefs.getBoolean("show_rig_battery", false)) {
|
||||||
|
mRigBattery.setText(dataMap.getString("rigBattery"));
|
||||||
|
mRigBattery.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
mRigBattery.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mTimestamp != null) {
|
||||||
|
if (sharedPrefs.getBoolean("showAgo", true)) {
|
||||||
|
mTimestamp.setText(readingAge(true));
|
||||||
|
mTimestamp.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
mTimestamp.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mStatus != null) {
|
||||||
|
mStatus.setVisibility(View.VISIBLE);
|
||||||
|
mStatus.setText("" + dataMap.getString("tempBasal"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mLoop != null) {
|
||||||
|
if (sharedPrefs.getBoolean("showExternalStatus", true)) {
|
||||||
|
mLoop.setVisibility(View.VISIBLE);
|
||||||
|
String loopTime = dataMap.getString("openApsStatus");
|
||||||
|
if (loopTime != null && loopTime != "") {
|
||||||
|
mLoop.setText(loopTime + "'");
|
||||||
|
if (Integer.valueOf(loopTime) > 14) {
|
||||||
|
loopLevel = 0;
|
||||||
|
mLoop.setBackgroundResource(R.drawable.loop_red_25);
|
||||||
|
} else {
|
||||||
|
loopLevel = 1;
|
||||||
|
mLoop.setBackgroundResource(R.drawable.loop_green_25);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mLoop.setText("-'");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//mLoop.setText("");
|
||||||
|
//mLoop.setBackgroundResource(R.drawable.empty);
|
||||||
|
mLoop.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mRelativeLayout.measure(specW, specH);
|
||||||
|
mRelativeLayout.layout(0, 0, mRelativeLayout.getMeasuredWidth(),
|
||||||
|
mRelativeLayout.getMeasuredHeight());
|
||||||
|
invalidate();
|
||||||
|
setColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//basals and temps
|
//basals and temps
|
||||||
bundle = intent.getBundleExtra("basals");
|
bundle = intent.getBundleExtra("basals");
|
||||||
if (layoutSet && bundle != null) {
|
if (layoutSet && bundle != null) {
|
||||||
|
|
|
@ -94,6 +94,12 @@ public class Home2 extends BaseWatchFace2 {
|
||||||
mUploaderBattery.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_uploaderBatteryEmpty));
|
mUploaderBattery.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_uploaderBatteryEmpty));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (loopLevel == 1) {
|
||||||
|
mLoop.setBackgroundResource(R.drawable.loop_green_25);
|
||||||
|
} else {
|
||||||
|
mLoop.setBackgroundResource(R.drawable.loop_red_25);
|
||||||
|
}
|
||||||
|
|
||||||
mStatus.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mStatus_home));
|
mStatus.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mStatus_home));
|
||||||
|
|
||||||
if (chart != null) {
|
if (chart != null) {
|
||||||
|
@ -110,6 +116,7 @@ public class Home2 extends BaseWatchFace2 {
|
||||||
|
|
||||||
protected void setColorLowRes() {
|
protected void setColorLowRes() {
|
||||||
mTime.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mTime));
|
mTime.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mTime));
|
||||||
|
mLoop.setBackgroundResource(R.drawable.loop_grey_25);
|
||||||
mRelativeLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_background));
|
mRelativeLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_background));
|
||||||
mSgv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
mSgv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||||
mDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
mDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||||
|
|
BIN
wear/src/main/res/drawable/empty.png
Normal file
BIN
wear/src/main/res/drawable/empty.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
wear/src/main/res/drawable/loop_green_25.png
Normal file
BIN
wear/src/main/res/drawable/loop_green_25.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
BIN
wear/src/main/res/drawable/loop_grey_25.png
Normal file
BIN
wear/src/main/res/drawable/loop_grey_25.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
BIN
wear/src/main/res/drawable/loop_red_25.png
Normal file
BIN
wear/src/main/res/drawable/loop_red_25.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
Binary file not shown.
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 475 KiB |
|
@ -23,40 +23,56 @@
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:layout_marginTop="-5dp">
|
android:layout_marginTop="-5dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/loop"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal|bottom"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:background="@drawable/loop_grey_25"
|
||||||
|
android:gravity="center|right"
|
||||||
|
android:paddingRight="7dp"
|
||||||
|
android:paddingTop="-2dp"
|
||||||
|
android:text="--'"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/sgv"
|
android:id="@+id/sgv"
|
||||||
android:textSize="41sp"
|
android:textSize="38sp"
|
||||||
android:text="---"
|
android:text="---"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="#FFFFFF"
|
||||||
android:layout_gravity="center_horizontal|bottom"
|
android:layout_gravity="center_horizontal|bottom"
|
||||||
android:gravity="bottom|right"
|
android:gravity="bottom|right"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
android:paddingRight="5dp"
|
android:paddingRight="5dp"
|
||||||
android:layout_marginBottom="-2dp"
|
android:layout_marginBottom="-2dp"
|
||||||
android:paddingTop="-2dp" />
|
android:paddingTop="-2dp" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:weightSum="1"
|
android:layout_gravity="center_horizontal"
|
||||||
android:textAlignment="center"
|
|
||||||
android:baselineAligned="false"
|
android:baselineAligned="false"
|
||||||
android:layout_gravity="center_horizontal">
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:weightSum="1">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/direction"
|
android:id="@+id/direction"
|
||||||
android:textSize="30sp"
|
|
||||||
android:text="--"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="#FFFFFF"
|
|
||||||
android:textAlignment="center"
|
|
||||||
android:layout_gravity="center_horizontal|bottom"
|
android:layout_gravity="center_horizontal|bottom"
|
||||||
android:gravity="center_horizontal|bottom"
|
android:gravity="center_horizontal|bottom"
|
||||||
android:layout_marginBottom="-5dp"
|
android:text="--"
|
||||||
android:layout_marginTop="-2dp"
|
android:textAlignment="center"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="22sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -64,8 +80,11 @@
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
android:gravity="center_horizontal|bottom"
|
android:gravity="center_horizontal|bottom"
|
||||||
android:text="--' ago"
|
android:paddingEnd="8dp"
|
||||||
|
android:paddingStart="6dp"
|
||||||
|
android:text="--'"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="#FFFFFF"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
@ -110,6 +129,17 @@
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/rig_battery"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="10sp"
|
||||||
|
android:text="--%"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="#000000"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tmpBasal"
|
android:id="@+id/tmpBasal"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -182,6 +212,38 @@
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="#FFFFFF"
|
||||||
android:textSize="30sp" />
|
android:textSize="30sp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/date_time"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical|center_horizontal"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingLeft="2sp"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/day"
|
||||||
|
android:layout_width="23dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:text="day"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/month"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:text="mth"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
@ -20,16 +20,6 @@
|
||||||
<item>5</item>
|
<item>5</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="battery_choice">
|
|
||||||
<item>Phone</item>
|
|
||||||
<item>Rig</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<string-array name="battery_choice_values">
|
|
||||||
<item>true</item>
|
|
||||||
<item>false</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<string-array name="input_design">
|
<string-array name="input_design">
|
||||||
<item>Default</item>
|
<item>Default</item>
|
||||||
<item>Quick righty</item>
|
<item>Quick righty</item>
|
||||||
|
|
|
@ -26,13 +26,26 @@
|
||||||
android:summary="Input Design"
|
android:summary="Input Design"
|
||||||
android:title="Input Design" />
|
android:title="Input Design" />
|
||||||
|
|
||||||
<ListPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:entries="@array/battery_choice"
|
android:key="show_uploader_battery"
|
||||||
android:entryValues="@array/battery_choice_values"
|
android:title="Show Phone Battery"
|
||||||
android:key="battery_choice"
|
app:wear_iconOff="@drawable/settings_off"
|
||||||
android:summary="Battery Display"
|
app:wear_iconOn="@drawable/settings_on" />
|
||||||
android:title="Battery Display" />
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="show_rig_battery"
|
||||||
|
android:title="Show Rig Battery"
|
||||||
|
app:wear_iconOff="@drawable/settings_off"
|
||||||
|
app:wear_iconOn="@drawable/settings_on" />
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="show_date"
|
||||||
|
android:title="Show Date"
|
||||||
|
app:wear_iconOff="@drawable/settings_off"
|
||||||
|
app:wear_iconOn="@drawable/settings_on" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
|
@ -49,6 +62,14 @@
|
||||||
app:wear_iconOff="@drawable/settings_off"
|
app:wear_iconOff="@drawable/settings_off"
|
||||||
app:wear_iconOn="@drawable/settings_on"/>
|
app:wear_iconOn="@drawable/settings_on"/>
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="showDelta"
|
||||||
|
android:summary="Show delta. (Circle WF)"
|
||||||
|
android:title="Show Delta"
|
||||||
|
app:wear_iconOff="@drawable/settings_off"
|
||||||
|
app:wear_iconOn="@drawable/settings_on"/>
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="showAvgDelta"
|
android:key="showAvgDelta"
|
||||||
|
@ -57,6 +78,14 @@
|
||||||
app:wear_iconOff="@drawable/settings_off"
|
app:wear_iconOff="@drawable/settings_off"
|
||||||
app:wear_iconOn="@drawable/settings_on"/>
|
app:wear_iconOn="@drawable/settings_on"/>
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="showAgo"
|
||||||
|
android:summary="Minutes since last reading. (Circle WF)"
|
||||||
|
android:title="Show Ago"
|
||||||
|
app:wear_iconOff="@drawable/settings_off"
|
||||||
|
app:wear_iconOn="@drawable/settings_on"/>
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="dark"
|
android:key="dark"
|
||||||
|
@ -73,22 +102,6 @@
|
||||||
android:summary="Chart Timeframe"
|
android:summary="Chart Timeframe"
|
||||||
android:title="Chart Timeframe" />
|
android:title="Chart Timeframe" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
|
||||||
android:defaultValue="true"
|
|
||||||
android:key="showAgo"
|
|
||||||
android:summary="Minutes since last reading. (Circle WF)"
|
|
||||||
android:title="Show Ago"
|
|
||||||
app:wear_iconOff="@drawable/settings_off"
|
|
||||||
app:wear_iconOn="@drawable/settings_on"/>
|
|
||||||
|
|
||||||
<CheckBoxPreference
|
|
||||||
android:defaultValue="true"
|
|
||||||
android:key="showDelta"
|
|
||||||
android:summary="Show delta. (Circle WF)"
|
|
||||||
android:title="Show Delta"
|
|
||||||
app:wear_iconOff="@drawable/settings_off"
|
|
||||||
app:wear_iconOn="@drawable/settings_on"/>
|
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="showBG"
|
android:key="showBG"
|
||||||
|
|
Loading…
Reference in a new issue