small simplify
This commit is contained in:
parent
150ef1a8bc
commit
4b1263e2e0
|
@ -1480,7 +1480,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
maxBgValue = Profile.fromMgdlToUnits(maxBgValue, units);
|
maxBgValue = Profile.fromMgdlToUnits(maxBgValue, units);
|
||||||
maxBgValue = units.equals(Constants.MGDL) ? Round.roundTo(maxBgValue, 40d) + 80 : Round.roundTo(maxBgValue, 2d) + 4;
|
maxBgValue = units.equals(Constants.MGDL) ? Round.roundTo(maxBgValue, 40d) + 80 : Round.roundTo(maxBgValue, 2d) + 4;
|
||||||
if (highLine > maxBgValue) maxBgValue = highLine;
|
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()];
|
DataPointWithLabelInterface[] bg = new DataPointWithLabelInterface[bgListArray.size()];
|
||||||
bg = bgListArray.toArray(bg);
|
bg = bgListArray.toArray(bg);
|
||||||
|
@ -1548,7 +1548,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
bgGraph.getViewport().setMaxY(maxBgValue);
|
bgGraph.getViewport().setMaxY(maxBgValue);
|
||||||
bgGraph.getViewport().setMinY(0);
|
bgGraph.getViewport().setMinY(0);
|
||||||
bgGraph.getViewport().setYAxisBoundsManual(true);
|
bgGraph.getViewport().setYAxisBoundsManual(true);
|
||||||
bgGraph.getGridLabelRenderer().setNumVerticalLabels(numOfHorizLines);
|
bgGraph.getGridLabelRenderer().setNumVerticalLabels(numOfVertLines);
|
||||||
|
|
||||||
// set second scale
|
// set second scale
|
||||||
if (pump.getPumpDescription().isTempBasalCapable && showBasalsView.isChecked()) {
|
if (pump.getPumpDescription().isTempBasalCapable && showBasalsView.isChecked()) {
|
||||||
|
|
|
@ -23,10 +23,8 @@ public class TimeAsXAxisLabelFormatter extends DefaultLabelFormatter {
|
||||||
public String formatLabel(double value, boolean isValueX) {
|
public String formatLabel(double value, boolean isValueX) {
|
||||||
if (isValueX) {
|
if (isValueX) {
|
||||||
// format as date
|
// format as date
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
calendar.setTimeInMillis((long) value);
|
|
||||||
DateFormat dateFormat = new SimpleDateFormat(mFormat);
|
DateFormat dateFormat = new SimpleDateFormat(mFormat);
|
||||||
return dateFormat.format(calendar.getTimeInMillis());
|
return dateFormat.format((long) value);
|
||||||
} else {
|
} else {
|
||||||
return super.formatLabel(value, isValueX);
|
return super.formatLabel(value, isValueX);
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,7 +242,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
||||||
List<Treatment> in5minback = new ArrayList<>();
|
List<Treatment> in5minback = new ArrayList<>();
|
||||||
for (Integer pos = 0; pos < treatments.size(); pos++) {
|
for (Integer pos = 0; pos < treatments.size(); pos++) {
|
||||||
Treatment t = treatments.get(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);
|
in5minback.add(t);
|
||||||
}
|
}
|
||||||
return in5minback;
|
return in5minback;
|
||||||
|
|
Loading…
Reference in a new issue