Show remaining time of TT
This commit is contained in:
parent
8a6e811c95
commit
7d82870203
|
@ -994,10 +994,14 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
// temp target
|
// temp target
|
||||||
TempTarget tempTarget = MainApp.getConfigBuilder().getTempTargetFromHistory();
|
TempTarget tempTarget = MainApp.getConfigBuilder().getTempTargetFromHistory();
|
||||||
if (tempTarget != null) {
|
if (tempTarget != null) {
|
||||||
|
long remainingTimeMinutes = (tempTarget.end()- System.currentTimeMillis())/(1000*60);
|
||||||
|
long remainingTimeHours = remainingTimeMinutes/60;
|
||||||
|
remainingTimeMinutes = remainingTimeMinutes%60;
|
||||||
|
String remaining = " (" + ((remainingTimeHours >0)?(remainingTimeHours + "h "):"") + remainingTimeMinutes + "')";
|
||||||
tempTargetView.setTextColor(Color.BLACK);
|
tempTargetView.setTextColor(Color.BLACK);
|
||||||
tempTargetView.setBackgroundColor(MainApp.sResources.getColor(R.color.tempTargetBackground));
|
tempTargetView.setBackgroundColor(MainApp.sResources.getColor(R.color.tempTargetBackground));
|
||||||
tempTargetView.setVisibility(View.VISIBLE);
|
tempTargetView.setVisibility(View.VISIBLE);
|
||||||
tempTargetView.setText(Profile.toTargetRangeString(tempTarget.low, tempTarget.high, Constants.MGDL, units));
|
tempTargetView.setText(Profile.toTargetRangeString(tempTarget.low, tempTarget.high, Constants.MGDL, units) + remaining);
|
||||||
} 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));
|
||||||
|
|
Loading…
Reference in a new issue