I suggest displaying sleep and not worn entries as constant values.

This commit is contained in:
Pavel Elagin 2018-08-20 14:54:36 +03:00
parent 3d65911440
commit 4750c15b8e
2 changed files with 7 additions and 5 deletions

View File

@ -93,6 +93,8 @@ import static nodomain.freeyourgadget.gadgetbridge.activities.HeartRateUtils.isV
public abstract class AbstractChartFragment extends AbstractGBFragment {
protected final int ANIM_TIME = 250;
public static final float Y_VALUE_NOT_WORN = 0.1f;
private static final Logger LOG = LoggerFactory.getLogger(AbstractChartFragment.class);
private final Set<String> mIntentFilterActions;
@ -474,7 +476,7 @@ public abstract class AbstractChartFragment extends AbstractGBFragment {
notWornEntries.add(createLineEntry(0, ts));
activityEntries.add(createLineEntry(0, ts));
}
deepSleepEntries.add(createLineEntry(value + SleepUtils.Y_VALUE_DEEP_SLEEP, ts));
deepSleepEntries.add(createLineEntry(SleepUtils.Y_VALUE_DEEP_SLEEP, ts));
break;
case ActivityKind.TYPE_LIGHT_SLEEP:
if (last_type != type) {
@ -484,7 +486,7 @@ public abstract class AbstractChartFragment extends AbstractGBFragment {
notWornEntries.add(createLineEntry(0, ts));
activityEntries.add(createLineEntry(0, ts));
}
lightSleepEntries.add(createLineEntry(value, ts));
lightSleepEntries.add(createLineEntry(SleepUtils.Y_VALUE_LIGHT_SLEEP, ts));
break;
case ActivityKind.TYPE_NOT_WORN:
if (last_type != type) {
@ -494,7 +496,7 @@ public abstract class AbstractChartFragment extends AbstractGBFragment {
deepSleepEntries.add(createLineEntry(0, ts));
activityEntries.add(createLineEntry(0, ts));
}
notWornEntries.add(createLineEntry(SleepUtils.Y_VALUE_DEEP_SLEEP, ts)); //a small value, just to show something on the graphs
notWornEntries.add(createLineEntry(Y_VALUE_NOT_WORN, ts)); //a small value, just to show something on the graphs
break;
default:
// short steps = sample.getSteps();

View File

@ -19,8 +19,8 @@ package nodomain.freeyourgadget.gadgetbridge.activities.charts;
import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
public class SleepUtils {
public static final float Y_VALUE_DEEP_SLEEP = 0.01f;
public static final float Y_VALUE_LIGHT_SLEEP = 0.016f;
public static final float Y_VALUE_DEEP_SLEEP = 0.2f;
public static final float Y_VALUE_LIGHT_SLEEP = 0.3f;
public static boolean isSleep(byte type) {
return type == ActivityKind.TYPE_DEEP_SLEEP || type == ActivityKind.TYPE_LIGHT_SLEEP;