Light sleep and deep sleep was mixed up. Corrected graphs again. #45

Use dashed limit lines, still not perfect.
This commit is contained in:
cpfeiffer 2015-06-19 01:14:58 +02:00
parent f9e5ab5fc1
commit e562fa9870
2 changed files with 20 additions and 4 deletions

View File

@ -4,8 +4,18 @@ public class GBActivitySample {
public static final byte PROVIDER_MIBAND = 0;
public static final byte PROVIDER_PEBBLE_MORPHEUZ = 1;
public static final byte TYPE_DEEP_SLEEP = 4;
public static final byte TYPE_LIGHT_SLEEP = 5;
// public static final byte TYPE_CHARGING = 6;
// public static final byte TYPE_NONWEAR = 3;
// public static final byte TYPE_NREM = 5; // DEEP SLEEP
// public static final byte TYPE_ONBED = 7;
// public static final byte TYPE_REM = 4; // LIGHT SLEEP
// public static final byte TYPE_RUNNING = 2;
// public static final byte TYPE_SLIENT = 0;
// public static final byte TYPE_USER = 100;
// public static final byte TYPE_WALKING = 1;
public static final byte TYPE_DEEP_SLEEP = 5;
public static final byte TYPE_LIGHT_SLEEP = 4;
public static final byte TYPE_UNKNOWN = -1;
// add more here

View File

@ -273,13 +273,13 @@ public class SleepChartActivity extends Activity {
if (type == GBActivitySample.TYPE_DEEP_SLEEP) {
// value = Y_VALUE_DEEP_SLEEP;
value = ((float) movement) / movement_divisor;
// value += Y_VALUE_DEEP_SLEEP;
value += Y_VALUE_DEEP_SLEEP;
activityEntries.add(createEntry(value, i));
colors.add(akDeepSleep.color);
} else {
if (type == GBActivitySample.TYPE_LIGHT_SLEEP) {
value = ((float) movement) / movement_divisor;
value += Y_VALUE_LIGHT_SLEEP;
// value += Y_VALUE_LIGHT_SLEEP;
// value = Math.min(1.0f, Y_VALUE_LIGHT_SLEEP);
activityEntries.add(createEntry(value, i));
colors.add(akLightSleep.color);
@ -305,10 +305,16 @@ public class SleepChartActivity extends Activity {
if (isSleep(last_type) && !isSleep(type)) {
// woken up
LimitLine line = new LimitLine(i, dateString);
line.enableDashedLine(8, 8, 0);
line.setTextColor(Color.WHITE);
line.setTextSize(15);
mChart.getXAxis().addLimitLine(line);
} else if (!isSleep(last_type) && isSleep(type)) {
// fallen asleep
LimitLine line = new LimitLine(i, dateString);
line.enableDashedLine(8, 8, 0);
line.setTextSize(15);
line.setTextColor(Color.WHITE);
mChart.getXAxis().addLimitLine(line);
}
}