Merge pull request #523 from MilosKozak/watchfacesandrew
wear timestamps long
This commit is contained in:
commit
acf9d2199b
|
@ -308,7 +308,7 @@ public class NSDeviceStatus {
|
||||||
return Html.fromHtml(string.toString());
|
return Html.fromHtml(string.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getOpenApsTimestamp() {
|
public static long getOpenApsTimestamp() {
|
||||||
|
|
||||||
if (deviceStatusOpenAPSData.clockSuggested != 0) {
|
if (deviceStatusOpenAPSData.clockSuggested != 0) {
|
||||||
return deviceStatusOpenAPSData.clockSuggested;
|
return deviceStatusOpenAPSData.clockSuggested;
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.Config;
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
@ -122,11 +123,6 @@ public class WatchUpdaterService extends WearableListenerService implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
double timestamp = 0;
|
|
||||||
if (intent != null) {
|
|
||||||
timestamp = intent.getDoubleExtra("timestamp", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
String action = null;
|
String action = null;
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
action = intent.getAction();
|
action = intent.getAction();
|
||||||
|
@ -247,7 +243,7 @@ public class WatchUpdaterService extends WearableListenerService implements
|
||||||
|
|
||||||
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.putLong("timestamp", lastBG.date);
|
||||||
if (glucoseStatus == null) {
|
if (glucoseStatus == null) {
|
||||||
dataMap.putString("slopeArrow", "");
|
dataMap.putString("slopeArrow", "");
|
||||||
dataMap.putString("delta", "--");
|
dataMap.putString("delta", "--");
|
||||||
|
@ -481,7 +477,7 @@ public class WatchUpdaterService extends WearableListenerService implements
|
||||||
if (googleApiClient.isConnected()) {
|
if (googleApiClient.isConnected()) {
|
||||||
PutDataMapRequest dataMapRequest = PutDataMapRequest.create(OPEN_SETTINGS_PATH);
|
PutDataMapRequest dataMapRequest = PutDataMapRequest.create(OPEN_SETTINGS_PATH);
|
||||||
//unique content
|
//unique content
|
||||||
dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis());
|
dataMapRequest.getDataMap().putLong("timestamp", System.currentTimeMillis());
|
||||||
dataMapRequest.getDataMap().putString("openSettings", "openSettings");
|
dataMapRequest.getDataMap().putString("openSettings", "openSettings");
|
||||||
PutDataRequest putDataRequest = dataMapRequest.asPutDataRequest();
|
PutDataRequest putDataRequest = dataMapRequest.asPutDataRequest();
|
||||||
Wearable.DataApi.putDataItem(googleApiClient, putDataRequest);
|
Wearable.DataApi.putDataItem(googleApiClient, putDataRequest);
|
||||||
|
@ -494,7 +490,7 @@ public class WatchUpdaterService extends WearableListenerService implements
|
||||||
if (googleApiClient.isConnected()) {
|
if (googleApiClient.isConnected()) {
|
||||||
PutDataMapRequest dataMapRequest = PutDataMapRequest.create(BOLUS_PROGRESS_PATH);
|
PutDataMapRequest dataMapRequest = PutDataMapRequest.create(BOLUS_PROGRESS_PATH);
|
||||||
//unique content
|
//unique content
|
||||||
dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis());
|
dataMapRequest.getDataMap().putLong("timestamp", System.currentTimeMillis());
|
||||||
dataMapRequest.getDataMap().putString("bolusProgress", "bolusProgress");
|
dataMapRequest.getDataMap().putString("bolusProgress", "bolusProgress");
|
||||||
dataMapRequest.getDataMap().putString("progressstatus", status);
|
dataMapRequest.getDataMap().putString("progressstatus", status);
|
||||||
dataMapRequest.getDataMap().putInt("progresspercent", progresspercent);
|
dataMapRequest.getDataMap().putInt("progresspercent", progresspercent);
|
||||||
|
@ -509,7 +505,7 @@ public class WatchUpdaterService extends WearableListenerService implements
|
||||||
if (googleApiClient.isConnected()) {
|
if (googleApiClient.isConnected()) {
|
||||||
PutDataMapRequest dataMapRequest = PutDataMapRequest.create(ACTION_CONFIRMATION_REQUEST_PATH);
|
PutDataMapRequest dataMapRequest = PutDataMapRequest.create(ACTION_CONFIRMATION_REQUEST_PATH);
|
||||||
//unique content
|
//unique content
|
||||||
dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis());
|
dataMapRequest.getDataMap().putLong("timestamp", System.currentTimeMillis());
|
||||||
dataMapRequest.getDataMap().putString("actionConfirmationRequest", "actionConfirmationRequest");
|
dataMapRequest.getDataMap().putString("actionConfirmationRequest", "actionConfirmationRequest");
|
||||||
dataMapRequest.getDataMap().putString("title", title);
|
dataMapRequest.getDataMap().putString("title", title);
|
||||||
dataMapRequest.getDataMap().putString("message", message);
|
dataMapRequest.getDataMap().putString("message", message);
|
||||||
|
@ -551,8 +547,16 @@ public class WatchUpdaterService extends WearableListenerService implements
|
||||||
int phoneBattery = getBatteryLevel(getApplicationContext());
|
int phoneBattery = getBatteryLevel(getApplicationContext());
|
||||||
String rigBattery = NSDeviceStatus.getInstance().getUploaderStatus().trim();
|
String rigBattery = NSDeviceStatus.getInstance().getUploaderStatus().trim();
|
||||||
|
|
||||||
|
|
||||||
|
long openApsStatus = -1;
|
||||||
//OpenAPS status
|
//OpenAPS status
|
||||||
Double openApsStatus = NSDeviceStatus.getOpenApsTimestamp();
|
if(Config.APS){
|
||||||
|
//we are AndroidAPS
|
||||||
|
openApsStatus = LoopPlugin.lastRun != null && LoopPlugin.lastRun.lastEnact != null && LoopPlugin.lastRun.lastEnact.getTime() != 0 ? LoopPlugin.lastRun.lastEnact.getTime(): -1;
|
||||||
|
} else {
|
||||||
|
//NSClient or remote
|
||||||
|
openApsStatus = NSDeviceStatus.getOpenApsTimestamp();
|
||||||
|
}
|
||||||
|
|
||||||
PutDataMapRequest dataMapRequest = PutDataMapRequest.create(NEW_STATUS_PATH);
|
PutDataMapRequest dataMapRequest = PutDataMapRequest.create(NEW_STATUS_PATH);
|
||||||
//unique content
|
//unique content
|
||||||
|
@ -564,7 +568,7 @@ public class WatchUpdaterService extends WearableListenerService implements
|
||||||
dataMapRequest.getDataMap().putString("tempBasal", tempBasal);
|
dataMapRequest.getDataMap().putString("tempBasal", tempBasal);
|
||||||
dataMapRequest.getDataMap().putString("battery", "" + phoneBattery);
|
dataMapRequest.getDataMap().putString("battery", "" + phoneBattery);
|
||||||
dataMapRequest.getDataMap().putString("rigBattery", rigBattery);
|
dataMapRequest.getDataMap().putString("rigBattery", rigBattery);
|
||||||
dataMapRequest.getDataMap().putDouble("openApsStatus", openApsStatus);
|
dataMapRequest.getDataMap().putLong("openApsStatus", openApsStatus);
|
||||||
dataMapRequest.getDataMap().putString("bgi", bgiString);
|
dataMapRequest.getDataMap().putString("bgi", bgiString);
|
||||||
dataMapRequest.getDataMap().putBoolean("showBgi", mPrefs.getBoolean("wear_showbgi", false));
|
dataMapRequest.getDataMap().putBoolean("showBgi", mPrefs.getBoolean("wear_showbgi", false));
|
||||||
dataMapRequest.getDataMap().putInt("batteryLevel", (phoneBattery >= 30) ? 1 : 0);
|
dataMapRequest.getDataMap().putInt("batteryLevel", (phoneBattery >= 30) ? 1 : 0);
|
||||||
|
@ -582,7 +586,7 @@ public class WatchUpdaterService extends WearableListenerService implements
|
||||||
|
|
||||||
PutDataMapRequest dataMapRequest = PutDataMapRequest.create(NEW_PREFERENCES_PATH);
|
PutDataMapRequest dataMapRequest = PutDataMapRequest.create(NEW_PREFERENCES_PATH);
|
||||||
//unique content
|
//unique content
|
||||||
dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis());
|
dataMapRequest.getDataMap().putLong("timestamp", System.currentTimeMillis());
|
||||||
dataMapRequest.getDataMap().putBoolean("wearcontrol", wearcontrol);
|
dataMapRequest.getDataMap().putBoolean("wearcontrol", wearcontrol);
|
||||||
PutDataRequest putDataRequest = dataMapRequest.asPutDataRequest();
|
PutDataRequest putDataRequest = dataMapRequest.asPutDataRequest();
|
||||||
Wearable.DataApi.putDataItem(googleApiClient, putDataRequest);
|
Wearable.DataApi.putDataItem(googleApiClient, putDataRequest);
|
||||||
|
|
|
@ -7,9 +7,9 @@ public class BgWatchData implements Comparable<BgWatchData>{
|
||||||
public double sgv;
|
public double sgv;
|
||||||
public double high;
|
public double high;
|
||||||
public double low;
|
public double low;
|
||||||
public double timestamp;
|
public long timestamp;
|
||||||
|
|
||||||
public BgWatchData(double aSgv, double aHigh, double aLow, double aTimestamp) {
|
public BgWatchData(double aSgv, double aHigh, double aLow, long aTimestamp) {
|
||||||
this.sgv = aSgv;
|
this.sgv = aSgv;
|
||||||
this.high = aHigh;
|
this.high = aHigh;
|
||||||
this.low = aLow;
|
this.low = aLow;
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
|
||||||
public boolean layoutSet = false;
|
public boolean layoutSet = false;
|
||||||
public BgGraphBuilder bgGraphBuilder;
|
public BgGraphBuilder bgGraphBuilder;
|
||||||
public LineChartView chart;
|
public LineChartView chart;
|
||||||
public double datetime;
|
public long datetime;
|
||||||
public ArrayList<BgWatchData> bgDataList = new ArrayList<>();
|
public ArrayList<BgWatchData> bgDataList = new ArrayList<>();
|
||||||
public ArrayList<TempWatchData> tempWatchDataList = new ArrayList<>();
|
public ArrayList<TempWatchData> tempWatchDataList = new ArrayList<>();
|
||||||
public ArrayList<BasalWatchData> basalWatchDataList = new ArrayList<>();
|
public ArrayList<BasalWatchData> basalWatchDataList = new ArrayList<>();
|
||||||
|
@ -281,7 +281,7 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
|
||||||
wakeLock.acquire(50);
|
wakeLock.acquire(50);
|
||||||
sgvLevel = dataMap.getLong("sgvLevel");
|
sgvLevel = dataMap.getLong("sgvLevel");
|
||||||
batteryLevel = dataMap.getInt("batteryLevel");
|
batteryLevel = dataMap.getInt("batteryLevel");
|
||||||
datetime = dataMap.getDouble("timestamp");
|
datetime = dataMap.getLong("timestamp");
|
||||||
rawString = dataMap.getString("rawString");
|
rawString = dataMap.getString("rawString");
|
||||||
sgvString = dataMap.getString("sgvString");
|
sgvString = dataMap.getString("sgvString");
|
||||||
batteryString = dataMap.getString("battery");
|
batteryString = dataMap.getString("battery");
|
||||||
|
@ -604,14 +604,14 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
|
||||||
double sgv = entry.getDouble("sgvDouble");
|
double sgv = entry.getDouble("sgvDouble");
|
||||||
double high = entry.getDouble("high");
|
double high = entry.getDouble("high");
|
||||||
double low = entry.getDouble("low");
|
double low = entry.getDouble("low");
|
||||||
double timestamp = entry.getDouble("timestamp");
|
long timestamp = entry.getLong("timestamp");
|
||||||
bgDataList.add(new BgWatchData(sgv, high, low, timestamp));
|
bgDataList.add(new BgWatchData(sgv, high, low, timestamp));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
double sgv = dataMap.getDouble("sgvDouble");
|
double sgv = dataMap.getDouble("sgvDouble");
|
||||||
double high = dataMap.getDouble("high");
|
double high = dataMap.getDouble("high");
|
||||||
double low = dataMap.getDouble("low");
|
double low = dataMap.getDouble("low");
|
||||||
double timestamp = dataMap.getDouble("timestamp");
|
long timestamp = dataMap.getLong("timestamp");
|
||||||
|
|
||||||
final int size = bgDataList.size();
|
final int size = bgDataList.size();
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
||||||
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, mRigBattery, mDelta, mAvgDelta, mStatus, mBasalRate, mIOB1, mIOB2, mCOB1, mCOB2, mBgi, mLoop, mDay, mMonth, isAAPSv2, mHighLight, mLowLight;
|
public TextView mTime, mSgv, mDirection, mTimestamp, mUploaderBattery, mRigBattery, mDelta, mAvgDelta, mStatus, mBasalRate, mIOB1, mIOB2, mCOB1, mCOB2, mBgi, mLoop, mDay, mMonth, isAAPSv2, mHighLight, mLowLight;
|
||||||
public double datetime;
|
public long datetime;
|
||||||
public RelativeLayout mRelativeLayout;
|
public RelativeLayout mRelativeLayout;
|
||||||
public LinearLayout mLinearLayout, mLinearLayout2, mDate;
|
public LinearLayout mLinearLayout, mLinearLayout2, mDate;
|
||||||
public long sgvLevel = 0;
|
public long sgvLevel = 0;
|
||||||
|
@ -85,7 +85,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
||||||
|
|
||||||
public boolean detailedIOB = false;
|
public boolean detailedIOB = false;
|
||||||
public boolean showBGI = false;
|
public boolean showBGI = false;
|
||||||
public Double openApsStatus;
|
public long openApsStatus;
|
||||||
public String externalStatusString = "no status";
|
public String externalStatusString = "no status";
|
||||||
public String sSgv = "---";
|
public String sSgv = "---";
|
||||||
public String sDirection = "--";
|
public String sDirection = "--";
|
||||||
|
@ -213,6 +213,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
||||||
@Override
|
@Override
|
||||||
protected void onDraw(Canvas canvas) {
|
protected void onDraw(Canvas canvas) {
|
||||||
if (layoutSet) {
|
if (layoutSet) {
|
||||||
|
setupCharts();
|
||||||
this.mRelativeLayout.draw(canvas);
|
this.mRelativeLayout.draw(canvas);
|
||||||
Log.d("onDraw", "draw");
|
Log.d("onDraw", "draw");
|
||||||
}
|
}
|
||||||
|
@ -241,7 +242,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
||||||
DataMap dataMap = DataMap.fromBundle(bundle);
|
DataMap dataMap = DataMap.fromBundle(bundle);
|
||||||
wakeLock.acquire(50);
|
wakeLock.acquire(50);
|
||||||
sgvLevel = dataMap.getLong("sgvLevel");
|
sgvLevel = dataMap.getLong("sgvLevel");
|
||||||
datetime = dataMap.getDouble("timestamp");
|
datetime = dataMap.getLong("timestamp");
|
||||||
sSgv = dataMap.getString("sgvString");
|
sSgv = dataMap.getString("sgvString");
|
||||||
sDirection = dataMap.getString("slopeArrow");
|
sDirection = dataMap.getString("slopeArrow");
|
||||||
sDelta = dataMap.getString("delta");
|
sDelta = dataMap.getString("delta");
|
||||||
|
@ -268,7 +269,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
||||||
showBGI = dataMap.getBoolean("showBgi");
|
showBGI = dataMap.getBoolean("showBgi");
|
||||||
externalStatusString = dataMap.getString("externalStatusString");
|
externalStatusString = dataMap.getString("externalStatusString");
|
||||||
batteryLevel = dataMap.getInt("batteryLevel");
|
batteryLevel = dataMap.getInt("batteryLevel");
|
||||||
openApsStatus = dataMap.getDouble("openApsStatus");
|
openApsStatus = dataMap.getLong("openApsStatus");
|
||||||
}
|
}
|
||||||
|
|
||||||
setDataFields();
|
setDataFields();
|
||||||
|
@ -453,7 +454,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
||||||
if (mLoop != null) {
|
if (mLoop != null) {
|
||||||
if (sharedPrefs.getBoolean("showExternalStatus", true)) {
|
if (sharedPrefs.getBoolean("showExternalStatus", true)) {
|
||||||
mLoop.setVisibility(View.VISIBLE);
|
mLoop.setVisibility(View.VISIBLE);
|
||||||
if (openApsStatus != null) {
|
if (openApsStatus != -1) {
|
||||||
int mins = (int) ((System.currentTimeMillis() - openApsStatus) / 1000 / 60);
|
int mins = (int) ((System.currentTimeMillis() - openApsStatus) / 1000 / 60);
|
||||||
mLoop.setText(mins + "'");
|
mLoop.setText(mins + "'");
|
||||||
if (mins > 14) {
|
if (mins > 14) {
|
||||||
|
@ -557,14 +558,14 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
||||||
double sgv = entry.getDouble("sgvDouble");
|
double sgv = entry.getDouble("sgvDouble");
|
||||||
double high = entry.getDouble("high");
|
double high = entry.getDouble("high");
|
||||||
double low = entry.getDouble("low");
|
double low = entry.getDouble("low");
|
||||||
double timestamp = entry.getDouble("timestamp");
|
long timestamp = entry.getLong("timestamp");
|
||||||
bgDataList.add(new BgWatchData(sgv, high, low, timestamp));
|
bgDataList.add(new BgWatchData(sgv, high, low, timestamp));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
double sgv = dataMap.getDouble("sgvDouble");
|
double sgv = dataMap.getDouble("sgvDouble");
|
||||||
double high = dataMap.getDouble("high");
|
double high = dataMap.getDouble("high");
|
||||||
double low = dataMap.getDouble("low");
|
double low = dataMap.getDouble("low");
|
||||||
double timestamp = dataMap.getDouble("timestamp");
|
long timestamp = dataMap.getLong("timestamp");
|
||||||
|
|
||||||
final int size = bgDataList.size();
|
final int size = bgDataList.size();
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
|
|
|
@ -30,8 +30,8 @@ public class BgGraphBuilder {
|
||||||
private ArrayList<BasalWatchData> basalWatchDataList;
|
private ArrayList<BasalWatchData> basalWatchDataList;
|
||||||
public List<TempWatchData> tempWatchDataList;
|
public List<TempWatchData> tempWatchDataList;
|
||||||
private int timespan;
|
private int timespan;
|
||||||
public double end_time;
|
public long end_time;
|
||||||
public double start_time;
|
public long start_time;
|
||||||
public double fuzzyTimeDenom = (1000 * 60 * 1);
|
public double fuzzyTimeDenom = (1000 * 60 * 1);
|
||||||
public Context context;
|
public Context context;
|
||||||
public double highMark;
|
public double highMark;
|
||||||
|
@ -47,7 +47,7 @@ public class BgGraphBuilder {
|
||||||
public int basalBackgroundColor;
|
public int basalBackgroundColor;
|
||||||
public boolean singleLine = false;
|
public boolean singleLine = false;
|
||||||
|
|
||||||
private double endHour;
|
private long endHour;
|
||||||
private List<PointValue> inRangeValues = new ArrayList<PointValue>();
|
private List<PointValue> inRangeValues = new ArrayList<PointValue>();
|
||||||
private List<PointValue> highValues = new ArrayList<PointValue>();
|
private List<PointValue> highValues = new ArrayList<PointValue>();
|
||||||
private List<PointValue> lowValues = new ArrayList<PointValue>();
|
private List<PointValue> lowValues = new ArrayList<PointValue>();
|
||||||
|
@ -316,8 +316,8 @@ public class BgGraphBuilder {
|
||||||
GregorianCalendar today = new GregorianCalendar(now.get(Calendar.YEAR), now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH));
|
GregorianCalendar today = new GregorianCalendar(now.get(Calendar.YEAR), now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH));
|
||||||
SimpleDateFormat timeFormat = new SimpleDateFormat(is24? "HH" : "h a");
|
SimpleDateFormat timeFormat = new SimpleDateFormat(is24? "HH" : "h a");
|
||||||
timeFormat.setTimeZone(TimeZone.getDefault());
|
timeFormat.setTimeZone(TimeZone.getDefault());
|
||||||
double start_hour = today.getTime().getTime();
|
long start_hour = today.getTime().getTime();
|
||||||
double timeNow = System.currentTimeMillis();
|
long timeNow = System.currentTimeMillis();
|
||||||
for (int l = 0; l <= 24; l++) {
|
for (int l = 0; l <= 24; l++) {
|
||||||
if ((start_hour + (60000 * 60 * (l))) < timeNow) {
|
if ((start_hour + (60000 * 60 * (l))) < timeNow) {
|
||||||
if ((start_hour + (60000 * 60 * (l + 1))) >= timeNow) {
|
if ((start_hour + (60000 * 60 * (l + 1))) >= timeNow) {
|
||||||
|
@ -332,7 +332,7 @@ public class BgGraphBuilder {
|
||||||
|
|
||||||
//Add whole hours endTime the axis (as long as they are more than 15 mins away from the current time)
|
//Add whole hours endTime the axis (as long as they are more than 15 mins away from the current time)
|
||||||
for (int l = 0; l <= 24; l++) {
|
for (int l = 0; l <= 24; l++) {
|
||||||
double timestamp = endHour - (60000 * 60 * l);
|
long timestamp = endHour - (60000 * 60 * l);
|
||||||
if((timestamp - timeNow < 0) && (timestamp > start_time)) {
|
if((timestamp - timeNow < 0) && (timestamp > start_time)) {
|
||||||
if(Math.abs(timestamp - timeNow) > (1000 * 60 * 8 * timespan)){
|
if(Math.abs(timestamp - timeNow) > (1000 * 60 * 8 * timespan)){
|
||||||
xAxisValues.add(new AxisValue(fuzz(timestamp), (timeFormat.format(timestamp)).toCharArray()));
|
xAxisValues.add(new AxisValue(fuzz(timestamp), (timeFormat.format(timestamp)).toCharArray()));
|
||||||
|
@ -350,7 +350,7 @@ public class BgGraphBuilder {
|
||||||
return xAxis;
|
return xAxis;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float fuzz(double value) {
|
public float fuzz(long value) {
|
||||||
return (float) Math.round(value / fuzzyTimeDenom);
|
return (float) Math.round(value / fuzzyTimeDenom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
|
||||||
|
|
||||||
|
|
||||||
private int batteryLevel = 0;
|
private int batteryLevel = 0;
|
||||||
private double datetime = 0;
|
private long datetime = 0;
|
||||||
private String direction = "";
|
private String direction = "";
|
||||||
private String delta = "";
|
private String delta = "";
|
||||||
private String avgDelta = "";
|
private String avgDelta = "";
|
||||||
|
@ -433,11 +433,11 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private synchronized double getDatetime() {
|
private synchronized long getDatetime() {
|
||||||
return datetime;
|
return datetime;
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void setDatetime(double datetime) {
|
private synchronized void setDatetime(long datetime) {
|
||||||
this.datetime = datetime;
|
this.datetime = datetime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -534,7 +534,7 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
|
||||||
Log.d("CircleWatchface", "sgv string : " + getSgvString());
|
Log.d("CircleWatchface", "sgv string : " + getSgvString());
|
||||||
setDelta(dataMap.getString("delta"));
|
setDelta(dataMap.getString("delta"));
|
||||||
setAvgDelta(dataMap.getString("avgDelta"));
|
setAvgDelta(dataMap.getString("avgDelta"));
|
||||||
setDatetime(dataMap.getDouble("timestamp"));
|
setDatetime(dataMap.getLong("timestamp"));
|
||||||
addToWatchSet(dataMap);
|
addToWatchSet(dataMap);
|
||||||
|
|
||||||
|
|
||||||
|
@ -576,7 +576,7 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
|
||||||
double sgv = dataMap.getDouble("sgvDouble");
|
double sgv = dataMap.getDouble("sgvDouble");
|
||||||
double high = dataMap.getDouble("high");
|
double high = dataMap.getDouble("high");
|
||||||
double low = dataMap.getDouble("low");
|
double low = dataMap.getDouble("low");
|
||||||
double timestamp = dataMap.getDouble("timestamp");
|
long timestamp = dataMap.getLong("timestamp");
|
||||||
bgDataList.add(new BgWatchData(sgv, high, low, timestamp));
|
bgDataList.add(new BgWatchData(sgv, high, low, timestamp));
|
||||||
} else if (!sharedPrefs.getBoolean("animation", false)) {
|
} else if (!sharedPrefs.getBoolean("animation", false)) {
|
||||||
// don't load history at once if animations are set (less resource consumption)
|
// don't load history at once if animations are set (less resource consumption)
|
||||||
|
@ -586,7 +586,7 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
|
||||||
double sgv = entry.getDouble("sgvDouble");
|
double sgv = entry.getDouble("sgvDouble");
|
||||||
double high = entry.getDouble("high");
|
double high = entry.getDouble("high");
|
||||||
double low = entry.getDouble("low");
|
double low = entry.getDouble("low");
|
||||||
double timestamp = entry.getDouble("timestamp");
|
long timestamp = entry.getLong("timestamp");
|
||||||
bgDataList.add(new BgWatchData(sgv, high, low, timestamp));
|
bgDataList.add(new BgWatchData(sgv, high, low, timestamp));
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class NOChart extends WatchFace implements SharedPreferences.OnSharedPref
|
||||||
public int ageLevel = 1;
|
public int ageLevel = 1;
|
||||||
public boolean lowResMode = false;
|
public boolean lowResMode = false;
|
||||||
public boolean layoutSet = false;
|
public boolean layoutSet = false;
|
||||||
public double datetime;
|
public long datetime;
|
||||||
public ArrayList<BgWatchData> bgDataList = new ArrayList<>();
|
public ArrayList<BgWatchData> bgDataList = new ArrayList<>();
|
||||||
public ArrayList<TempWatchData> tempWatchDataList = new ArrayList<>();
|
public ArrayList<TempWatchData> tempWatchDataList = new ArrayList<>();
|
||||||
public ArrayList<BasalWatchData> basalWatchDataList = new ArrayList<>();
|
public ArrayList<BasalWatchData> basalWatchDataList = new ArrayList<>();
|
||||||
|
@ -252,7 +252,7 @@ public class NOChart extends WatchFace implements SharedPreferences.OnSharedPref
|
||||||
wakeLock.acquire(50);
|
wakeLock.acquire(50);
|
||||||
sgvLevel = dataMap.getLong("sgvLevel");
|
sgvLevel = dataMap.getLong("sgvLevel");
|
||||||
batteryLevel = dataMap.getInt("batteryLevel");
|
batteryLevel = dataMap.getInt("batteryLevel");
|
||||||
datetime = dataMap.getDouble("timestamp");
|
datetime = dataMap.getLong("timestamp");
|
||||||
sgvString = dataMap.getString("sgvString");
|
sgvString = dataMap.getString("sgvString");
|
||||||
mSgv.setText(dataMap.getString("sgvString"));
|
mSgv.setText(dataMap.getString("sgvString"));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue