diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractActivityChartFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractActivityChartFragment.java index c5a33000a..25ed4386a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractActivityChartFragment.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractActivityChartFragment.java @@ -210,7 +210,34 @@ public abstract class AbstractActivityChartFragment extend ActivitySample sample = samples.get(i); ActivityKind type = sample.getKind(); int ts = tsTranslation.shorten(sample.getTimestamp()); - float value = type != ActivityKind.NOT_WORN ? sample.getIntensity() : Y_VALUE_DEEP_SLEEP; + final float value; + if (type != ActivityKind.NOT_WORN) { + if (ActivityKind.isSleep(type) && sample.getIntensity() <= 0) { + switch (type) { + case SLEEP_ANY: + case AWAKE_SLEEP: + value = 0.50f; + break; + case DEEP_SLEEP: + value = 0.20f; + break; + case LIGHT_SLEEP: + value = 0.30f; + break; + case REM_SLEEP: + value = 0.40f; + break; + default: + value = Y_VALUE_DEEP_SLEEP; + break; + } + } else { + value = sample.getIntensity(); + } + } else { + value = Y_VALUE_DEEP_SLEEP; + } + // do not interpolate NOT_WORN on any side boolean interpolate = !(last_type == ActivityKind.NOT_WORN || type == ActivityKind.NOT_WORN); float interpolation_value = interpolate ? value : last_value; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/SleepChartFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/SleepChartFragment.java index 09b39f030..5fb192ea9 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/SleepChartFragment.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/SleepChartFragment.java @@ -75,6 +75,8 @@ public class SleepChartFragment extends AbstractActivityChartFragment 0 ? new DecimalFormat("###.#").format(intensityTotal) : "-"); + movementIntensityTextWrapper.setVisibility(intensityTotal > 0 ? View.VISIBLE : View.GONE); + dummyTile.setVisibility(intensityTotal > 0 ? View.VISIBLE : View.GONE); mSleepAmountChart.setHoleRadius(85); mSleepAmountChart.setDrawEntryLabels(false); @@ -385,6 +389,8 @@ public class SleepChartFragment extends AbstractActivityChartFragment { private static final Logger LOG = LoggerFactory.getLogger(CmfActivitySampleProvider.class); @@ -166,18 +167,7 @@ public class CmfActivitySampleProvider extends AbstractSampleProvider { @@ -191,18 +192,7 @@ public class XiaomiSampleProvider extends AbstractSampleProvider