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) {