From 99c232a2e5c3a642d91409c004c50415431bdcc1 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 15 Nov 2022 23:02:25 +0100 Subject: [PATCH] fix actions fragment --- .../androidaps/implementations/ActivityNamesImpl.kt | 3 ++- ui/src/main/java/info/nightscout/ui/dialogs/CareDialog.kt | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/implementations/ActivityNamesImpl.kt b/app/src/main/java/info/nightscout/androidaps/implementations/ActivityNamesImpl.kt index 548d4353b1..6cc574f9e3 100644 --- a/app/src/main/java/info/nightscout/androidaps/implementations/ActivityNamesImpl.kt +++ b/app/src/main/java/info/nightscout/androidaps/implementations/ActivityNamesImpl.kt @@ -4,6 +4,7 @@ import android.content.Context import android.content.Intent import android.os.Bundle import androidx.annotation.RawRes +import androidx.annotation.StringRes import androidx.fragment.app.FragmentManager import info.nightscout.androidaps.MainActivity import info.nightscout.androidaps.activities.HistoryBrowseActivity @@ -91,7 +92,7 @@ class ActivityNamesImpl @Inject constructor() : ActivityNames { .show(fragmentManager, "ProfileViewer") } - override fun runCareDialog(fragmentManager: FragmentManager, options: ActivityNames.EventType, event: Int) { + override fun runCareDialog(fragmentManager: FragmentManager, options: ActivityNames.EventType, @StringRes event: Int) { CareDialog() .also { it.arguments = Bundle().also { bundle -> diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/CareDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/CareDialog.kt index 3bef6972ff..806c3f4492 100644 --- a/ui/src/main/java/info/nightscout/ui/dialogs/CareDialog.kt +++ b/ui/src/main/java/info/nightscout/ui/dialogs/CareDialog.kt @@ -85,9 +85,9 @@ class CareDialog : DialogFragmentWithDate() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - savedInstanceState?.let { - event = savedInstanceState.getInt("event", R.string.error) - options = ActivityNames.EventType.values()[savedInstanceState.getInt("options", 0)] + (savedInstanceState ?: arguments)?.let { + event = it.getInt("event", R.string.error) + options = ActivityNames.EventType.values()[it.getInt("options", 0)] } binding.icon.setImageResource(