From 5d042cf3c8ac89e11477f3e45f2f0290d369217b Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Sat, 18 Mar 2017 17:13:35 +0100 Subject: [PATCH] Fix weekly charts to display the same value for every day Android < 7 Closes #604 --- .../activities/charts/AbstractWeekChartFragment.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractWeekChartFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractWeekChartFragment.java index 9e2f15686..b43816372 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractWeekChartFragment.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractWeekChartFragment.java @@ -287,16 +287,17 @@ public abstract class AbstractWeekChartFragment extends AbstractChartFragment { ActivityAmounts amounts = null; Activity activity = getActivity(); + int key = (int) (day.getTimeInMillis() / 1000) + (mOffsetHours * 3600); if (activity != null) { activityAmountCache = ((ChartsActivity) activity).mActivityAmountCache; - amounts = (ActivityAmounts) (activityAmountCache.lookup(day.hashCode() ^ mOffsetHours)); + amounts = (ActivityAmounts) (activityAmountCache.lookup(key)); } if (amounts == null) { ActivityAnalysis analysis = new ActivityAnalysis(); amounts = analysis.calculateActivityAmounts(getSamplesOfDay(db, day, mOffsetHours, device)); if (activityAmountCache != null) { - activityAmountCache.add(day.hashCode() ^ mOffsetHours, amounts); + activityAmountCache.add(key, amounts); } }