Merge pull request #1224 from PoweRGbg/patch-2
Save & restore dialog state on screen rotate
This commit is contained in:
commit
50a5e70051
|
@ -148,6 +148,11 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener
|
|||
|
||||
setCancelable(true);
|
||||
getDialog().setCanceledOnTouchOutside(false);
|
||||
if (savedInstanceState != null) {
|
||||
// log.debug("savedInstanceState in onCreate is:" + savedInstanceState.toString());
|
||||
editInsulin.setValue(savedInstanceState.getDouble("editInsulin"));
|
||||
editTime.setValue(savedInstanceState.getDouble("editTime"));
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -156,6 +161,17 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener
|
|||
return value > 0 ? "+" + formatted : formatted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle insulinDialogState) {
|
||||
insulinDialogState.putBoolean("startEatingSoonTTCheckbox", startEatingSoonTTCheckbox.isChecked());
|
||||
insulinDialogState.putBoolean("recordOnlyCheckbox", recordOnlyCheckbox.isChecked());
|
||||
insulinDialogState.putDouble("editTime", editTime.getValue());
|
||||
insulinDialogState.putDouble("editInsulin", editInsulin.getValue());
|
||||
insulinDialogState.putString("notesEdit",notesEdit.getText().toString());
|
||||
log.debug("Instance state saved:"+insulinDialogState.toString());
|
||||
super.onSaveInstanceState(insulinDialogState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
|
|
Loading…
Reference in a new issue