mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-08-25 08:40:43 +02:00
fix building error
This commit is contained in:
parent
a61cbddb5d
commit
ea6457c359
@ -43,8 +43,7 @@ import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample;
|
||||
|
||||
import static android.R.attr.x;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivityUser;
|
||||
|
||||
|
||||
public class StatsChartFragment extends AbstractChartFragment {
|
||||
@ -67,13 +66,17 @@ public class StatsChartFragment extends AbstractChartFragment {
|
||||
BarData data = new BarData();
|
||||
data.setValueTextColor(CHART_TEXT_COLOR);
|
||||
List<BarEntry> entries = new ArrayList<>();
|
||||
XAxisValueFormatter customXAxis = new XAxisValueFormatter();
|
||||
|
||||
for (Map.Entry<Float, Float> entry : analysis.statsQuantified.entrySet()) {
|
||||
entries.add(new BarEntry(entry.getKey(), entry.getValue()));
|
||||
/*float realValue = entry.getKey() * analysis.maxSpeedQuantifier;
|
||||
String customLabel = Math.round(realValue * (1 - analysis.roundPrecision) * 10f) / 10f + " - " + Math.round(realValue * (1 + analysis.roundPrecision) * 10f) / 10f;*/
|
||||
customXAxis.add("" + entry.getKey() * analysis.maxSpeedQuantifier);
|
||||
ActivityUser user = new ActivityUser();
|
||||
/*double distanceFactorCm;
|
||||
if (user.getGender() == user.GENDER_MALE){
|
||||
distanceFactorCm = user.getHeightCm() * user.GENDER_MALE_DISTANCE_FACTOR / 1000;
|
||||
} else {
|
||||
distanceFactorCm = user.getHeightCm() * user.GENDER_FEMALE_DISTANCE_FACTOR / 1000;
|
||||
}*/
|
||||
|
||||
for (Map.Entry<Integer, Long> entry : analysis.stats.entrySet()) {
|
||||
entries.add(new BarEntry(entry.getKey(), entry.getValue() / 60));
|
||||
}
|
||||
|
||||
BarDataSet set = new BarDataSet(entries, "");
|
||||
@ -83,14 +86,6 @@ public class StatsChartFragment extends AbstractChartFragment {
|
||||
//data.setBarWidth(0.1f);
|
||||
data.addDataSet(set);
|
||||
|
||||
// set X axis
|
||||
customXAxis.sort();
|
||||
XAxis left = mStatsChart.getXAxis();
|
||||
left.setValueFormatter(customXAxis);
|
||||
|
||||
// display precision
|
||||
//mStatsChart.getDescription().setText(Math.round(analysis.roundPrecision * 100) + "%");
|
||||
|
||||
return new MySpeedZonesData(data);
|
||||
}
|
||||
|
||||
|
@ -1,62 +0,0 @@
|
||||
/* Copyright (C) 2017 Vebryn
|
||||
|
||||
This file is part of Gadgetbridge.
|
||||
|
||||
Gadgetbridge is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Gadgetbridge is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package nodomain.freeyourgadget.gadgetbridge.activities.charts;
|
||||
|
||||
import com.github.mikephil.charting.components.AxisBase;
|
||||
import com.github.mikephil.charting.formatter.IAxisValueFormatter;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Vebryn on 30/04/17.
|
||||
*/
|
||||
|
||||
public class XAxisValueFormatter implements IAxisValueFormatter {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(XAxisValueFormatter.class);
|
||||
private List<String> mValues = new ArrayList<>();
|
||||
|
||||
public XAxisValueFormatter() {
|
||||
super();
|
||||
}
|
||||
|
||||
public void add(String label) {
|
||||
mValues.add(label);
|
||||
}
|
||||
|
||||
public void sort() {
|
||||
LOG.info("Sorting " + mValues);
|
||||
Collections.sort(mValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFormattedValue(float value, AxisBase axis) {
|
||||
String returnString = "N/A";
|
||||
|
||||
try {
|
||||
returnString = mValues.get((int) value).toString();
|
||||
LOG.info("Asking " + value + ", returning " + returnString);
|
||||
} catch (Exception e) {
|
||||
LOG.error(e.getMessage());
|
||||
}
|
||||
return returnString;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user