wear avgDelta on all watchfaces
This commit is contained in:
parent
ef0e30b2b3
commit
8a466506fb
5 changed files with 40 additions and 36 deletions
|
@ -429,12 +429,15 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
|
||||||
if (sgvLevel == 1) {
|
if (sgvLevel == 1) {
|
||||||
mSgv.setTextColor(Color.YELLOW);
|
mSgv.setTextColor(Color.YELLOW);
|
||||||
mDelta.setTextColor(Color.YELLOW);
|
mDelta.setTextColor(Color.YELLOW);
|
||||||
|
mAvgDelta.setTextColor(Color.YELLOW);
|
||||||
} else if (sgvLevel == 0) {
|
} else if (sgvLevel == 0) {
|
||||||
mSgv.setTextColor(Color.WHITE);
|
mSgv.setTextColor(Color.WHITE);
|
||||||
mDelta.setTextColor(Color.WHITE);
|
mDelta.setTextColor(Color.WHITE);
|
||||||
|
mAvgDelta.setTextColor(Color.WHITE);
|
||||||
} else if (sgvLevel == -1) {
|
} else if (sgvLevel == -1) {
|
||||||
mSgv.setTextColor(Color.RED);
|
mSgv.setTextColor(Color.RED);
|
||||||
mDelta.setTextColor(Color.RED);
|
mDelta.setTextColor(Color.RED);
|
||||||
|
mAvgDelta.setTextColor(Color.RED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -466,12 +469,15 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
|
||||||
if (sgvLevel == 1) {
|
if (sgvLevel == 1) {
|
||||||
mSgv.setTextColor(ChartUtils.COLOR_ORANGE);
|
mSgv.setTextColor(ChartUtils.COLOR_ORANGE);
|
||||||
mDelta.setTextColor(ChartUtils.COLOR_ORANGE);
|
mDelta.setTextColor(ChartUtils.COLOR_ORANGE);
|
||||||
|
mAvgDelta.setTextColor(ChartUtils.COLOR_ORANGE);
|
||||||
} else if (sgvLevel == 0) {
|
} else if (sgvLevel == 0) {
|
||||||
mSgv.setTextColor(Color.BLACK);
|
mSgv.setTextColor(Color.BLACK);
|
||||||
mDelta.setTextColor(Color.BLACK);
|
mDelta.setTextColor(Color.BLACK);
|
||||||
|
mAvgDelta.setTextColor(Color.BLACK);
|
||||||
} else if (sgvLevel == -1) {
|
} else if (sgvLevel == -1) {
|
||||||
mSgv.setTextColor(Color.RED);
|
mSgv.setTextColor(Color.RED);
|
||||||
mDelta.setTextColor(Color.RED);
|
mDelta.setTextColor(Color.RED);
|
||||||
|
mAvgDelta.setTextColor(Color.RED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ageLevel == 1) {
|
if (ageLevel == 1) {
|
||||||
|
@ -496,12 +502,15 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
|
||||||
if (sgvLevel == 1) {
|
if (sgvLevel == 1) {
|
||||||
mSgv.setTextColor(Color.YELLOW);
|
mSgv.setTextColor(Color.YELLOW);
|
||||||
mDelta.setTextColor(Color.YELLOW);
|
mDelta.setTextColor(Color.YELLOW);
|
||||||
|
mAvgDelta.setTextColor(Color.YELLOW);
|
||||||
} else if (sgvLevel == 0) {
|
} else if (sgvLevel == 0) {
|
||||||
mSgv.setTextColor(Color.WHITE);
|
mSgv.setTextColor(Color.WHITE);
|
||||||
mDelta.setTextColor(Color.WHITE);
|
mDelta.setTextColor(Color.WHITE);
|
||||||
|
mAvgDelta.setTextColor(Color.WHITE);
|
||||||
} else if (sgvLevel == -1) {
|
} else if (sgvLevel == -1) {
|
||||||
mSgv.setTextColor(Color.RED);
|
mSgv.setTextColor(Color.RED);
|
||||||
mDelta.setTextColor(Color.RED);
|
mDelta.setTextColor(Color.RED);
|
||||||
|
mAvgDelta.setTextColor(Color.RED);
|
||||||
}
|
}
|
||||||
mTimestamp.setTextColor(Color.WHITE);
|
mTimestamp.setTextColor(Color.WHITE);
|
||||||
statusView.setTextColor(Color.WHITE);
|
statusView.setTextColor(Color.WHITE);
|
||||||
|
|
|
@ -41,7 +41,7 @@ import lecho.lib.hellocharts.view.LineChartView;
|
||||||
public abstract class BaseWatchFace extends WatchFace implements SharedPreferences.OnSharedPreferenceChangeListener {
|
public abstract class BaseWatchFace 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, mRaw, mStatus;
|
public TextView mTime, mSgv, mDirection, mTimestamp, mUploaderBattery, mDelta, mStatus;
|
||||||
public RelativeLayout mRelativeLayout;
|
public RelativeLayout mRelativeLayout;
|
||||||
public LinearLayout mLinearLayout;
|
public LinearLayout mLinearLayout;
|
||||||
public long sgvLevel = 0;
|
public long sgvLevel = 0;
|
||||||
|
@ -70,11 +70,12 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
||||||
private MessageReceiver messageReceiver;
|
private MessageReceiver messageReceiver;
|
||||||
|
|
||||||
protected SharedPreferences sharedPrefs;
|
protected SharedPreferences sharedPrefs;
|
||||||
// private String rawString = "000 | 000 | 000";
|
|
||||||
private String rawString = "";
|
|
||||||
private String batteryString = "--";
|
private String batteryString = "--";
|
||||||
private String sgvString = "--";
|
private String sgvString = "--";
|
||||||
private String externalStatusString = "no status";
|
private String externalStatusString = "no status";
|
||||||
|
private String avgDelta = "";
|
||||||
|
private String delta = "";
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
|
@ -114,7 +115,6 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
||||||
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);
|
||||||
mRaw = (TextView) stub.findViewById(R.id.raw);
|
|
||||||
mStatus = (TextView) stub.findViewById(R.id.externaltstatus);
|
mStatus = (TextView) stub.findViewById(R.id.externaltstatus);
|
||||||
mUploaderBattery = (TextView) stub.findViewById(R.id.uploader_battery);
|
mUploaderBattery = (TextView) stub.findViewById(R.id.uploader_battery);
|
||||||
mDelta = (TextView) stub.findViewById(R.id.delta);
|
mDelta = (TextView) stub.findViewById(R.id.delta);
|
||||||
|
@ -211,7 +211,6 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
||||||
sgvLevel = dataMap.getLong("sgvLevel");
|
sgvLevel = dataMap.getLong("sgvLevel");
|
||||||
batteryLevel = dataMap.getInt("batteryLevel");
|
batteryLevel = dataMap.getInt("batteryLevel");
|
||||||
datetime = dataMap.getDouble("timestamp");
|
datetime = dataMap.getDouble("timestamp");
|
||||||
rawString = dataMap.getString("rawString");
|
|
||||||
sgvString = dataMap.getString("sgvString");
|
sgvString = dataMap.getString("sgvString");
|
||||||
batteryString = dataMap.getString("battery");
|
batteryString = dataMap.getString("battery");
|
||||||
mSgv.setText(dataMap.getString("sgvString"));
|
mSgv.setText(dataMap.getString("sgvString"));
|
||||||
|
@ -225,10 +224,13 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
||||||
final java.text.DateFormat timeFormat = DateFormat.getTimeFormat(BaseWatchFace.this);
|
final java.text.DateFormat timeFormat = DateFormat.getTimeFormat(BaseWatchFace.this);
|
||||||
mTime.setText(timeFormat.format(System.currentTimeMillis()));
|
mTime.setText(timeFormat.format(System.currentTimeMillis()));
|
||||||
|
|
||||||
|
mDirection.setText(dataMap.getString("slopeArrow"));
|
||||||
|
avgDelta = dataMap.getString("avgDelta");
|
||||||
|
delta = dataMap.getString("delta");
|
||||||
|
|
||||||
|
|
||||||
showAgoRawBattStatus();
|
showAgoRawBattStatus();
|
||||||
|
|
||||||
mDirection.setText(dataMap.getString("slopeArrow"));
|
|
||||||
mDelta.setText(dataMap.getString("delta"));
|
|
||||||
|
|
||||||
if (chart != null) {
|
if (chart != null) {
|
||||||
addToWatchSet(dataMap);
|
addToWatchSet(dataMap);
|
||||||
|
@ -274,17 +276,21 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
||||||
|
|
||||||
private void showAgoRawBattStatus() {
|
private void showAgoRawBattStatus() {
|
||||||
|
|
||||||
if(mRaw == null || mTimestamp == null || mUploaderBattery == null|| mStatus == null){
|
|
||||||
|
boolean showAvgDelta = sharedPrefs.getBoolean("showAvgDelta", true);
|
||||||
|
mDelta.setText(delta);
|
||||||
|
if(showAvgDelta){
|
||||||
|
mDelta.append(" " + avgDelta);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if( mTimestamp == null || mUploaderBattery == null|| mStatus == null){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean showRaw = sharedPrefs.getBoolean("showRaw", false)
|
|
||||||
|| (sharedPrefs.getBoolean("showRawNoise", true)
|
|
||||||
&& sgvString.equals("???"));
|
|
||||||
|
|
||||||
boolean showStatus = sharedPrefs.getBoolean("showExternalStatus", true);
|
boolean showStatus = sharedPrefs.getBoolean("showExternalStatus", true);
|
||||||
|
|
||||||
if(showRaw || showStatus){
|
if(showStatus){
|
||||||
//use short forms
|
//use short forms
|
||||||
mTimestamp.setText(readingAge(true));
|
mTimestamp.setText(readingAge(true));
|
||||||
mUploaderBattery.setText("U: " + batteryString + "%");
|
mUploaderBattery.setText("U: " + batteryString + "%");
|
||||||
|
@ -293,12 +299,6 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
||||||
mUploaderBattery.setText("Uploader: " + batteryString + "%");
|
mUploaderBattery.setText("Uploader: " + batteryString + "%");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showRaw) {
|
|
||||||
mRaw.setVisibility(View.VISIBLE);
|
|
||||||
mRaw.setText("R: " + rawString);
|
|
||||||
} else {
|
|
||||||
mRaw.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showStatus) {
|
if (showStatus) {
|
||||||
mStatus.setVisibility(View.VISIBLE);
|
mStatus.setVisibility(View.VISIBLE);
|
||||||
|
@ -337,11 +337,6 @@ protected abstract void setColorDark();
|
||||||
public void missedReadingAlert() {
|
public void missedReadingAlert() {
|
||||||
int minutes_since = (int) Math.floor(timeSince()/(1000*60));
|
int minutes_since = (int) Math.floor(timeSince()/(1000*60));
|
||||||
if(minutes_since >= 16 && ((minutes_since - 16) % 5) == 0) {
|
if(minutes_since >= 16 && ((minutes_since - 16) % 5) == 0) {
|
||||||
/*NotificationCompat.Builder notification = new NotificationCompat.Builder(getApplicationContext())
|
|
||||||
.setContentTitle("Missed BG Readings")
|
|
||||||
.setVibrate(vibratePattern);
|
|
||||||
NotificationManager mNotifyMgr = (NotificationManager) getApplicationContext().getSystemService(getApplicationContext().NOTIFICATION_SERVICE);
|
|
||||||
mNotifyMgr.notify(missed_readings_alert_id, notification.build());*/
|
|
||||||
ListenerService.requestData(this); // attempt endTime recover missing data
|
ListenerService.requestData(this); // attempt endTime recover missing data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,7 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
|
||||||
private double datetime = 0;
|
private double datetime = 0;
|
||||||
private String direction = "";
|
private String direction = "";
|
||||||
private String delta = "";
|
private String delta = "";
|
||||||
|
private String avgDelta = "";
|
||||||
public TreeSet<BgWatchData> bgDataList = new TreeSet<BgWatchData>();
|
public TreeSet<BgWatchData> bgDataList = new TreeSet<BgWatchData>();
|
||||||
|
|
||||||
private View layoutView;
|
private View layoutView;
|
||||||
|
@ -189,15 +190,13 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
|
||||||
textView.setTextColor(getTextColor());
|
textView.setTextColor(getTextColor());
|
||||||
if (sharedPrefs.getBoolean("showBigNumbers", false)) {
|
if (sharedPrefs.getBoolean("showBigNumbers", false)) {
|
||||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 25);
|
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 25);
|
||||||
if (delta.endsWith(" mg/dl")) {
|
|
||||||
textView.setText(getDelta().substring(0, delta.length() - 6));
|
|
||||||
} else if (delta.endsWith(" mmol")) {
|
|
||||||
textView.setText(getDelta().substring(0, delta.length() - 5));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
|
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
|
||||||
textView.setText(getDelta());
|
|
||||||
}
|
}
|
||||||
|
if(sharedPrefs.getBoolean("showAvgDelta", true)){
|
||||||
|
textView.append(" " + getAvgDelta());
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//Also possible: View.INVISIBLE instead of View.GONE (no layout change)
|
//Also possible: View.INVISIBLE instead of View.GONE (no layout change)
|
||||||
textView.setVisibility(View.INVISIBLE);
|
textView.setVisibility(View.INVISIBLE);
|
||||||
|
@ -467,6 +466,12 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
|
||||||
this.delta = delta;
|
this.delta = delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getAvgDelta() {
|
||||||
|
return avgDelta;
|
||||||
|
}
|
||||||
|
private void setAvgDelta(String avgDelta) {
|
||||||
|
this.avgDelta = avgDelta;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||||
|
@ -526,6 +531,7 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
|
||||||
setSgvString(dataMap.getString("sgvString"));
|
setSgvString(dataMap.getString("sgvString"));
|
||||||
Log.d("CircleWatchface", "sgv string : " + getSgvString());
|
Log.d("CircleWatchface", "sgv string : " + getSgvString());
|
||||||
setDelta(dataMap.getString("delta"));
|
setDelta(dataMap.getString("delta"));
|
||||||
|
setAvgDelta(dataMap.getString("avgDelta"));
|
||||||
setDatetime(dataMap.getDouble("timestamp"));
|
setDatetime(dataMap.getDouble("timestamp"));
|
||||||
addToWatchSet(dataMap);
|
addToWatchSet(dataMap);
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,6 @@ public class Home extends BaseWatchFace {
|
||||||
} else {
|
} else {
|
||||||
mUploaderBattery.setTextColor(Color.RED);
|
mUploaderBattery.setTextColor(Color.RED);
|
||||||
}
|
}
|
||||||
mRaw.setTextColor(Color.BLACK);
|
|
||||||
mStatus.setTextColor(Color.BLACK);
|
mStatus.setTextColor(Color.BLACK);
|
||||||
if (chart != null) {
|
if (chart != null) {
|
||||||
highColor = Color.YELLOW;
|
highColor = Color.YELLOW;
|
||||||
|
@ -89,7 +88,6 @@ public class Home extends BaseWatchFace {
|
||||||
} else {
|
} else {
|
||||||
mUploaderBattery.setTextColor(Color.RED);
|
mUploaderBattery.setTextColor(Color.RED);
|
||||||
}
|
}
|
||||||
mRaw.setTextColor(Color.WHITE);
|
|
||||||
mStatus.setTextColor(Color.WHITE);
|
mStatus.setTextColor(Color.WHITE);
|
||||||
|
|
||||||
mTime.setTextColor(Color.BLACK);
|
mTime.setTextColor(Color.BLACK);
|
||||||
|
@ -117,7 +115,6 @@ public class Home extends BaseWatchFace {
|
||||||
mDirection.setTextColor(Color.RED);
|
mDirection.setTextColor(Color.RED);
|
||||||
mDelta.setTextColor(Color.RED);
|
mDelta.setTextColor(Color.RED);
|
||||||
}
|
}
|
||||||
mRaw.setTextColor(Color.BLACK);
|
|
||||||
mStatus.setTextColor(Color.BLACK);
|
mStatus.setTextColor(Color.BLACK);
|
||||||
mUploaderBattery.setTextColor(Color.BLACK);
|
mUploaderBattery.setTextColor(Color.BLACK);
|
||||||
mTimestamp.setTextColor(Color.BLACK);
|
mTimestamp.setTextColor(Color.BLACK);
|
||||||
|
|
|
@ -46,7 +46,6 @@ public class LargeHome extends BaseWatchFace {
|
||||||
mUploaderBattery.setTextColor(Color.RED);
|
mUploaderBattery.setTextColor(Color.RED);
|
||||||
}
|
}
|
||||||
|
|
||||||
mRaw.setTextColor(Color.BLACK);
|
|
||||||
mStatus.setTextColor(Color.BLACK);
|
mStatus.setTextColor(Color.BLACK);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -83,7 +82,6 @@ public class LargeHome extends BaseWatchFace {
|
||||||
} else {
|
} else {
|
||||||
mUploaderBattery.setTextColor(Color.RED);
|
mUploaderBattery.setTextColor(Color.RED);
|
||||||
}
|
}
|
||||||
mRaw.setTextColor(Color.WHITE);
|
|
||||||
mStatus.setTextColor(Color.WHITE);
|
mStatus.setTextColor(Color.WHITE);
|
||||||
mTime.setTextColor(Color.BLACK);
|
mTime.setTextColor(Color.BLACK);
|
||||||
} else {
|
} else {
|
||||||
|
@ -105,7 +103,6 @@ public class LargeHome extends BaseWatchFace {
|
||||||
|
|
||||||
mUploaderBattery.setTextColor(Color.BLACK);
|
mUploaderBattery.setTextColor(Color.BLACK);
|
||||||
mTimestamp.setTextColor(Color.BLACK);
|
mTimestamp.setTextColor(Color.BLACK);
|
||||||
mRaw.setTextColor(Color.BLACK);
|
|
||||||
mStatus.setTextColor(Color.BLACK);
|
mStatus.setTextColor(Color.BLACK);
|
||||||
mTime.setTextColor(Color.WHITE);
|
mTime.setTextColor(Color.WHITE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue