reduced if...else to single line as Adrian suggested

This commit is contained in:
Roumen Georgiev 2018-03-02 16:41:25 +02:00
parent ea29b6ad82
commit 6443502808

View file

@ -260,13 +260,9 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
Profile currentProfile = MainApp.getConfigBuilder().getProfile(); Profile currentProfile = MainApp.getConfigBuilder().getProfile();
if(currentProfile == null) if(currentProfile == null)
return; return;
if(currentProfile.getUnits().equals(Constants.MMOL)) {
esTT = eatingSoonTT > 0 ? Profile.toMgdl(eatingSoonTT,Constants.MMOL) : 90d; esTT = eatingSoonTT > 0 ? Profile.toMgdl(eatingSoonTT,currentProfile.getUnits()) : 90d;
activityTT = prefTT > 0 ? Profile.toMgdl(prefTT,Constants.MMOL) : 140d; activityTT = prefTT > 0 ? Profile.toMgdl(prefTT,currentProfile.getUnits()) : 140d;
} else {
esTT = eatingSoonTT > 0 ? eatingSoonTT : 90d;
activityTT = prefTT > 0 ? prefTT : 140d;
}
if (startActivityTTCheckbox.isChecked()) { if (startActivityTTCheckbox.isChecked()) {
if(currentProfile.getUnits().equals(Constants.MMOL)) { if(currentProfile.getUnits().equals(Constants.MMOL)) {