Overview: make checkbox labels toggle state as well.
This commit is contained in:
parent
b6f3fae487
commit
3a02f01374
2 changed files with 93 additions and 52 deletions
|
@ -148,12 +148,18 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
TextView sage;
|
||||
TextView pbage;
|
||||
|
||||
CheckBox showPredictionView;
|
||||
CheckBox showBasalsView;
|
||||
CheckBox showIobView;
|
||||
CheckBox showCobView;
|
||||
CheckBox showDeviationsView;
|
||||
CheckBox showRatiosView;
|
||||
TextView showPredictionLabel;
|
||||
CheckBox showPredictionCheckbox;
|
||||
TextView showBasalsLabel;
|
||||
CheckBox showBasalsCheckbox;
|
||||
TextView showIobLabel;
|
||||
CheckBox showIobCheckbox;
|
||||
TextView showCobLabel;
|
||||
CheckBox showCobCheckbox;
|
||||
TextView showDeviationsLabel;
|
||||
CheckBox showDeviationsCheckbox;
|
||||
TextView showRatiosLabel;
|
||||
CheckBox showRatiosCheckbox;
|
||||
|
||||
RecyclerView notificationsView;
|
||||
LinearLayoutManager llm;
|
||||
|
@ -265,24 +271,37 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
|
||||
acceptTempLayout = (LinearLayout) view.findViewById(R.id.overview_accepttemplayout);
|
||||
|
||||
showPredictionView = (CheckBox) view.findViewById(R.id.overview_showprediction);
|
||||
showBasalsView = (CheckBox) view.findViewById(R.id.overview_showbasals);
|
||||
showIobView = (CheckBox) view.findViewById(R.id.overview_showiob);
|
||||
showCobView = (CheckBox) view.findViewById(R.id.overview_showcob);
|
||||
showDeviationsView = (CheckBox) view.findViewById(R.id.overview_showdeviations);
|
||||
showRatiosView = (CheckBox) view.findViewById(R.id.overview_showratios);
|
||||
showPredictionView.setChecked(SP.getBoolean("showprediction", false));
|
||||
showBasalsView.setChecked(SP.getBoolean("showbasals", true));
|
||||
showIobView.setChecked(SP.getBoolean("showiob", false));
|
||||
showCobView.setChecked(SP.getBoolean("showcob", false));
|
||||
showDeviationsView.setChecked(SP.getBoolean("showdeviations", false));
|
||||
showRatiosView.setChecked(SP.getBoolean("showratios", false));
|
||||
showPredictionView.setOnCheckedChangeListener(this);
|
||||
showBasalsView.setOnCheckedChangeListener(this);
|
||||
showIobView.setOnCheckedChangeListener(this);
|
||||
showCobView.setOnCheckedChangeListener(this);
|
||||
showDeviationsView.setOnCheckedChangeListener(this);
|
||||
showRatiosView.setOnCheckedChangeListener(this);
|
||||
showPredictionCheckbox = (CheckBox) view.findViewById(R.id.overview_showprediction);
|
||||
showBasalsCheckbox = (CheckBox) view.findViewById(R.id.overview_showbasals);
|
||||
showIobCheckbox = (CheckBox) view.findViewById(R.id.overview_showiob);
|
||||
showCobCheckbox = (CheckBox) view.findViewById(R.id.overview_showcob);
|
||||
showDeviationsCheckbox = (CheckBox) view.findViewById(R.id.overview_showdeviations);
|
||||
showRatiosCheckbox = (CheckBox) view.findViewById(R.id.overview_showratios);
|
||||
showPredictionCheckbox.setChecked(SP.getBoolean("showprediction", false));
|
||||
showBasalsCheckbox.setChecked(SP.getBoolean("showbasals", true));
|
||||
showIobCheckbox.setChecked(SP.getBoolean("showiob", false));
|
||||
showCobCheckbox.setChecked(SP.getBoolean("showcob", false));
|
||||
showDeviationsCheckbox.setChecked(SP.getBoolean("showdeviations", false));
|
||||
showRatiosCheckbox.setChecked(SP.getBoolean("showratios", false));
|
||||
showPredictionCheckbox.setOnCheckedChangeListener(this);
|
||||
showBasalsCheckbox.setOnCheckedChangeListener(this);
|
||||
showIobCheckbox.setOnCheckedChangeListener(this);
|
||||
showCobCheckbox.setOnCheckedChangeListener(this);
|
||||
showDeviationsCheckbox.setOnCheckedChangeListener(this);
|
||||
showRatiosCheckbox.setOnCheckedChangeListener(this);
|
||||
|
||||
showPredictionLabel = (TextView) view.findViewById(R.id.overview_showprediction_label);
|
||||
showPredictionLabel.setOnClickListener(this);
|
||||
showBasalsLabel = (TextView) view.findViewById(R.id.overview_showbasals_label);
|
||||
showBasalsLabel.setOnClickListener(this);
|
||||
showIobLabel = (TextView) view.findViewById(R.id.overview_showiob_label);
|
||||
showIobLabel.setOnClickListener(this);
|
||||
showCobLabel = (TextView) view.findViewById(R.id.overview_showcob_label);
|
||||
showCobLabel.setOnClickListener(this);
|
||||
showDeviationsLabel = (TextView) view.findViewById(R.id.overview_showdeviations_label);
|
||||
showDeviationsLabel.setOnClickListener(this);
|
||||
showRatiosLabel = (TextView) view.findViewById(R.id.overview_showratios_label);
|
||||
showRatiosLabel.setOnClickListener(this);
|
||||
|
||||
notificationsView = (RecyclerView) view.findViewById(R.id.overview_notifications);
|
||||
notificationsView.setHasFixedSize(true);
|
||||
|
@ -375,24 +394,24 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
case R.id.overview_showiob:
|
||||
break;
|
||||
case R.id.overview_showcob:
|
||||
showDeviationsView.setOnCheckedChangeListener(null);
|
||||
showDeviationsView.setChecked(false);
|
||||
showDeviationsView.setOnCheckedChangeListener(this);
|
||||
showDeviationsCheckbox.setOnCheckedChangeListener(null);
|
||||
showDeviationsCheckbox.setChecked(false);
|
||||
showDeviationsCheckbox.setOnCheckedChangeListener(this);
|
||||
break;
|
||||
case R.id.overview_showdeviations:
|
||||
showCobView.setOnCheckedChangeListener(null);
|
||||
showCobView.setChecked(false);
|
||||
showCobView.setOnCheckedChangeListener(this);
|
||||
showCobCheckbox.setOnCheckedChangeListener(null);
|
||||
showCobCheckbox.setChecked(false);
|
||||
showCobCheckbox.setOnCheckedChangeListener(this);
|
||||
break;
|
||||
case R.id.overview_showratios:
|
||||
break;
|
||||
}
|
||||
SP.putBoolean("showiob", showIobView.isChecked());
|
||||
SP.putBoolean("showprediction", showPredictionView.isChecked());
|
||||
SP.putBoolean("showbasals", showBasalsView.isChecked());
|
||||
SP.putBoolean("showcob", showCobView.isChecked());
|
||||
SP.putBoolean("showdeviations", showDeviationsView.isChecked());
|
||||
SP.putBoolean("showratios", showRatiosView.isChecked());
|
||||
SP.putBoolean("showiob", showIobCheckbox.isChecked());
|
||||
SP.putBoolean("showprediction", showPredictionCheckbox.isChecked());
|
||||
SP.putBoolean("showbasals", showBasalsCheckbox.isChecked());
|
||||
SP.putBoolean("showcob", showCobCheckbox.isChecked());
|
||||
SP.putBoolean("showdeviations", showDeviationsCheckbox.isChecked());
|
||||
SP.putBoolean("showratios", showRatiosCheckbox.isChecked());
|
||||
scheduleUpdateGUI("onGraphCheckboxesCheckedChanged");
|
||||
}
|
||||
|
||||
|
@ -619,6 +638,24 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
if (ConfigBuilderPlugin.getActivePump().isSuspended() || !ConfigBuilderPlugin.getActivePump().isInitialized())
|
||||
ConfigBuilderPlugin.getCommandQueue().readStatus("RefreshClicked", null);
|
||||
break;
|
||||
case R.id.overview_showprediction_label:
|
||||
showPredictionCheckbox.toggle();
|
||||
break;
|
||||
case R.id.overview_showbasals_label:
|
||||
showBasalsCheckbox.toggle();
|
||||
break;
|
||||
case R.id.overview_showiob_label:
|
||||
showIobCheckbox.toggle();
|
||||
break;
|
||||
case R.id.overview_showcob_label:
|
||||
showCobCheckbox.toggle();
|
||||
break;
|
||||
case R.id.overview_showdeviations_label:
|
||||
showDeviationsCheckbox.toggle();
|
||||
break;
|
||||
case R.id.overview_showratios_label:
|
||||
showRatiosCheckbox.toggle();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1247,13 +1284,13 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
cobView.setText(cobText);
|
||||
}
|
||||
|
||||
final boolean showPrediction = showPredictionView.isChecked() && finalLastRun != null && finalLastRun.constraintsProcessed.getClass().equals(DetermineBasalResultAMA.class);
|
||||
final boolean showPrediction = showPredictionCheckbox.isChecked() && finalLastRun != null && finalLastRun.constraintsProcessed.getClass().equals(DetermineBasalResultAMA.class);
|
||||
if (MainApp.getSpecificPlugin(OpenAPSAMAPlugin.class) != null && MainApp.getSpecificPlugin(OpenAPSAMAPlugin.class).isEnabled(PluginBase.APS)) {
|
||||
showPredictionView.setVisibility(View.VISIBLE);
|
||||
getActivity().findViewById(R.id.overview_showprediction_label).setVisibility(View.VISIBLE);
|
||||
showPredictionCheckbox.setVisibility(View.VISIBLE);
|
||||
showPredictionLabel.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
showPredictionView.setVisibility(View.GONE);
|
||||
getActivity().findViewById(R.id.overview_showprediction_label).setVisibility(View.GONE);
|
||||
showPredictionCheckbox.setVisibility(View.GONE);
|
||||
showPredictionLabel.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// pump status from ns
|
||||
|
@ -1345,7 +1382,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
graphData.addTreatments(fromTime, endTime);
|
||||
|
||||
// add basal data
|
||||
if (pump.getPumpDescription().isTempBasalCapable && showBasalsView.isChecked()) {
|
||||
if (pump.getPumpDescription().isTempBasalCapable && showBasalsCheckbox.isChecked()) {
|
||||
graphData.addBasals(fromTime, now, lowLine / graphData.maxY / 1.2d);
|
||||
}
|
||||
|
||||
|
@ -1362,23 +1399,23 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
boolean useDevForScale = false;
|
||||
boolean useRatioForScale = false;
|
||||
|
||||
if (showIobView.isChecked()) {
|
||||
if (showIobCheckbox.isChecked()) {
|
||||
useIobForScale = true;
|
||||
} else if (showCobView.isChecked()) {
|
||||
} else if (showCobCheckbox.isChecked()) {
|
||||
useCobForScale = true;
|
||||
} else if (showDeviationsView.isChecked()) {
|
||||
} else if (showDeviationsCheckbox.isChecked()) {
|
||||
useDevForScale = true;
|
||||
} else if (showRatiosView.isChecked()) {
|
||||
} else if (showRatiosCheckbox.isChecked()) {
|
||||
useRatioForScale = true;
|
||||
}
|
||||
|
||||
if (showIobView.isChecked())
|
||||
if (showIobCheckbox.isChecked())
|
||||
secondGraphData.addIob(fromTime, now, useIobForScale, 1d);
|
||||
if (showCobView.isChecked())
|
||||
if (showCobCheckbox.isChecked())
|
||||
secondGraphData.addCob(fromTime, now, useCobForScale, useCobForScale ? 1d : 0.5d);
|
||||
if (showDeviationsView.isChecked())
|
||||
if (showDeviationsCheckbox.isChecked())
|
||||
secondGraphData.addDeviations(fromTime, now, useDevForScale, 1d);
|
||||
if (showRatiosView.isChecked())
|
||||
if (showRatiosCheckbox.isChecked())
|
||||
secondGraphData.addRatio(fromTime, now, useRatioForScale, 1d);
|
||||
|
||||
// **** NOW line ****
|
||||
|
@ -1392,7 +1429,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (showIobView.isChecked() || showCobView.isChecked() || showDeviationsView.isChecked() || showRatiosView.isChecked()) {
|
||||
if (showIobCheckbox.isChecked() || showCobCheckbox.isChecked() || showDeviationsCheckbox.isChecked() || showRatiosCheckbox.isChecked()) {
|
||||
iobGraph.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
iobGraph.setVisibility(View.GONE);
|
||||
|
|
|
@ -270,6 +270,7 @@
|
|||
app:buttonTint="@color/basal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showbasals_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
@ -286,6 +287,7 @@
|
|||
app:buttonTint="@color/iob" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showiob_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
@ -294,7 +296,6 @@
|
|||
android:textColor="@color/iob"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showcob"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -303,6 +304,7 @@
|
|||
app:buttonTint="@color/cob" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showcob_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
@ -319,6 +321,7 @@
|
|||
app:buttonTint="@color/deviations" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showdeviations_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
@ -334,6 +337,7 @@
|
|||
android:layout_gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showratios_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
|
Loading…
Reference in a new issue