Fix weekly charts to display the same value for every day Android < 7
Closes #604
This commit is contained in:
parent
cc159cf80f
commit
5d042cf3c8
|
@ -287,16 +287,17 @@ public abstract class AbstractWeekChartFragment extends AbstractChartFragment {
|
||||||
ActivityAmounts amounts = null;
|
ActivityAmounts amounts = null;
|
||||||
|
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
|
int key = (int) (day.getTimeInMillis() / 1000) + (mOffsetHours * 3600);
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
activityAmountCache = ((ChartsActivity) activity).mActivityAmountCache;
|
activityAmountCache = ((ChartsActivity) activity).mActivityAmountCache;
|
||||||
amounts = (ActivityAmounts) (activityAmountCache.lookup(day.hashCode() ^ mOffsetHours));
|
amounts = (ActivityAmounts) (activityAmountCache.lookup(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (amounts == null) {
|
if (amounts == null) {
|
||||||
ActivityAnalysis analysis = new ActivityAnalysis();
|
ActivityAnalysis analysis = new ActivityAnalysis();
|
||||||
amounts = analysis.calculateActivityAmounts(getSamplesOfDay(db, day, mOffsetHours, device));
|
amounts = analysis.calculateActivityAmounts(getSamplesOfDay(db, day, mOffsetHours, device));
|
||||||
if (activityAmountCache != null) {
|
if (activityAmountCache != null) {
|
||||||
activityAmountCache.add(day.hashCode() ^ mOffsetHours, amounts);
|
activityAmountCache.add(key, amounts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue