From 922c8db76f5836e4a938df77b7f2aa8c2e66c508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rebelo?= Date: Wed, 18 Sep 2024 08:45:55 +0100 Subject: [PATCH] Fix awake sleep color in charts --- .../charts/AbstractActivityChartFragment.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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 a5844c586..c001f87a7 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 @@ -181,13 +181,13 @@ public abstract class AbstractActivityChartFragment extend public DefaultChartsData refresh(GBDevice gbDevice, List samples) { TimestampTranslation tsTranslation = new TimestampTranslation(); - LOG.info("" + getTitle() + ": number of samples:" + samples.size()); + LOG.info("{}: number of samples: {}", getTitle(), samples.size()); LineData lineData; - if (samples.size() == 0) { + if (samples.isEmpty()) { lineData = new LineData(); ValueFormatter xValueFormatter = new SampleXLabelFormatter(tsTranslation); - return new DefaultChartsData(lineData, xValueFormatter); + return new DefaultChartsData<>(lineData, xValueFormatter); } ActivityKind last_type = ActivityKind.UNKNOWN; @@ -260,10 +260,10 @@ public abstract class AbstractActivityChartFragment extend } if (supportsAwakeSleep(gbDevice)) { lineDataSets.add(createDataSet( - entries.get(getIndexOfActivity(ActivityKind.AWAKE_SLEEP)), akActivity.color, "Awake Sleep" + entries.get(getIndexOfActivity(ActivityKind.AWAKE_SLEEP)), akAwakeSleep.color, "Awake Sleep" )); } - if (hr && heartrateEntries.size() > 0) { + if (hr && !heartrateEntries.isEmpty()) { LineDataSet heartrateSet = createHeartrateSet(heartrateEntries, "Heart Rate"); lineDataSets.add(heartrateSet); } @@ -271,7 +271,7 @@ public abstract class AbstractActivityChartFragment extend lineData = new LineData(lineDataSets); ValueFormatter xValueFormatter = new SampleXLabelFormatter(tsTranslation); - return new DefaultChartsData(lineData, xValueFormatter); + return new DefaultChartsData<>(lineData, xValueFormatter); } protected int getIndexOfActivity(ActivityKind kind) {