Merge pull request #1147 from Andries-Smit/wear-test-always-on

Wear always on simple UI
This commit is contained in:
Milos Kozak 2022-01-12 10:28:58 +01:00 committed by GitHub
commit 9027c53c85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 384 additions and 431 deletions

View file

@ -135,7 +135,7 @@ public class RawDisplayData {
} }
private void updateData(DataMap dataMap) { private void updateData(DataMap dataMap) {
wearUtil.getWakeLock("readingPrefs", 50); PowerManager.WakeLock wl = wearUtil.getWakeLock("readingPrefs", 50);
sgvLevel = dataMap.getLong("sgvLevel"); sgvLevel = dataMap.getLong("sgvLevel");
datetime = dataMap.getLong("timestamp"); datetime = dataMap.getLong("timestamp");
sSgv = dataMap.getString("sgvString"); sSgv = dataMap.getString("sgvString");
@ -143,6 +143,7 @@ public class RawDisplayData {
sDelta = dataMap.getString("delta"); sDelta = dataMap.getString("delta");
sAvgDelta = dataMap.getString("avgDelta"); sAvgDelta = dataMap.getString("avgDelta");
sUnits = dataMap.getString("glucoseUnits"); sUnits = dataMap.getString("glucoseUnits");
wearUtil.releaseWakeLock(wl);
} }
public DataMap updateStatusFromMessage(Intent intent, PowerManager.WakeLock wakeLock) { public DataMap updateStatusFromMessage(Intent intent, PowerManager.WakeLock wakeLock) {
@ -156,7 +157,7 @@ public class RawDisplayData {
} }
private void updateStatus(DataMap dataMap) { private void updateStatus(DataMap dataMap) {
wearUtil.getWakeLock("readingPrefs", 50); PowerManager.WakeLock wl = wearUtil.getWakeLock("readingPrefs", 50);
sBasalRate = dataMap.getString("currentBasal"); sBasalRate = dataMap.getString("currentBasal");
sUploaderBattery = dataMap.getString("battery"); sUploaderBattery = dataMap.getString("battery");
sRigBattery = dataMap.getString("rigBattery"); sRigBattery = dataMap.getString("rigBattery");
@ -170,6 +171,7 @@ public class RawDisplayData {
externalStatusString = dataMap.getString("externalStatusString"); externalStatusString = dataMap.getString("externalStatusString");
batteryLevel = dataMap.getInt("batteryLevel"); batteryLevel = dataMap.getInt("batteryLevel");
openApsStatus = dataMap.getLong("openApsStatus"); openApsStatus = dataMap.getLong("openApsStatus");
wearUtil.releaseWakeLock(wl);
} }
public DataMap updateBasalsFromMessage(Intent intent, PowerManager.WakeLock wakeLock) { public DataMap updateBasalsFromMessage(Intent intent, PowerManager.WakeLock wakeLock) {
@ -183,8 +185,9 @@ public class RawDisplayData {
} }
private void updateBasals(DataMap dataMap) { private void updateBasals(DataMap dataMap) {
wearUtil.getWakeLock("readingPrefs", 500); PowerManager.WakeLock wl = wearUtil.getWakeLock("readingPrefs", 500);
loadBasalsAndTemps(dataMap); loadBasalsAndTemps(dataMap);
wearUtil.releaseWakeLock(wl);
} }
private void loadBasalsAndTemps(DataMap dataMap) { private void loadBasalsAndTemps(DataMap dataMap) {
@ -194,7 +197,7 @@ public class RawDisplayData {
for (DataMap temp : temps) { for (DataMap temp : temps) {
TempWatchData twd = new TempWatchData(); TempWatchData twd = new TempWatchData();
twd.startTime = temp.getLong("starttime"); twd.startTime = temp.getLong("starttime");
twd.startBasal = temp.getDouble("startBasal"); twd.startBasal = temp.getDouble("startBasal");
twd.endTime = temp.getLong("endtime"); twd.endTime = temp.getLong("endtime");
twd.endBasal = temp.getDouble("endbasal"); twd.endBasal = temp.getDouble("endbasal");
twd.amount = temp.getDouble("amount"); twd.amount = temp.getDouble("amount");

View file

@ -5,11 +5,13 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Resources;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.Point; import android.graphics.Point;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.Typeface;
import android.os.BatteryManager; import android.os.BatteryManager;
import android.os.PowerManager; import android.os.PowerManager;
import android.os.Vibrator; import android.os.Vibrator;
@ -37,6 +39,7 @@ import com.ustwo.clockwise.wearable.WatchFace;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Locale;
import javax.inject.Inject; import javax.inject.Inject;
@ -70,13 +73,11 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
public final Point displaySize = new Point(); public final Point displaySize = new Point();
public TextView mTime, mHour, mMinute, mTimePeriod, mSgv, mDirection, mTimestamp, mUploaderBattery, mRigBattery, mDelta, mAvgDelta, mStatus, mBasalRate, mIOB1, mIOB2, mCOB1, mCOB2, mBgi, mLoop, mDay, mDayName, mMonth, isAAPSv2, mHighLight, mLowLight; public TextView mTime, mHour, mMinute, mTimePeriod, mSgv, mDirection, mTimestamp, mUploaderBattery, mRigBattery, mDelta, mAvgDelta, mStatus, mBasalRate, mIOB1, mIOB2, mCOB1, mCOB2, mBgi, mLoop, mDay, mDayName, mMonth, isAAPSv2, mHighLight, mLowLight;
public TextView mSimpleSvg, mSimpleDirection, mSimpleTime;
public ImageView mGlucoseDial, mDeltaGauge, mHourHand, mMinuteHand; public ImageView mGlucoseDial, mDeltaGauge, mHourHand, mMinuteHand;
public View mSimpleUi;
public RelativeLayout mRelativeLayout; public RelativeLayout mRelativeLayout;
public LinearLayout mLinearLayout, mLinearLayout2, mDate, mChartTap, mMainMenuTap; public LinearLayout mLinearLayout, mLinearLayout2, mDate, mChartTap, mMainMenuTap;
public int ageLevel = 1; public int ageLevel = 1;
public int loopLevel = 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;
@ -96,20 +97,32 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
// related endTime manual layout // related endTime manual layout
public View layoutView; public View layoutView;
public int specW, specH; public int specW, specH;
public boolean forceSquareCanvas = false; //set to true by the Steampunk watch face. public boolean forceSquareCanvas = false; // Set to true by the Steampunk watch face.
public String sMinute = "0"; public String sMinute = "0";
public String sHour = "0"; public String sHour = "0";
protected SharedPreferences sharedPrefs; protected SharedPreferences sharedPrefs;
private LocalBroadcastManager localBroadcastManager; private LocalBroadcastManager localBroadcastManager;
private MessageReceiver messageReceiver; private MessageReceiver messageReceiver;
private BroadcastReceiver batteryReceiver; private BroadcastReceiver batteryReceiver;
protected boolean isCharging = false; private int colorDarkHigh, colorDarkMid, colorDarkLow;
private java.text.DateFormat timeFormat;
private SimpleDateFormat sdfDay, sdfMonth, sdfHour, sdfPeriod, sdfDayName, sdfMinute;
private Paint mBackgroundPaint, mTimePaint, mSvgPaint, mDirectionPaint;
private Date mDateTime;
private String mLastSvg = "", mLastDirection = "";
private float mYOffset = 0;
private Intent mBatteryStatus;
@Override @Override
public void onCreate() { public void onCreate() {
// Not derived from DaggerService, do injection here // Not derived from DaggerService, do injection here
AndroidInjection.inject(this); AndroidInjection.inject(this);
super.onCreate(); super.onCreate();
colorDarkHigh = ContextCompat.getColor(getApplicationContext(), R.color.dark_highColor);
colorDarkMid = ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor);
colorDarkLow = ContextCompat.getColor(getApplicationContext(), R.color.dark_lowColor);
rawData = new RawDisplayData(wearUtil); rawData = new RawDisplayData(wearUtil);
Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
display.getSize(displaySize); display.getSize(displaySize);
@ -127,10 +140,15 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
persistence.turnOff(); persistence.turnOff();
setupBatteryReceiver(); setupBatteryReceiver();
initFormats();
setupSimpleUi();
} }
private void setupBatteryReceiver() { private void setupBatteryReceiver() {
if (sharedPrefs.getBoolean("simplify_ui_charging", false) && batteryReceiver == null) { IntentFilter iFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
mBatteryStatus = this.registerReceiver(null, iFilter);
String setting = sharedPrefs.getString("simplify_ui", "off");
if (setting.equals("charging") || setting.equals("ambient_charging") && batteryReceiver == null) {
IntentFilter intentBatteryFilter = new IntentFilter(); IntentFilter intentBatteryFilter = new IntentFilter();
intentBatteryFilter.addAction(BatteryManager.ACTION_CHARGING); intentBatteryFilter.addAction(BatteryManager.ACTION_CHARGING);
intentBatteryFilter.addAction(BatteryManager.ACTION_DISCHARGING); intentBatteryFilter.addAction(BatteryManager.ACTION_DISCHARGING);
@ -145,6 +163,48 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
} }
} }
private void initFormats() {
Locale locale = Locale.getDefault();
timeFormat = DateFormat.getTimeFormat(BaseWatchFace.this);
sdfMinute = new SimpleDateFormat("mm", locale);
sdfHour = DateFormat.is24HourFormat(this) ? new SimpleDateFormat("HH", locale) : new SimpleDateFormat("hh", locale);
sdfPeriod = new SimpleDateFormat("a", locale);
sdfDay = new SimpleDateFormat("dd", locale);
sdfDayName = new SimpleDateFormat("E", locale);
sdfMonth = new SimpleDateFormat("MMM", locale);
}
private void setupSimpleUi() {
mDateTime = new Date();
int black = ContextCompat.getColor(getApplicationContext(), R.color.black);
mBackgroundPaint = new Paint();
mBackgroundPaint.setColor(black);
final Typeface NORMAL_TYPEFACE = Typeface.create(Typeface.SANS_SERIF, Typeface.NORMAL);
final Typeface BOLD_TYPEFACE = Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD);
int white = ContextCompat.getColor(getApplicationContext(), R.color.white);
Resources resources = this.getResources();
float textSizeSvg = resources.getDimension(R.dimen.simple_ui_svg_text_size);
float textSizeDirection = resources.getDimension(R.dimen.simple_ui_direction_text_size);
float textSizeTime = resources.getDimension(R.dimen.simple_ui_time_text_size);
mYOffset = resources.getDimension(R.dimen.simple_ui_y_offset);
mSvgPaint = createTextPaint(NORMAL_TYPEFACE, white, textSizeSvg);
mDirectionPaint = createTextPaint(BOLD_TYPEFACE, white, textSizeDirection);
mTimePaint = createTextPaint(NORMAL_TYPEFACE, white, textSizeTime);
}
private Paint createTextPaint(Typeface typeface, int colour, float textSize) {
Paint paint = new Paint();
paint.setColor(colour);
paint.setTypeface(typeface);
paint.setAntiAlias(true);
paint.setTextSize(textSize);
return paint;
}
@Override @Override
protected void onLayout(WatchShape shape, Rect screenBounds, WindowInsets screenInsets) { protected void onLayout(WatchShape shape, Rect screenBounds, WindowInsets screenInsets) {
super.onLayout(shape, screenBounds, screenInsets); super.onLayout(shape, screenBounds, screenInsets);
@ -153,71 +213,63 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
} }
public void performViewSetup() { public void performViewSetup() {
final WatchViewStub stub = layoutView.findViewById(R.id.watch_view_stub); final WatchViewStub layoutStub = layoutView.findViewById(R.id.watch_view_stub);
IntentFilter messageFilter = new IntentFilter(Intent.ACTION_SEND); IntentFilter messageFilter = new IntentFilter(Intent.ACTION_SEND);
messageReceiver = new MessageReceiver(); messageReceiver = new MessageReceiver();
localBroadcastManager = LocalBroadcastManager.getInstance(this); localBroadcastManager = LocalBroadcastManager.getInstance(this);
localBroadcastManager.registerReceiver(messageReceiver, messageFilter); localBroadcastManager.registerReceiver(messageReceiver, messageFilter);
stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() { layoutStub.setOnLayoutInflatedListener((WatchViewStub stub) -> {
@Override mTime = stub.findViewById(R.id.watch_time);
public void onLayoutInflated(WatchViewStub stub) { mHour = stub.findViewById(R.id.hour);
mTime = stub.findViewById(R.id.watch_time); mMinute = stub.findViewById(R.id.minute);
mHour = stub.findViewById(R.id.hour); mTimePeriod = stub.findViewById(R.id.timePeriod);
mMinute = stub.findViewById(R.id.minute); mDay = stub.findViewById(R.id.day);
mTimePeriod = stub.findViewById(R.id.timePeriod); mDayName = stub.findViewById(R.id.dayname);
mDay = stub.findViewById(R.id.day); mMonth = stub.findViewById(R.id.month);
mDayName = stub.findViewById(R.id.dayname); mDate = stub.findViewById(R.id.date_time);
mMonth = stub.findViewById(R.id.month); mLoop = stub.findViewById(R.id.loop);
mDate = stub.findViewById(R.id.date_time); mSgv = stub.findViewById(R.id.sgv);
mLoop = stub.findViewById(R.id.loop); mDirection = stub.findViewById(R.id.direction);
mSgv = stub.findViewById(R.id.sgv); mTimestamp = stub.findViewById(R.id.timestamp);
mDirection = stub.findViewById(R.id.direction); mIOB1 = stub.findViewById(R.id.iob_text);
mTimestamp = stub.findViewById(R.id.timestamp); mIOB2 = stub.findViewById(R.id.iobView);
mIOB1 = stub.findViewById(R.id.iob_text); mCOB1 = stub.findViewById(R.id.cob_text);
mIOB2 = stub.findViewById(R.id.iobView); mCOB2 = stub.findViewById(R.id.cobView);
mCOB1 = stub.findViewById(R.id.cob_text); mBgi = stub.findViewById(R.id.bgiView);
mCOB2 = stub.findViewById(R.id.cobView); mStatus = stub.findViewById(R.id.externaltstatus);
mBgi = stub.findViewById(R.id.bgiView); mBasalRate = stub.findViewById(R.id.tmpBasal);
mStatus = stub.findViewById(R.id.externaltstatus); mUploaderBattery = stub.findViewById(R.id.uploader_battery);
mBasalRate = stub.findViewById(R.id.tmpBasal); mRigBattery = stub.findViewById(R.id.rig_battery);
mUploaderBattery = stub.findViewById(R.id.uploader_battery); mDelta = stub.findViewById(R.id.delta);
mRigBattery = stub.findViewById(R.id.rig_battery); mAvgDelta = stub.findViewById(R.id.avgdelta);
mDelta = stub.findViewById(R.id.delta); isAAPSv2 = stub.findViewById(R.id.AAPSv2);
mAvgDelta = stub.findViewById(R.id.avgdelta); mHighLight = stub.findViewById(R.id.highLight);
isAAPSv2 = stub.findViewById(R.id.AAPSv2); mLowLight = stub.findViewById(R.id.lowLight);
mHighLight = stub.findViewById(R.id.highLight); mRelativeLayout = stub.findViewById(R.id.main_layout);
mLowLight = stub.findViewById(R.id.lowLight); mLinearLayout = stub.findViewById(R.id.secondary_layout);
mRelativeLayout = stub.findViewById(R.id.main_layout); mLinearLayout2 = stub.findViewById(R.id.tertiary_layout);
mLinearLayout = stub.findViewById(R.id.secondary_layout); mGlucoseDial = stub.findViewById(R.id.glucose_dial);
mLinearLayout2 = stub.findViewById(R.id.tertiary_layout); mDeltaGauge = stub.findViewById(R.id.delta_pointer);
mGlucoseDial = stub.findViewById(R.id.glucose_dial); mHourHand = stub.findViewById(R.id.hour_hand);
mDeltaGauge = stub.findViewById(R.id.delta_pointer); mMinuteHand = stub.findViewById(R.id.minute_hand);
mHourHand = stub.findViewById(R.id.hour_hand); mChartTap = stub.findViewById(R.id.chart_zoom_tap);
mMinuteHand = stub.findViewById(R.id.minute_hand); mMainMenuTap = stub.findViewById(R.id.main_menu_tap);
mChartTap = stub.findViewById(R.id.chart_zoom_tap); chart = stub.findViewById(R.id.chart);
mMainMenuTap = stub.findViewById(R.id.main_menu_tap); layoutSet = true;
chart = stub.findViewById(R.id.chart); setupCharts();
mSimpleUi = stub.findViewById(R.id.simple_ui); setDataFields();
mSimpleSvg = stub.findViewById(R.id.simple_sgv); missedReadingAlert();
mSimpleDirection = stub.findViewById(R.id.simple_direction); });
mSimpleTime = stub.findViewById(R.id.simple_watch_time);
layoutSet = true;
setDataFields();
setColor();
}
}
);
wakeLock.acquire(50); wakeLock.acquire(50);
} }
public int ageLevel() { public int ageLevel() {
if (timeSince() <= (1000 * 60 * 12)) { if (timeSince() <= (1000 * 60 * 12)) {
return 1; return 1;
} else {
return 0;
} }
return 0;
} }
public double timeSince() { public double timeSince() {
@ -226,7 +278,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
public String readingAge(boolean shortString) { public String readingAge(boolean shortString) {
if (rawData.datetime == 0) { if (rawData.datetime == 0) {
return shortString ? "--'" : "-- Minute ago"; 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) {
@ -250,45 +302,79 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
} }
@Override @Override
protected void onDraw(Canvas canvas) { protected long getInteractiveModeUpdateRate() {
if (layoutSet) { return 60 * 1000L; // Only call onTimeChanged every 60 seconds
setupCharts(); }
mRelativeLayout.measure(specW, specH); @Override
if (forceSquareCanvas) { protected void onDraw(Canvas canvas) {
mRelativeLayout.layout(0, 0, displaySize.x, displaySize.x); //force a square for Steampunk watch face. if (isSimpleUi()) {
} else { onDrawSimpleUi(canvas);
mRelativeLayout.layout(0, 0, displaySize.x, displaySize.y); } else {
if (layoutSet) {
mRelativeLayout.measure(specW, specH);
int y = forceSquareCanvas ? displaySize.x : displaySize.y; // Square Steampunk
mRelativeLayout.layout(0, 0, displaySize.x, y);
mRelativeLayout.draw(canvas);
} }
mRelativeLayout.draw(canvas);
Log.d("onDraw", "draw");
} }
} }
protected void onDrawSimpleUi(Canvas canvas) {
canvas.drawRect(0, 0, displaySize.x, displaySize.y, mBackgroundPaint);
float xHalf = displaySize.x / 2f;
float yThird = displaySize.y / 3f;
boolean isOutdated = rawData.datetime > 0 && ageLevel() <= 0;
mSvgPaint.setStrikeThruText(isOutdated);
mSvgPaint.setColor(getBgColour(rawData.sgvLevel));
mDirectionPaint.setColor(getBgColour(rawData.sgvLevel));
String sSvg = rawData.sSgv;
float svgWidth = mSvgPaint.measureText(sSvg);
String sDirection = " " + rawData.sDirection + "\uFE0E";
float directionWidth = mDirectionPaint.measureText(sDirection);
float xSvg = xHalf - (svgWidth + directionWidth) / 2;
canvas.drawText(sSvg, xSvg, yThird + mYOffset, mSvgPaint);
float xDirection = xSvg + svgWidth;
canvas.drawText(sDirection, xDirection, yThird + mYOffset, mDirectionPaint);
String sTime = timeFormat.format(mDateTime);
float xTime = xHalf - mTimePaint.measureText(sTime) / 2f;
canvas.drawText(timeFormat.format(mDateTime), xTime, yThird * 2f + mYOffset, mTimePaint);
}
int getBgColour(long level) {
if (level == 1) {
return colorDarkHigh;
}
if (level == 0) {
return colorDarkMid;
}
return colorDarkLow;
}
@Override @Override
protected void onTimeChanged(WatchFaceTime oldTime, WatchFaceTime newTime) { protected void onTimeChanged(WatchFaceTime oldTime, WatchFaceTime newTime) {
if (layoutSet && (newTime.hasHourChanged(oldTime) || newTime.hasMinuteChanged(oldTime))) { if (layoutSet && (newTime.hasHourChanged(oldTime) || newTime.hasMinuteChanged(oldTime))) {
wakeLock.acquire(50); long now = System.currentTimeMillis();
mDateTime.setTime(now);
setDataFields(); PowerManager.WakeLock wl = wearUtil.getWakeLock("readingPrefs", 50);
setColor();
missedReadingAlert(); missedReadingAlert();
checkVibrateHourly(oldTime, newTime); checkVibrateHourly(oldTime, newTime);
if (!isSimpleUi()) {
mRelativeLayout.measure(specW, specH); setDataFields();
if (forceSquareCanvas) {
mRelativeLayout.layout(0, 0, displaySize.x, displaySize.x); //force a square for Steampunk watch face.
} else {
mRelativeLayout.layout(0, 0, displaySize.x, displaySize.y);
} }
invalidate(); wearUtil.releaseWakeLock(wl);
} }
} }
private boolean isCharging() { private boolean isCharging() {
IntentFilter iFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); int status = mBatteryStatus.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
Intent batteryStatus = this.registerReceiver(null, iFilter);
int status = batteryStatus.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
return status == BatteryManager.BATTERY_STATUS_CHARGING || return status == BatteryManager.BATTERY_STATUS_CHARGING ||
status == BatteryManager.BATTERY_STATUS_FULL; status == BatteryManager.BATTERY_STATUS_FULL;
} }
@ -304,15 +390,13 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
} }
public void setDataFields() { public void setDataFields() {
setDateAndTime(); setDateAndTime();
if (mSgv != null) { if (mSgv != null) {
if (sharedPrefs.getBoolean("showBG", true)) { if (sharedPrefs.getBoolean("showBG", true)) {
mSgv.setText(rawData.sSgv); mSgv.setText(rawData.sSgv);
mSgv.setVisibility(View.VISIBLE); mSgv.setVisibility(View.VISIBLE);
} else { } else {
//leave the textview there but invisible, as a height holder for the empty space above the white line // Leave the textview there but invisible, as a height holder for the empty space above the white line
mSgv.setVisibility(View.INVISIBLE); mSgv.setVisibility(View.INVISIBLE);
mSgv.setText(""); mSgv.setText("");
} }
@ -322,7 +406,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
if (mDirection != null) { if (mDirection != null) {
if (sharedPrefs.getBoolean("show_direction", true)) { if (sharedPrefs.getBoolean("show_direction", true)) {
mDirection.setText(rawData.sDirection+"\uFE0E"); mDirection.setText(rawData.sDirection + "\uFE0E");
mDirection.setVisibility(View.VISIBLE); mDirection.setVisibility(View.VISIBLE);
} else { } else {
mDirection.setVisibility(View.GONE); mDirection.setVisibility(View.GONE);
@ -356,7 +440,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
mCOB1.setVisibility(View.GONE); mCOB1.setVisibility(View.GONE);
mCOB2.setVisibility(View.GONE); mCOB2.setVisibility(View.GONE);
} }
//deal with cases where there is only the value shown for COB, and not the label // Deal with cases where there is only the value shown for COB, and not the label
} else if (mCOB2 != null) { } else if (mCOB2 != null) {
mCOB2.setText(rawData.sCOB2); mCOB2.setText(rawData.sCOB2);
if (sharedPrefs.getBoolean("show_cob", true)) { if (sharedPrefs.getBoolean("show_cob", true)) {
@ -381,7 +465,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
mIOB1.setVisibility(View.GONE); mIOB1.setVisibility(View.GONE);
mIOB2.setVisibility(View.GONE); mIOB2.setVisibility(View.GONE);
} }
//deal with cases where there is only the value shown for IOB, and not the label // Deal with cases where there is only the value shown for IOB, and not the label
} else if (mIOB2 != null) { } else if (mIOB2 != null) {
if (sharedPrefs.getBoolean("show_iob", true)) { if (sharedPrefs.getBoolean("show_iob", true)) {
mIOB2.setVisibility(View.VISIBLE); mIOB2.setVisibility(View.VISIBLE);
@ -400,11 +484,8 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
if (isAAPSv2 != null) { if (isAAPSv2 != null) {
mTimestamp.setText(readingAge(true)); mTimestamp.setText(readingAge(true));
} else { } else {
if (sharedPrefs.getBoolean("showExternalStatus", true)) { boolean shortString = sharedPrefs.getBoolean("showExternalStatus", true);
mTimestamp.setText(readingAge(true)); mTimestamp.setText(readingAge(shortString));
} else {
mTimestamp.setText(readingAge(false));
}
} }
mTimestamp.setVisibility(View.VISIBLE); mTimestamp.setVisibility(View.VISIBLE);
} else { } else {
@ -479,78 +560,43 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
mLoop.setBackgroundResource(R.drawable.loop_green_25); mLoop.setBackgroundResource(R.drawable.loop_green_25);
} }
} else { } else {
mLoop.setText("-'"); loopLevel = -1;
mLoop.setText("-");
mLoop.setBackgroundResource(R.drawable.loop_grey_25);
} }
} else { } else {
mLoop.setVisibility(View.GONE); mLoop.setVisibility(View.GONE);
} }
} }
setDataFieldsSimpleUi();
}
void setDataFieldsSimpleUi() { setColor();
if (sharedPrefs.getBoolean("simplify_ui_charging", false) && isCharging()) {
mSimpleUi.setVisibility(View.VISIBLE);
mSimpleSvg.setText(rawData.sSgv);
if (ageLevel() <= 0) {
mSimpleSvg.setPaintFlags(mSimpleSvg.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
} else {
mSimpleSvg.setPaintFlags(mSimpleSvg.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
}
if (rawData.sgvLevel == 1) {
mSimpleSvg.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_highColor));
mSimpleDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_highColor));
} else if (rawData.sgvLevel == 0) {
mSimpleSvg.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
mSimpleDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
} else if (rawData.sgvLevel == -1) {
mSimpleSvg.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_lowColor));
mSimpleDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_lowColor));
}
mSimpleDirection.setText(rawData.sDirection+"\uFE0E");
final java.text.DateFormat timeFormat = DateFormat.getTimeFormat(BaseWatchFace.this);
mSimpleTime.setText(timeFormat.format(System.currentTimeMillis()));
} else {
mSimpleUi.setVisibility(View.GONE);
}
} }
@Override @Override
protected void on24HourFormatChanged(boolean is24HourFormat) { protected void on24HourFormatChanged(boolean is24HourFormat) {
setDateAndTime(); initFormats();
if (!isSimpleUi()) {
setDataFields();
}
invalidate();
} }
public void setDateAndTime() { public void setDateAndTime() {
final java.text.DateFormat timeFormat = DateFormat.getTimeFormat(BaseWatchFace.this);
if (mTime != null) { if (mTime != null) {
mTime.setText(timeFormat.format(System.currentTimeMillis())); mTime.setText(timeFormat.format(mDateTime));
} }
Date now = new Date(); sMinute = sdfMinute.format(mDateTime);
SimpleDateFormat sdfHour; sHour = sdfHour.format(mDateTime);
SimpleDateFormat sdfMinute = new SimpleDateFormat("mm");
if (DateFormat.is24HourFormat(this)) {
sdfHour = new SimpleDateFormat("HH");
} else {
sdfHour = new SimpleDateFormat("hh");
}
sHour = sdfHour.format(now);
sMinute = sdfMinute.format(now);
if (mHour != null && mMinute != null) { if (mHour != null && mMinute != null) {
mHour.setText(sHour); mHour.setText(sHour);
mMinute.setText(sMinute); mMinute.setText(sMinute);
} }
if(mTimePeriod != null) { if (mTimePeriod != null) {
if (!DateFormat.is24HourFormat(this)) { if (!DateFormat.is24HourFormat(this)) {
mTimePeriod.setVisibility(View.VISIBLE); mTimePeriod.setVisibility(View.VISIBLE);
SimpleDateFormat sdfPeriod = new SimpleDateFormat("a"); mTimePeriod.setText(sdfPeriod.format(mDateTime).toUpperCase());
mTimePeriod.setText(sdfPeriod.format(now).toUpperCase());
} else { } else {
mTimePeriod.setVisibility(View.GONE); mTimePeriod.setVisibility(View.GONE);
} }
@ -559,14 +605,11 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
if (mDate != null && mDay != null && mMonth != null) { if (mDate != null && mDay != null && mMonth != null) {
if (sharedPrefs.getBoolean("show_date", false)) { if (sharedPrefs.getBoolean("show_date", false)) {
if (mDayName != null) { if (mDayName != null) {
SimpleDateFormat sdfDayName = new SimpleDateFormat("E"); mDayName.setText(sdfDayName.format(mDateTime));
mDayName.setText(sdfDayName.format(now));
} }
SimpleDateFormat sdfDay = new SimpleDateFormat("dd"); mDay.setText(sdfDay.format(mDateTime));
SimpleDateFormat sdfMonth = new SimpleDateFormat("MMM"); mMonth.setText(sdfMonth.format(mDateTime));
mDay.setText(sdfDay.format(now));
mMonth.setText(sdfMonth.format(now));
mDate.setVisibility(View.VISIBLE); mDate.setVisibility(View.VISIBLE);
} else { } else {
mDate.setVisibility(View.GONE); mDate.setVisibility(View.GONE);
@ -588,7 +631,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
public void strikeThroughSgvIfNeeded() { public void strikeThroughSgvIfNeeded() {
if (mSgv != null) { if (mSgv != null) {
if (sharedPrefs.getBoolean("showBG", true)) { if (sharedPrefs.getBoolean("showBG", true)) {
if (ageLevel() <= 0) { if (ageLevel() <= 0 && rawData.datetime > 0) {
mSgv.setPaintFlags(mSgv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); mSgv.setPaintFlags(mSgv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
} else { } else {
mSgv.setPaintFlags(mSgv.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG); mSgv.setPaintFlags(mSgv.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
@ -598,30 +641,45 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
} }
protected void onWatchModeChanged(WatchMode watchMode) { protected void onWatchModeChanged(WatchMode watchMode) {
lowResMode = isLowRes(watchMode);
if (lowResMode ^ isLowRes(watchMode)) { //if there was a change in lowResMode if (isSimpleUi()) {
lowResMode = isLowRes(watchMode); setSimpleUiAntiAlias();
setColor(); } else {
} else if (!sharedPrefs.getBoolean("dark", true)) { setDataFields();
//in bright mode: different colours if active:
setColor();
} }
invalidate();
}
void setSimpleUiAntiAlias() {
boolean antiAlias = getCurrentWatchMode() == WatchMode.AMBIENT;
mSvgPaint.setAntiAlias(antiAlias);
mDirectionPaint.setAntiAlias(antiAlias);
mTimePaint.setAntiAlias(antiAlias);
} }
private boolean isLowRes(WatchMode watchMode) { private boolean isLowRes(WatchMode watchMode) {
return (watchMode == WatchMode.LOW_BIT) || (watchMode == WatchMode.LOW_BIT_BURN_IN); // || (watchMode == WatchMode.LOW_BIT_BURN_IN); return (watchMode == WatchMode.LOW_BIT) || (watchMode == WatchMode.LOW_BIT_BURN_IN); // || (watchMode == WatchMode.LOW_BIT_BURN_IN);
} }
private boolean isSimpleUi() {
String simplify = sharedPrefs.getString("simplify_ui", "off");
if (simplify.equals("off")) {
return false;
}
if ((simplify.equals("ambient") || simplify.equals("ambient_charging")) && getCurrentWatchMode() == WatchMode.AMBIENT) {
return true;
}
return (simplify.equals("charging") || simplify.equals("ambient_charging")) && isCharging();
}
@Override @Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
setupBatteryReceiver(); setupBatteryReceiver();
if ("delta_granularity".equals(key)) { if ("delta_granularity".equals(key)) {
ListenerService.requestData(this); ListenerService.requestData(this);
} }
if (layoutSet) { if (layoutSet) {
setDataFields(); setDataFields();
setColor();
} }
invalidate(); invalidate();
} }
@ -634,13 +692,16 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
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 (rawData.datetime == 0 || minutes_since >= 16 && ((minutes_since - 16) % 5) == 0) {
ListenerService.requestData(this); // attempt endTime recover missing data ListenerService.requestData(this); // Attempt endTime recover missing data
} }
} }
public void setupCharts() { public void setupCharts() {
if (rawData.bgDataList.size() > 0) { //Dont crash things just because we dont have values, people dont like crashy things if (isSimpleUi()) {
return;
}
if (rawData.bgDataList.size() > 0) { // Dont crash things just because we dont have values, people dont like crashy things
int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3")); int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3"));
if (lowResMode) { if (lowResMode) {
bgGraphBuilder = new BgGraphBuilder(getApplicationContext(), rawData, pointSize, midColor, gridColor, basalBackgroundColor, basalCenterColor, bolusColor, Color.GREEN, timeframe); bgGraphBuilder = new BgGraphBuilder(getApplicationContext(), rawData, pointSize, midColor, gridColor, basalBackgroundColor, basalCenterColor, bolusColor, Color.GREEN, timeframe);
@ -657,31 +718,36 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
public class MessageReceiver extends BroadcastReceiver { public class MessageReceiver extends BroadcastReceiver {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
PowerManager.WakeLock wl = wearUtil.getWakeLock("readingPrefs", 50);
if (layoutSet) { final DataMap dataMap = rawData.updateDataFromMessage(intent, wakeLock);
final DataMap dataMap = rawData.updateDataFromMessage(intent, wakeLock); if (chart != null && dataMap != null) {
if (chart != null && dataMap != null) { rawData.addToWatchSet(dataMap);
rawData.addToWatchSet(dataMap); setupCharts();
setupCharts(); }
rawData.updateStatusFromMessage(intent, wakeLock);
rawData.updateBasalsFromMessage(intent, wakeLock);
if (isSimpleUi()) {
if (needUpdate()) {
invalidate();
} }
rawData.updateStatusFromMessage(intent, wakeLock);
}
setDataFields();
setColor();
if (layoutSet) {
rawData.updateBasalsFromMessage(intent, wakeLock);
}
mRelativeLayout.measure(specW, specH);
if (forceSquareCanvas) {
mRelativeLayout.layout(0, 0, displaySize.x, displaySize.x); //force a square for Steampunk watch face.
} else { } else {
mRelativeLayout.layout(0, 0, displaySize.x, displaySize.y); setupCharts();
setDataFields();
invalidate();
} }
invalidate(); wearUtil.releaseWakeLock(wl);
} }
} }
private boolean needUpdate() {
if (mLastSvg.equals(rawData.sSgv) && mLastDirection.equals(rawData.sDirection)) {
return false;
}
mLastSvg = rawData.sSgv;
mLastDirection = rawData.sDirection;
return true;
}
} }

View file

@ -60,7 +60,9 @@ public class Cockpit extends BaseWatchFace {
} }
} }
if (loopLevel == 1) { if (loopLevel == -1) {
mLoop.setBackgroundResource(R.drawable.loop_grey_25);
} else if (loopLevel == 1) {
mLoop.setBackgroundResource(R.drawable.loop_green_25); mLoop.setBackgroundResource(R.drawable.loop_green_25);
} else { } else {
mLoop.setBackgroundResource(R.drawable.loop_red_25); mLoop.setBackgroundResource(R.drawable.loop_red_25);

View file

@ -117,7 +117,9 @@ public class Home2 extends BaseWatchFace {
mBasalRate.setTextColor(dividerTxtColor); mBasalRate.setTextColor(dividerTxtColor);
mBgi.setTextColor(dividerTxtColor); mBgi.setTextColor(dividerTxtColor);
if (loopLevel == 1) { if (loopLevel == -1) {
mLoop.setBackgroundResource(R.drawable.loop_grey_25);
} else if (loopLevel == 1) {
mLoop.setBackgroundResource(R.drawable.loop_green_25); mLoop.setBackgroundResource(R.drawable.loop_green_25);
} else { } else {
mLoop.setBackgroundResource(R.drawable.loop_red_25); mLoop.setBackgroundResource(R.drawable.loop_red_25);
@ -226,7 +228,9 @@ public class Home2 extends BaseWatchFace {
mBasalRate.setTextColor(dividerTxtColor); mBasalRate.setTextColor(dividerTxtColor);
mBgi.setTextColor(dividerTxtColor); mBgi.setTextColor(dividerTxtColor);
if (loopLevel == 1) { if (loopLevel == -1) {
mLoop.setBackgroundResource(R.drawable.loop_grey_25);
} else if (loopLevel == 1) {
mLoop.setBackgroundResource(R.drawable.loop_green_25); mLoop.setBackgroundResource(R.drawable.loop_green_25);
} else { } else {
mLoop.setBackgroundResource(R.drawable.loop_red_25); mLoop.setBackgroundResource(R.drawable.loop_red_25);

View file

@ -67,7 +67,7 @@ public class Steampunk extends BaseWatchFace {
protected void setColorDark() { protected void setColorDark() {
if (mLinearLayout2 != null) { if (mLinearLayout2 != null) {
if (ageLevel() <= 0) { if (ageLevel() <= 0 && rawData.datetime != 0) {
mLinearLayout2.setBackgroundResource(R.drawable.redline); mLinearLayout2.setBackgroundResource(R.drawable.redline);
mTimestamp.setTextColor(getResources().getColor(R.color.red_600)); mTimestamp.setTextColor(getResources().getColor(R.color.red_600));
} else { } else {
@ -108,6 +108,7 @@ public class Steampunk extends BaseWatchFace {
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)
if (lastEndDegrees == 0) lastEndDegrees = rotationAngle;
//rotate glucose dial //rotate glucose dial
RotateAnimation rotate = new RotateAnimation( RotateAnimation rotate = new RotateAnimation(

View file

@ -559,11 +559,6 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
<!-- FLAGs --> <!-- FLAGs -->
<TextView <TextView
android:id="@+id/AAPSv2" android:id="@+id/AAPSv2"

View file

@ -154,9 +154,4 @@
</LinearLayout> </LinearLayout>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View file

@ -370,9 +370,4 @@
</LinearLayout> </LinearLayout>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View file

@ -136,9 +136,4 @@
</LinearLayout> </LinearLayout>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View file

@ -488,9 +488,4 @@
</LinearLayout> </LinearLayout>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View file

@ -378,9 +378,4 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone"/> android:visibility="gone"/>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View file

@ -560,11 +560,6 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
<!-- FLAGs --> <!-- FLAGs -->
<TextView <TextView
android:id="@+id/AAPSv2" android:id="@+id/AAPSv2"

View file

@ -152,9 +152,4 @@
</LinearLayout> </LinearLayout>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View file

@ -383,9 +383,4 @@
</LinearLayout> </LinearLayout>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View file

@ -135,9 +135,4 @@
</LinearLayout> </LinearLayout>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View file

@ -488,9 +488,4 @@
</LinearLayout> </LinearLayout>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View file

@ -378,9 +378,4 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone"/> android:visibility="gone"/>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View file

@ -1,81 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/black"
android:orientation="vertical"
android:weightSum="100">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="50"
android:gravity="center_horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginBottom="5dp"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:textAlignment="center">
<TextView
android:id="@+id/simple_sgv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="-2dp"
android:gravity="bottom|end"
android:text="---"
android:textColor="@color/white"
android:textSize="50sp" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal"
android:baselineAligned="false"
android:gravity="center_horizontal"
android:orientation="vertical"
android:textAlignment="center"
android:weightSum="1">
<TextView
android:id="@+id/simple_direction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginTop="-2dp"
android:layout_marginBottom="-5dp"
android:gravity="center_horizontal|bottom"
android:text="--"
android:textColor="@color/white"
android:textSize="35sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="50"
android:gravity="center_horizontal">
<TextView
android:id="@+id/simple_watch_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top"
android:layout_marginTop="5dp"
android:text="12:00"
android:textColor="#FFFFFF"
android:textSize="35sp" />
</LinearLayout>
</LinearLayout>

View file

@ -65,4 +65,18 @@
<item>none</item> <item>none</item>
</string-array> </string-array>
<string-array name="watchface_simplify_ui_name">
<item>Off</item>
<item>During Charging</item>
<item>Always On Mode</item>
<item>Always On and Charging</item>
</string-array>
<string-array name="watchface_simplify_ui_values">
<item>off</item>
<item>charging</item>
<item>ambient</item>
<item>ambient_charging</item>
</string-array>
</resources> </resources>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="simple_ui_svg_text_size">50sp</dimen>
<dimen name="simple_ui_direction_text_size">35sp</dimen>
<dimen name="simple_ui_time_text_size">35sp</dimen>
<dimen name="simple_ui_y_offset">5dp</dimen>
</resources>

View file

@ -136,8 +136,8 @@
<string name="color_name_white">white</string> <string name="color_name_white">white</string>
<string name="color_name_black">black</string> <string name="color_name_black">black</string>
<string name="color_name_multicolor">multicolor</string> <string name="color_name_multicolor">multicolor</string>
<string name="pref_simplify_ui_charging">Simplify Charging UI</string> <string name="pref_simplify_ui">Simplify UI</string>
<string name="pref_simplify_ui_charging_sum">Only show time and BG when charging</string> <string name="pref_simplify_ui_sum">Only show time and BG</string>
<string name="pref_vibrate_hourly">Vibrate hourly</string> <string name="pref_vibrate_hourly">Vibrate hourly</string>

View file

@ -5,16 +5,16 @@
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
android:key="show_iob" android:key="show_iob"
android:title="@string/pref_show_iob"
android:summary="Show insulin on board." android:summary="Show insulin on board."
android:title="@string/pref_show_iob"
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 <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
android:key="show_cob" android:key="show_cob"
android:title="@string/pref_show_cob"
android:summary="Show carb on board." android:summary="Show carb on board."
android:title="@string/pref_show_cob"
app:wear_iconOff="@drawable/settings_off" app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" /> app:wear_iconOn="@drawable/settings_on" />
@ -24,7 +24,7 @@
android:summary="Show BG." android:summary="Show BG."
android:title="@string/pref_show_bg" android:title="@string/pref_show_bg"
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 <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
@ -32,7 +32,7 @@
android:summary="Show delta." android:summary="Show delta."
android:title="@string/pref_show_delta" android:title="@string/pref_show_delta"
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 <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
@ -40,14 +40,14 @@
android:summary="Show the avgDelta." android:summary="Show the avgDelta."
android:title="@string/pref_show_avgdelta" android:title="@string/pref_show_avgdelta"
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 <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
android:key="show_direction" android:key="show_direction"
android:summary="Show direction arrow" android:summary="Show direction arrow"
android:title="@string/pref_show_direction_arrow" android:title="@string/pref_show_direction_arrow"
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 <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
@ -55,7 +55,7 @@
android:summary="Minutes since last reading." android:summary="Minutes since last reading."
android:title="@string/pref_show_ago" android:title="@string/pref_show_ago"
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 <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
@ -85,15 +85,13 @@
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 <CheckBoxPreference
android:defaultValue="false" android:defaultValue="false"
android:key="highlight_basals" android:key="highlight_basals"
android:summary="Better visible basal rate and temp basals" android:summary="Better visible basal rate and temp basals"
android:title="@string/pref_highlight_basals" android:title="@string/pref_highlight_basals"
app:wear_iconOff="@drawable/settings_off" app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/> app:wear_iconOn="@drawable/settings_on" />
<ListPreference <ListPreference
android:defaultValue="3" android:defaultValue="3"
@ -103,14 +101,12 @@
android:summary="Chart Timeframe" android:summary="Chart Timeframe"
android:title="@string/pref_chart_timeframe" /> android:title="@string/pref_chart_timeframe" />
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
android:key="units_mgdl" android:key="units_mgdl"
android:title="@string/pref_units_for_actions"
android:summaryOn="mg/dl"
android:summaryOff="mmol/l" android:summaryOff="mmol/l"
android:summaryOn="mg/dl"
android:title="@string/pref_units_for_actions"
app:wear_iconOff="@drawable/settings_off" app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" /> app:wear_iconOn="@drawable/settings_on" />
@ -128,7 +124,7 @@
android:summary="Wizard from watch possible" android:summary="Wizard from watch possible"
android:title="@string/pref_wizard_in_menu" android:title="@string/pref_wizard_in_menu"
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 <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
@ -143,7 +139,7 @@
android:summary="Prime/Fill from watch possible" android:summary="Prime/Fill from watch possible"
android:title="@string/pref_prime_in_menu" android:title="@string/pref_prime_in_menu"
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 <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
@ -151,7 +147,7 @@
android:summary="Single temp-target instead of a range." android:summary="Single temp-target instead of a range."
android:title="@string/pref_single_target" android:title="@string/pref_single_target"
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 <CheckBoxPreference
android:defaultValue="false" android:defaultValue="false"
@ -159,9 +155,7 @@
android:summary="Percentage correction." android:summary="Percentage correction."
android:title="@string/pref_wizard_percentage" android:title="@string/pref_wizard_percentage"
app:wear_iconOff="@drawable/settings_off" app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/> app:wear_iconOn="@drawable/settings_on" />
<ListPreference <ListPreference
android:defaultValue="default" android:defaultValue="default"
@ -177,7 +171,7 @@
android:summary="Use unicode special characters in complications." android:summary="Use unicode special characters in complications."
android:title="@string/pref_unicode_in_complications" android:title="@string/pref_unicode_in_complications"
app:wear_iconOff="@drawable/settings_off" app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/> app:wear_iconOn="@drawable/settings_on" />
<info.nightscout.androidaps.interaction.utils.VersionPreference <info.nightscout.androidaps.interaction.utils.VersionPreference
android:defaultValue="1" android:defaultValue="1"

View file

@ -9,12 +9,13 @@
android:summary="Dark theme" android:summary="Dark theme"
android:title="@string/pref_dark" android:title="@string/pref_dark"
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 <CheckBoxPreference
android:defaultValue="false"
android:key="vibrate_Hourly" android:key="vibrate_Hourly"
android:title="@string/pref_vibrate_hourly" android:title="@string/pref_vibrate_hourly"
android:defaultValue="false"
app:wear_iconOff="@drawable/settings_off" app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" /> app:wear_iconOn="@drawable/settings_on" />
</PreferenceScreen> </PreferenceScreen>

View file

@ -8,7 +8,7 @@
android:summary="Dark theme" android:summary="Dark theme"
android:title="@string/pref_dark" android:title="@string/pref_dark"
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 <CheckBoxPreference
android:defaultValue="false" android:defaultValue="false"
@ -16,7 +16,7 @@
android:summary="Big numbers. (Circle WF)" android:summary="Big numbers. (Circle WF)"
android:title="@string/pref_big_numbers" android:title="@string/pref_big_numbers"
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 <CheckBoxPreference
android:defaultValue="false" android:defaultValue="false"
@ -32,7 +32,7 @@
android:summary="Less eyecandy. (Circle WF)" android:summary="Less eyecandy. (Circle WF)"
android:title="@string/pref_light_ring_history" android:title="@string/pref_light_ring_history"
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 <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
@ -40,13 +40,13 @@
android:summary="Animations. (Circle WF)" android:summary="Animations. (Circle WF)"
android:title="@string/pref_animations" android:title="@string/pref_animations"
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 <CheckBoxPreference
android:defaultValue="false"
android:key="vibrate_Hourly" android:key="vibrate_Hourly"
android:title="@string/pref_vibrate_hourly" android:title="@string/pref_vibrate_hourly"
android:defaultValue="false"
app:wear_iconOff="@drawable/settings_off" app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" /> app:wear_iconOn="@drawable/settings_on" />
</PreferenceScreen> </PreferenceScreen>

View file

@ -3,18 +3,18 @@
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="false"
android:key="vibrate_Hourly" android:key="vibrate_Hourly"
android:title="@string/pref_vibrate_hourly" android:title="@string/pref_vibrate_hourly"
android:defaultValue="false"
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 <ListPreference
android:defaultValue="false" android:defaultValue="off"
android:key="simplify_ui_charging" android:entries="@array/watchface_simplify_ui_name"
android:summary="@string/pref_simplify_ui_charging_sum" android:entryValues="@array/watchface_simplify_ui_values"
android:title="@string/pref_simplify_ui_charging" android:key="simplify_ui"
app:wear_iconOff="@drawable/settings_off" android:summary="@string/pref_simplify_ui_sum"
app:wear_iconOn="@drawable/settings_on" /> android:title="@string/pref_simplify_ui" />
</PreferenceScreen> </PreferenceScreen>

View file

@ -4,59 +4,59 @@
<ListPreference <ListPreference
android:key="digitalstyle_frameStyle"
android:title="@string/digitalstyle_pref_your_style"
android:defaultValue="full" android:defaultValue="full"
android:entries="@array/digitalstyle_styles_name" android:entries="@array/digitalstyle_styles_name"
android:entryValues="@array/digitalstyle_styles_values"/> android:entryValues="@array/digitalstyle_styles_values"
android:key="digitalstyle_frameStyle"
android:title="@string/digitalstyle_pref_your_style" />
<ListPreference <ListPreference
android:key="digitalstyle_frameColor"
android:title="@string/digitalstyle_pref_your_color"
android:defaultValue="red" android:defaultValue="red"
android:entries="@array/digitalstyle_color_name" android:entries="@array/digitalstyle_color_name"
android:entryValues="@array/digitalstyle_color_values"/> android:entryValues="@array/digitalstyle_color_values"
android:key="digitalstyle_frameColor"
android:title="@string/digitalstyle_pref_your_color" />
<ListPreference <ListPreference
android:key="digitalstyle_frameColorSaturation"
android:title="@string/digitalstyle_pref_your_color_saturation"
android:defaultValue="700" android:defaultValue="700"
android:entries="@array/digitalstyle_color_saturation" android:entries="@array/digitalstyle_color_saturation"
android:entryValues="@array/digitalstyle_color_saturation"/> android:entryValues="@array/digitalstyle_color_saturation"
android:key="digitalstyle_frameColorSaturation"
android:title="@string/digitalstyle_pref_your_color_saturation" />
<ListPreference <ListPreference
android:key="digitalstyle_frameColorOpacity"
android:title="@string/digitalstyle_pref_your_color_opacity"
android:defaultValue="1" android:defaultValue="1"
android:entries="@array/digitalstyle_color_opacity_name" android:entries="@array/digitalstyle_color_opacity_name"
android:entryValues="@array/digitalstyle_color_opacity_value"/> android:entryValues="@array/digitalstyle_color_opacity_value"
android:key="digitalstyle_frameColorOpacity"
android:title="@string/digitalstyle_pref_your_color_opacity" />
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="true"
android:key="show_date" android:key="show_date"
android:title="@string/pref_show_date" android:title="@string/pref_show_date"
android:defaultValue="true"
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 <CheckBoxPreference
android:defaultValue="false"
android:key="show_weeknumber" android:key="show_weeknumber"
android:title="@string/pref_show_weeknumber" android:title="@string/pref_show_weeknumber"
android:defaultValue="false"
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 <CheckBoxPreference
android:defaultValue="false"
android:key="vibrate_Hourly" android:key="vibrate_Hourly"
android:title="@string/pref_vibrate_hourly" android:title="@string/pref_vibrate_hourly"
android:defaultValue="false"
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 <ListPreference
android:defaultValue="false" android:defaultValue="off"
android:key="simplify_ui_charging" android:entries="@array/watchface_simplify_ui_name"
android:summary="@string/pref_simplify_ui_charging_sum" android:entryValues="@array/watchface_simplify_ui_values"
android:title="@string/pref_simplify_ui_charging" android:key="simplify_ui"
app:wear_iconOff="@drawable/settings_off" android:summary="@string/pref_simplify_ui_sum"
app:wear_iconOn="@drawable/settings_on" /> android:title="@string/pref_simplify_ui" />
</PreferenceScreen> </PreferenceScreen>

View file

@ -8,7 +8,7 @@
android:summary="Dark theme" android:summary="Dark theme"
android:title="@string/pref_dark" android:title="@string/pref_dark"
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 <CheckBoxPreference
android:defaultValue="false" android:defaultValue="false"
@ -16,21 +16,21 @@
android:summary="Status bar divider background matches watchface background" android:summary="Status bar divider background matches watchface background"
android:title="@string/pref_matching_divider" android:title="@string/pref_matching_divider"
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 <CheckBoxPreference
android:defaultValue="false"
android:key="vibrate_Hourly" android:key="vibrate_Hourly"
android:title="@string/pref_vibrate_hourly" android:title="@string/pref_vibrate_hourly"
android:defaultValue="false"
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 <ListPreference
android:defaultValue="false" android:defaultValue="off"
android:key="simplify_ui_charging" android:entries="@array/watchface_simplify_ui_name"
android:summary="@string/pref_simplify_ui_charging_sum" android:entryValues="@array/watchface_simplify_ui_values"
android:title="@string/pref_simplify_ui_charging" android:key="simplify_ui"
app:wear_iconOff="@drawable/settings_off" android:summary="@string/pref_simplify_ui_sum"
app:wear_iconOn="@drawable/settings_on" /> android:title="@string/pref_simplify_ui" />
</PreferenceScreen> </PreferenceScreen>

View file

@ -32,12 +32,12 @@
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 <ListPreference
android:defaultValue="false" android:defaultValue="off"
android:key="simplify_ui_charging" android:entries="@array/watchface_simplify_ui_name"
android:summary="@string/pref_simplify_ui_charging_sum" android:entryValues="@array/watchface_simplify_ui_values"
android:title="@string/pref_simplify_ui_charging" android:key="simplify_ui"
app:wear_iconOff="@drawable/settings_off" android:summary="@string/pref_simplify_ui_sum"
app:wear_iconOn="@drawable/settings_on" /> android:title="@string/pref_simplify_ui" />
</PreferenceScreen> </PreferenceScreen>

View file

@ -8,7 +8,7 @@
android:summary="Dark theme" android:summary="Dark theme"
android:title="@string/pref_dark" android:title="@string/pref_dark"
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 <CheckBoxPreference
android:defaultValue="false" android:defaultValue="false"
@ -16,21 +16,21 @@
android:summary="Status bar divider background matches watchface background" android:summary="Status bar divider background matches watchface background"
android:title="@string/pref_matching_divider" android:title="@string/pref_matching_divider"
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 <CheckBoxPreference
android:defaultValue="false"
android:key="vibrate_Hourly" android:key="vibrate_Hourly"
android:title="@string/pref_vibrate_hourly" android:title="@string/pref_vibrate_hourly"
android:defaultValue="false"
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 <ListPreference
android:defaultValue="false" android:defaultValue="off"
android:key="simplify_ui_charging" android:entries="@array/watchface_simplify_ui_name"
android:summary="@string/pref_simplify_ui_charging_sum" android:entryValues="@array/watchface_simplify_ui_values"
android:title="@string/pref_simplify_ui_charging" android:key="simplify_ui"
app:wear_iconOff="@drawable/settings_off" android:summary="@string/pref_simplify_ui_sum"
app:wear_iconOn="@drawable/settings_on" /> android:title="@string/pref_simplify_ui" />
</PreferenceScreen> </PreferenceScreen>

View file

@ -8,13 +8,14 @@
android:summary="Dark theme" android:summary="Dark theme"
android:title="@string/pref_dark" android:title="@string/pref_dark"
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 <CheckBoxPreference
android:defaultValue="false"
android:key="vibrate_Hourly" android:key="vibrate_Hourly"
android:title="@string/pref_vibrate_hourly" android:title="@string/pref_vibrate_hourly"
android:defaultValue="false"
app:wear_iconOff="@drawable/settings_off" app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" /> app:wear_iconOn="@drawable/settings_on" />
</PreferenceScreen> </PreferenceScreen>

View file

@ -11,18 +11,18 @@
android:title="@string/pref_delta_granularity" /> android:title="@string/pref_delta_granularity" />
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="false"
android:key="vibrate_Hourly" android:key="vibrate_Hourly"
android:title="@string/pref_vibrate_hourly" android:title="@string/pref_vibrate_hourly"
android:defaultValue="false"
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 <ListPreference
android:defaultValue="false" android:defaultValue="off"
android:key="simplify_ui_charging" android:entries="@array/watchface_simplify_ui_name"
android:summary="@string/pref_simplify_ui_charging_sum" android:entryValues="@array/watchface_simplify_ui_values"
android:title="@string/pref_simplify_ui_charging" android:key="simplify_ui"
app:wear_iconOff="@drawable/settings_off" android:summary="@string/pref_simplify_ui_sum"
app:wear_iconOn="@drawable/settings_on" /> android:title="@string/pref_simplify_ui" />
</PreferenceScreen> </PreferenceScreen>