color for active temp

This commit is contained in:
AdrianLxM 2017-08-03 03:12:47 +02:00
parent 1ac1b77fd4
commit 0ac7357ee9
2 changed files with 36 additions and 4 deletions

View file

@ -289,17 +289,17 @@ public class TemporaryBasal implements Interval {
Profile profile = MainApp.getConfigBuilder().getProfile();
Double currentBasalRate = profile.getBasal();
double rate = (currentBasalRate == null)?0d:(currentBasalRate+netExtendedRate);
return DecimalFormatter.to2Decimal(rate) + "U/h ("+DecimalFormatter.to2Decimal(netExtendedRate)+"E) @" +
return getCalcuatedPercentageIfNeeded() + DecimalFormatter.to2Decimal(rate) + "U/h ("+DecimalFormatter.to2Decimal(netExtendedRate)+"E) @" +
DateUtil.timeString(date) +
" " + getRealDuration() + "/" + durationInMinutes + "min";
" " + getRealDuration() + "/" + durationInMinutes + "'";
} else if (isAbsolute) {
return DecimalFormatter.to2Decimal(absoluteRate) + "U/h @" +
DateUtil.timeString(date) +
" " + getRealDuration() + "/" + durationInMinutes + "min";
" " + getRealDuration() + "/" + durationInMinutes + "'";
} else { // percent
return percentRate + "% @" +
DateUtil.timeString(date) +
" " + getRealDuration() + "/" + durationInMinutes + "min";
" " + getRealDuration() + "/" + durationInMinutes + "'";
}
}
@ -330,6 +330,31 @@ public class TemporaryBasal implements Interval {
}
}
private String getCalcuatedPercentageIfNeeded(){
if (isAbsolute || isFakeExtended) {
double rate = 0d;
if (isFakeExtended) {
Profile profile = MainApp.getConfigBuilder().getProfile();
Double currentBasalRate = profile.getBasal();
rate = (currentBasalRate == null)?0d:(currentBasalRate+netExtendedRate);
} else if (isAbsolute){
rate = absoluteRate;
}
if(SP.getBoolean(R.string.key_danar_visualizeextendedaspercentage, false) && SP.getBoolean(R.string.key_danar_useextended, false)){
Profile profile = MainApp.getConfigBuilder().getProfile();
if(profile != null) {
double basal = profile.getBasal();
if(basal != 0){
return Math.round(rate*100d/basal) + "% ";
}
}
}
}
return "";
}
public String toStringVeryShort() {
if (isAbsolute || isFakeExtended) {

View file

@ -1044,6 +1044,13 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
basalText += "(" + DecimalFormatter.to2Decimal(pump.getBaseBasalRate()) + "U/h)";
}
}
if (activeTemp != null) {
baseBasalView.setTextColor(MainApp.sResources.getColor(R.color.basal));
} else {
baseBasalView.setTextColor(Color.WHITE);
}
baseBasalView.setText(basalText);
final ExtendedBolus extendedBolus = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());