Simplify.

This commit is contained in:
Johannes Mockenhaupt 2017-08-15 15:45:24 +02:00
parent 6dcdeb2bbc
commit 754a0097b9
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
2 changed files with 5 additions and 5 deletions

View file

@ -953,18 +953,18 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
tempTargetView.setBackgroundColor(MainApp.sResources.getColor(R.color.tempTargetBackground));
tempTargetView.setVisibility(View.VISIBLE);
if (tempTarget.low == tempTarget.high)
tempTargetView.setText(Profile.toUnitsString(tempTarget.low, Profile.fromMgdlToUnits(tempTarget.low, units), units));
tempTargetView.setText(Profile.toUnitsString(tempTarget.low, tempTarget.low, units));
else
tempTargetView.setText(Profile.toUnitsString(tempTarget.low, Profile.fromMgdlToUnits(tempTarget.low, units), units) + " - " + Profile.toUnitsString(tempTarget.high, Profile.fromMgdlToUnits(tempTarget.high, units), units));
tempTargetView.setText(Profile.toUnitsString(tempTarget.low, tempTarget.low, units) + " - " + Profile.toUnitsString(tempTarget.high, tempTarget.high, units));
} else {
tempTargetView.setTextColor(Color.WHITE);
tempTargetView.setBackgroundColor(MainApp.sResources.getColor(R.color.tempTargetDisabledBackground));
double low = MainApp.getConfigBuilder().getProfile().getTargetLow();
double high = MainApp.getConfigBuilder().getProfile().getTargetHigh();
if (low == high)
tempTargetView.setText(Profile.toUnitsString(low, Profile.fromMgdlToUnits(low, units), units));
tempTargetView.setText(Profile.toUnitsString(low, low, units));
else
tempTargetView.setText(Profile.toUnitsString(low, Profile.fromMgdlToUnits(low, units), units) + " - " + Profile.toUnitsString(high, Profile.fromMgdlToUnits(high, units), units));
tempTargetView.setText(Profile.toUnitsString(low, low, units) + " - " + Profile.toUnitsString(high, high, units));
tempTargetView.setVisibility(View.VISIBLE);
}
if (Config.NSCLIENT && tempTarget == null) {

View file

@ -472,7 +472,7 @@ public class ActionStringHandler {
//Check for Temp-Target:
TempTarget tempTarget = MainApp.getConfigBuilder().getTempTargetFromHistory(System.currentTimeMillis());
if (tempTarget != null) {
ret += "Temp Target: " + Profile.toUnitsString(tempTarget.low, Profile.fromMgdlToUnits(tempTarget.low, profile.getUnits()), profile.getUnits()) + " - " + Profile.toUnitsString(tempTarget.high, Profile.fromMgdlToUnits(tempTarget.high, profile.getUnits()), profile.getUnits());
ret += "Temp Target: " + Profile.toUnitsString(tempTarget.low, tempTarget.low, profile.getUnits()) + " - " + Profile.toUnitsString(tempTarget.high, tempTarget.high, profile.getUnits());
ret += "\nuntil: " + DateUtil.timeString(tempTarget.originalEnd());
ret += "\n\n";
}