carbsDialog done also

This commit is contained in:
PoweRGbg 2018-07-17 14:43:34 +03:00
parent 15b9cb5b3c
commit edbeddf8b0

View file

@ -165,6 +165,13 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, C
setCancelable(true);
getDialog().setCanceledOnTouchOutside(false);
//recovering state if there is something
if (savedInstanceState != null) {
editCarbs.setValue(savedInstanceState.getDouble("editCarbs"));
editTime.setValue(savedInstanceState.getDouble("editTime"));
editDuration.setValue(savedInstanceState.getDouble("editDuration"));
}
return view;
}
@ -172,6 +179,19 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, C
return value > 0 ? "+" + value : String.valueOf(value);
}
@Override
public void onSaveInstanceState(Bundle carbsDialogState) {
carbsDialogState.putBoolean("startActivityTTCheckbox",startActivityTTCheckbox.isChecked());
carbsDialogState.putBoolean("startEatingSoonTTCheckbox", startEatingSoonTTCheckbox.isChecked());
carbsDialogState.putBoolean("startHypoTTCheckbox", startHypoTTCheckbox.isChecked());
carbsDialogState.putDouble("editTime", editTime.getValue());
carbsDialogState.putDouble("editDuration", editDuration.getValue());
carbsDialogState.putDouble("editCarbs", editCarbs.getValue());
super.onSaveInstanceState(carbsDialogState);
}
@Override
public synchronized void onClick(View view) {
switch (view.getId()) {
@ -229,6 +249,8 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, C
}
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// Logic to disable a selected radio when pressed. When a checked radio