Merge branch 'disappearing-predections-checkbox' into 'smb060'
Overview: fix predictions checkbox disappearing after unchecking it. See merge request MilosKozak/AndroidAPS!370
This commit is contained in:
commit
c5089d821e
|
@ -1167,8 +1167,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
cobView.setText(cobText);
|
||||
}
|
||||
|
||||
boolean showPrediction = showPredictionView.isChecked() && finalLastRun != null && finalLastRun.request.hasPredictions;
|
||||
if (showPrediction) {
|
||||
boolean predictionsAvailable = finalLastRun != null && finalLastRun.request.hasPredictions;
|
||||
if (predictionsAvailable) {
|
||||
showPredictionView.setVisibility(View.VISIBLE);
|
||||
getActivity().findViewById(R.id.overview_showprediction_label).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
|
@ -1211,7 +1211,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
|
||||
// ****** GRAPH *******
|
||||
|
||||
// allign to hours
|
||||
// align to hours
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
|
@ -1223,7 +1223,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
long toTime;
|
||||
long fromTime;
|
||||
long endTime;
|
||||
if (showPrediction) {
|
||||
if (predictionsAvailable && showPredictionView.isChecked()) {
|
||||
int predHours = (int) (Math.ceil(finalLastRun.constraintsProcessed.getLatestPredictionsTime() - System.currentTimeMillis()) / (60 * 60 * 1000));
|
||||
predHours = Math.min(2, predHours);
|
||||
predHours = Math.max(0, predHours);
|
||||
|
@ -1292,7 +1292,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
graphData.addInRangeArea(bgGraph, fromTime, endTime, lowLine, highLine);
|
||||
|
||||
// **** BG ****
|
||||
if (showPrediction)
|
||||
if (predictionsAvailable && showPredictionView.isChecked())
|
||||
graphData.addBgReadings(bgGraph, fromTime, toTime, lowLine, highLine, finalLastRun.constraintsProcessed);
|
||||
else
|
||||
graphData.addBgReadings(bgGraph, fromTime, toTime, lowLine, highLine, null);
|
||||
|
|
Loading…
Reference in a new issue