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.setBackgroundColor(MainApp.sResources.getColor(R.color.tempTargetBackground));
tempTargetView.setVisibility(View.VISIBLE); tempTargetView.setVisibility(View.VISIBLE);
if (tempTarget.low == tempTarget.high) 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 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 { } else {
tempTargetView.setTextColor(Color.WHITE); tempTargetView.setTextColor(Color.WHITE);
tempTargetView.setBackgroundColor(MainApp.sResources.getColor(R.color.tempTargetDisabledBackground)); tempTargetView.setBackgroundColor(MainApp.sResources.getColor(R.color.tempTargetDisabledBackground));
double low = MainApp.getConfigBuilder().getProfile().getTargetLow(); double low = MainApp.getConfigBuilder().getProfile().getTargetLow();
double high = MainApp.getConfigBuilder().getProfile().getTargetHigh(); double high = MainApp.getConfigBuilder().getProfile().getTargetHigh();
if (low == high) if (low == high)
tempTargetView.setText(Profile.toUnitsString(low, Profile.fromMgdlToUnits(low, units), units)); tempTargetView.setText(Profile.toUnitsString(low, low, units));
else 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); tempTargetView.setVisibility(View.VISIBLE);
} }
if (Config.NSCLIENT && tempTarget == null) { if (Config.NSCLIENT && tempTarget == null) {

View file

@ -472,7 +472,7 @@ public class ActionStringHandler {
//Check for Temp-Target: //Check for Temp-Target:
TempTarget tempTarget = MainApp.getConfigBuilder().getTempTargetFromHistory(System.currentTimeMillis()); TempTarget tempTarget = MainApp.getConfigBuilder().getTempTargetFromHistory(System.currentTimeMillis());
if (tempTarget != null) { 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 += "\nuntil: " + DateUtil.timeString(tempTarget.originalEnd());
ret += "\n\n"; ret += "\n\n";
} }