1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-07-03 19:41:46 +02:00

Fix potential race condition when counted steps are above the daily target.

Also added a few comments wrt the labels and the values of the pie chart.
This commit is contained in:
Daniele Gobbetti 2015-07-29 18:07:35 +02:00
parent 3ed4856bf6
commit 27669761bf

View File

@ -113,15 +113,20 @@ public class WeekStepsChartFragment extends AbstractChartFragment {
entries.add(new Entry(totalSteps, 0));
colors.add(akActivity.color);
//we don't want labels on the pie chart
data.addXValue("");
if (totalSteps < mTargetSteps) {
entries.add(new Entry((mTargetSteps - totalSteps), 1));
colors.add(Color.GRAY);
//we don't want labels on the pie chart
data.addXValue("");
}
PieDataSet set = new PieDataSet(entries, "");
set.setColors(colors);
data.setDataSet(set);
//this hides the values (numeric) added to the set. These would be shown aside the strings set with addXValue above
data.setDrawValues(false);
pieChart.setData(data);