wear painting temps
This commit is contained in:
parent
70c3969f85
commit
2b17fc5155
2 changed files with 20 additions and 17 deletions
|
@ -250,36 +250,38 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
long startTime = System.currentTimeMillis() - (long)(60000 * 60 * 5.5);
|
||||
|
||||
|
||||
|
||||
ArrayList<DataMap> basals = new ArrayList<>();
|
||||
|
||||
|
||||
//TODO: Adrian: replace fake data
|
||||
long from = startTime;
|
||||
long to = (System.currentTimeMillis()+ startTime)/2;
|
||||
long now = System.currentTimeMillis();
|
||||
long to = (now + from)/2;
|
||||
double amount = 0.5;
|
||||
double afterwards = 0.8;
|
||||
basals.add(basalMap(from, to, amount, afterwards));
|
||||
|
||||
from = to;
|
||||
to = System.currentTimeMillis();
|
||||
to = now;
|
||||
amount = 0.8;
|
||||
basals.add(basalMap(from, to, amount, amount));
|
||||
|
||||
|
||||
|
||||
ArrayList<DataMap> temps = new ArrayList<>();
|
||||
from = (long)(startTime + (1/8d)*(to - startTime));
|
||||
from = (long)(startTime + (1/8d)*(now - startTime));
|
||||
double fromBasal = 0.5;
|
||||
to = (long)(startTime + (2/8d)*(to - startTime));
|
||||
to = (long)(startTime + (2/8d)*(now - startTime));
|
||||
double toBasal = 0.5;
|
||||
amount = 3;
|
||||
temps.add(tempDatamap(from, fromBasal, to, toBasal, amount));
|
||||
|
||||
|
||||
from = (long)(startTime + (6/8d)*(to - startTime));
|
||||
fromBasal = 0;
|
||||
to = (long)(startTime + (7/8d)*(to - startTime));
|
||||
toBasal = 0;
|
||||
from = (long)(startTime + (6/8d)*(now - startTime));
|
||||
fromBasal = 0.8;
|
||||
to = (long)(startTime + (7/8d)*(now - startTime));
|
||||
toBasal = 0.8;
|
||||
amount = 0;
|
||||
temps.add(tempDatamap(from, fromBasal, to, toBasal, amount));
|
||||
|
||||
|
|
|
@ -116,9 +116,11 @@ public class BgGraphBuilder {
|
|||
double factor = (maxChart-minChart)/maxTemp;
|
||||
// in case basal is the highest, don't paint it totally at the top.
|
||||
factor = Math.min(factor, ((maxChart-minChart)/maxTemp)*(2/3d));
|
||||
|
||||
lines.add(tempValuesLine((float) minChart, factor));
|
||||
|
||||
for (TempWatchData twd: tempWatchDataList) {
|
||||
if(twd.endTime > start_time) {
|
||||
lines.add(tempValuesLine(twd, (float) minChart, factor));
|
||||
}
|
||||
}
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
@ -157,16 +159,15 @@ public class BgGraphBuilder {
|
|||
}
|
||||
|
||||
|
||||
public Line tempValuesLine(float offset, double factor) {
|
||||
public Line tempValuesLine(TempWatchData twd, float offset, double factor) {
|
||||
List<PointValue> lineValues = new ArrayList<PointValue>();
|
||||
|
||||
for (TempWatchData twd: tempWatchDataList) {
|
||||
lineValues.add(new PointValue(fuzz(twd.startTime), offset + (float)(factor*twd.startBasal)));
|
||||
lineValues.add(new PointValue(fuzz(twd.startTime), offset +(float)(factor*twd.amount)));
|
||||
long begin = (long) Math.max(start_time, twd.startTime);
|
||||
lineValues.add(new PointValue(fuzz(begin), offset + (float)(factor*twd.startBasal)));
|
||||
lineValues.add(new PointValue(fuzz(begin), offset +(float)(factor*twd.amount)));
|
||||
lineValues.add(new PointValue(fuzz(twd.endTime), offset + (float)(factor*twd.amount)));
|
||||
lineValues.add(new PointValue(fuzz(twd.endTime), offset + (float)(factor*twd.endBasal)));
|
||||
|
||||
}
|
||||
|
||||
|
||||
Line valueLine = new Line(lineValues);
|
||||
valueLine.setHasPoints(false);
|
||||
|
|
Loading…
Reference in a new issue