ComboFragment: deal with resevoir levels being available or not.

This commit is contained in:
Johannes Mockenhaupt 2018-01-28 15:38:54 +01:00
parent e3abe04545
commit cd385a3217
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -168,9 +168,20 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
// reservoir // reservoir
int reservoirLevel = plugin.getPump().reservoirLevel; int reservoirLevel = plugin.getPump().reservoirLevel;
reservoirView.setText(reservoirLevel == -1 ? "" : "" + reservoirLevel + " " if (reservoirLevel != -1) {
+ MainApp.sResources.getString(R.string.treatments_wizard_unit_label)); reservoirView.setText(reservoirLevel + " " + MainApp.sResources.getString(R.string.treatments_wizard_unit_label));
if (ps.insulinState == PumpState.LOW) { } else if (ps.insulinState == PumpState.LOW) {
reservoirView.setText(MainApp.gs(R.string.combo_reservoir_low));
} else if (ps.insulinState == PumpState.EMPTY) {
reservoirView.setText(MainApp.gs(R.string.combo_reservoir_empty));
} else {
reservoirView.setText(MainApp.gs(R.string.combo_reservoir_normal));
}
if (ps.insulinState == PumpState.UNKNOWN) {
reservoirView.setTextColor(Color.WHITE);
reservoirView.setTypeface(null, Typeface.NORMAL);
} else if (ps.insulinState == PumpState.LOW) {
reservoirView.setTextColor(Color.YELLOW); reservoirView.setTextColor(Color.YELLOW);
reservoirView.setTypeface(null, Typeface.BOLD); reservoirView.setTypeface(null, Typeface.BOLD);
} else if (ps.insulinState == PumpState.EMPTY) { } else if (ps.insulinState == PumpState.EMPTY) {