diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt index da4a091b1d..be9a48ad77 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt @@ -54,6 +54,8 @@ class CareDialog : DialogFragmentWithDate() { super.onSaveInstanceState(savedInstanceState) savedInstanceState.putDouble("actions_care_bg", actions_care_bg.value) savedInstanceState.putDouble("actions_care_duration", actions_care_duration.value) + savedInstanceState.putInt("event", event) + savedInstanceState.putInt("options", options.ordinal) } override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, @@ -65,6 +67,11 @@ class CareDialog : DialogFragmentWithDate() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) + savedInstanceState?.let { + event = savedInstanceState.getInt("event", R.string.error) + options = EventType.values()[savedInstanceState.getInt("options", 0)] + } + actions_care_icon.setImageResource(when (options) { EventType.BGCHECK -> R.drawable.icon_cp_bgcheck EventType.SENSOR_INSERT -> R.drawable.icon_cp_cgm_insert