Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
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;
Expand Down Expand Up @@ -474,7 +476,7 @@ protected DefaultChartsData<LineData> refresh(GBDevice gbDevice, List<? extends
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) {
Expand All @@ -484,7 +486,7 @@ protected DefaultChartsData<LineData> refresh(GBDevice gbDevice, List<? extends
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) {
Expand All @@ -494,7 +496,7 @@ protected DefaultChartsData<LineData> refresh(GBDevice gbDevice, List<? extends
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
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;
Expand Down