fix actions fragment

This commit is contained in:
Milos Kozak 2022-11-15 23:02:25 +01:00
parent c0f9184f7b
commit 99c232a2e5
2 changed files with 5 additions and 4 deletions

View file

@ -4,6 +4,7 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import androidx.annotation.RawRes import androidx.annotation.RawRes
import androidx.annotation.StringRes
import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentManager
import info.nightscout.androidaps.MainActivity import info.nightscout.androidaps.MainActivity
import info.nightscout.androidaps.activities.HistoryBrowseActivity import info.nightscout.androidaps.activities.HistoryBrowseActivity
@ -91,7 +92,7 @@ class ActivityNamesImpl @Inject constructor() : ActivityNames {
.show(fragmentManager, "ProfileViewer") .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() CareDialog()
.also { .also {
it.arguments = Bundle().also { bundle -> it.arguments = Bundle().also { bundle ->

View file

@ -85,9 +85,9 @@ class CareDialog : DialogFragmentWithDate() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
savedInstanceState?.let { (savedInstanceState ?: arguments)?.let {
event = savedInstanceState.getInt("event", R.string.error) event = it.getInt("event", R.string.error)
options = ActivityNames.EventType.values()[savedInstanceState.getInt("options", 0)] options = ActivityNames.EventType.values()[it.getInt("options", 0)]
} }
binding.icon.setImageResource( binding.icon.setImageResource(