Fix weekly charts to display the same value for every day Android < 7

Closes #604
master
Andreas Shimokawa 2017-03-18 17:13:35 +01:00
parent cc159cf80f
commit 5d042cf3c8
1 changed files with 3 additions and 2 deletions

View File

@ -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);
}
}