small simplify

This commit is contained in:
Milos Kozak 2017-06-19 16:28:36 +02:00
parent 150ef1a8bc
commit 4b1263e2e0
3 changed files with 4 additions and 6 deletions

View file

@ -1480,7 +1480,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
maxBgValue = Profile.fromMgdlToUnits(maxBgValue, units);
maxBgValue = units.equals(Constants.MGDL) ? Round.roundTo(maxBgValue, 40d) + 80 : Round.roundTo(maxBgValue, 2d) + 4;
if (highLine > maxBgValue) maxBgValue = highLine;
Integer numOfHorizLines = units.equals(Constants.MGDL) ? (int) (maxBgValue / 40 + 1) : (int) (maxBgValue / 2 + 1);
Integer numOfVertLines = units.equals(Constants.MGDL) ? (int) (maxBgValue / 40 + 1) : (int) (maxBgValue / 2 + 1);
DataPointWithLabelInterface[] bg = new DataPointWithLabelInterface[bgListArray.size()];
bg = bgListArray.toArray(bg);
@ -1548,7 +1548,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
bgGraph.getViewport().setMaxY(maxBgValue);
bgGraph.getViewport().setMinY(0);
bgGraph.getViewport().setYAxisBoundsManual(true);
bgGraph.getGridLabelRenderer().setNumVerticalLabels(numOfHorizLines);
bgGraph.getGridLabelRenderer().setNumVerticalLabels(numOfVertLines);
// set second scale
if (pump.getPumpDescription().isTempBasalCapable && showBasalsView.isChecked()) {

View file

@ -23,10 +23,8 @@ public class TimeAsXAxisLabelFormatter extends DefaultLabelFormatter {
public String formatLabel(double value, boolean isValueX) {
if (isValueX) {
// format as date
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis((long) value);
DateFormat dateFormat = new SimpleDateFormat(mFormat);
return dateFormat.format(calendar.getTimeInMillis());
return dateFormat.format((long) value);
} else {
return super.formatLabel(value, isValueX);
}

View file

@ -242,7 +242,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
List<Treatment> in5minback = new ArrayList<>();
for (Integer pos = 0; pos < treatments.size(); pos++) {
Treatment t = treatments.get(pos);
if (t.date <= time && t.date > time - 5 * 60 * 1000)
if (t.date <= time && t.date > time - 5 * 60 * 1000 && t.carbs > 0)
in5minback.add(t);
}
return in5minback;