fix Runnables after protection check, cleanup

This commit is contained in:
Milos Kozak 2020-05-05 22:42:16 +02:00
parent 8858d3b5f9
commit bba7adc9aa
16 changed files with 70 additions and 71 deletions

View file

@ -47,7 +47,6 @@ import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionChec
import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin
import info.nightscout.androidaps.setupwizard.SetupWizardActivity import info.nightscout.androidaps.setupwizard.SetupWizardActivity
import info.nightscout.androidaps.utils.tabs.TabPageAdapter
import info.nightscout.androidaps.utils.AndroidPermission import info.nightscout.androidaps.utils.AndroidPermission
import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.LocaleHelper import info.nightscout.androidaps.utils.LocaleHelper
@ -58,6 +57,8 @@ import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.resources.IconsProvider import info.nightscout.androidaps.utils.resources.IconsProvider
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP import info.nightscout.androidaps.utils.sharedPreferences.SP
import info.nightscout.androidaps.utils.tabs.TabPageAdapter
import info.nightscout.androidaps.utils.ui.UIRunnable
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable import io.reactivex.disposables.CompositeDisposable
import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_main.*
@ -160,12 +161,9 @@ class MainActivity : NoSplashAppCompatActivity() {
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
protectionCheck.queryProtection(this, ProtectionCheck.Protection.APPLICATION, null, protectionCheck.queryProtection(this, ProtectionCheck.Protection.APPLICATION, null,
Runnable { UIRunnable(Runnable { OKDialog.show(this, "", resourceHelper.gs(R.string.authorizationfailed), Runnable { finish() }) }),
OKDialog.show(this, "", resourceHelper.gs(R.string.authorizationfailed), Runnable { finish() }) UIRunnable(Runnable { OKDialog.show(this, "", resourceHelper.gs(R.string.authorizationfailed), Runnable { finish() }) })
}, )
Runnable {
OKDialog.show(this, "", resourceHelper.gs(R.string.authorizationfailed), Runnable { finish() })
})
} }
private fun setWakeLock() { private fun setWakeLock() {

View file

@ -279,7 +279,7 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
} }
for (plugin in pluginStore.plugins) { for (plugin in pluginStore.plugins) {
pref?.let { pref-> pref.getKey()?.let { plugin.updatePreferenceSummary(pref) }} pref?.let { it.key?.let { plugin.updatePreferenceSummary(pref) }}
} }
val hmacPasswords = arrayOf( val hmacPasswords = arrayOf(

View file

@ -212,7 +212,7 @@ class ObjectivesFragment : DaggerFragment() {
bundle.putInt("currentTask", taskPosition) bundle.putInt("currentTask", taskPosition)
dialog.arguments = bundle dialog.arguments = bundle
ObjectivesExamDialog.objective = objective ObjectivesExamDialog.objective = objective
fragmentManager?.let { dialog.show(it, "ObjectivesFragment") } dialog.show(childFragmentManager, "ObjectivesFragment")
} }
} }
// horizontal line // horizontal line

View file

@ -41,7 +41,7 @@ class PhoneCheckerPlugin @Inject constructor(
override fun onStart() { override fun onStart() {
super.onStart() super.onStart()
phoneRooted = RootBeer(context).isRootedWithoutBusyBoxCheck() phoneRooted = RootBeer(context).isRooted()
devMode = isDevModeEnabled() devMode = isDevModeEnabled()
} }
} }

View file

@ -25,14 +25,15 @@ import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction
import info.nightscout.androidaps.plugins.general.overview.StatusLightHandler import info.nightscout.androidaps.plugins.general.overview.StatusLightHandler
import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.SingleClickButton import info.nightscout.androidaps.utils.SingleClickButton
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.buildHelper.BuildHelper import info.nightscout.androidaps.utils.buildHelper.BuildHelper
import info.nightscout.androidaps.utils.extensions.plusAssign import info.nightscout.androidaps.utils.extensions.plusAssign
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP
import info.nightscout.androidaps.utils.extensions.toVisibility import info.nightscout.androidaps.utils.extensions.toVisibility
import info.nightscout.androidaps.utils.protection.ProtectionCheck import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP
import info.nightscout.androidaps.utils.ui.UIRunnable
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable import io.reactivex.disposables.CompositeDisposable
import kotlinx.android.synthetic.main.actions_fragment.* import kotlinx.android.synthetic.main.actions_fragment.*
@ -68,19 +69,19 @@ class ActionsFragment : DaggerFragment() {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
actions_profileswitch.setOnClickListener { actions_profileswitch.setOnClickListener {
fragmentManager?.let { ProfileSwitchDialog().show(it, "Actions") } ProfileSwitchDialog().show(childFragmentManager, "Actions")
} }
actions_temptarget.setOnClickListener { actions_temptarget.setOnClickListener {
fragmentManager?.let { TempTargetDialog().show(it, "Actions") } TempTargetDialog().show(childFragmentManager, "Actions")
} }
actions_extendedbolus.setOnClickListener { actions_extendedbolus.setOnClickListener {
activity?.let { activity -> activity?.let { activity ->
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, Runnable { protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable(Runnable {
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.extended_bolus), resourceHelper.gs(R.string.ebstopsloop), OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.extended_bolus), resourceHelper.gs(R.string.ebstopsloop),
Runnable { Runnable {
fragmentManager?.let { ExtendedBolusDialog().show(it, "Actions") } ExtendedBolusDialog().show(childFragmentManager, "Actions")
}, null) }, null)
}) }))
} }
} }
actions_extendedbolus_cancel.setOnClickListener { actions_extendedbolus_cancel.setOnClickListener {
@ -101,7 +102,7 @@ class ActionsFragment : DaggerFragment() {
} }
} }
actions_settempbasal.setOnClickListener { actions_settempbasal.setOnClickListener {
fragmentManager?.let { TempBasalDialog().show(it, "Actions") } TempBasalDialog().show(childFragmentManager, "Actions")
} }
actions_canceltempbasal.setOnClickListener { actions_canceltempbasal.setOnClickListener {
if (activePlugin.activeTreatments.isTempBasalInProgress) { if (activePlugin.activeTreatments.isTempBasalInProgress) {
@ -122,25 +123,25 @@ class ActionsFragment : DaggerFragment() {
} }
actions_fill.setOnClickListener { actions_fill.setOnClickListener {
activity?.let { activity -> activity?.let { activity ->
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, Runnable { fragmentManager?.let { FillDialog().show(it, "FillDialog") } }) protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable(Runnable { FillDialog().show(childFragmentManager, "FillDialog") }))
} }
} }
actions_historybrowser.setOnClickListener { startActivity(Intent(context, HistoryBrowseActivity::class.java)) } actions_historybrowser.setOnClickListener { startActivity(Intent(context, HistoryBrowseActivity::class.java)) }
actions_tddstats.setOnClickListener { startActivity(Intent(context, TDDStatsActivity::class.java)) } actions_tddstats.setOnClickListener { startActivity(Intent(context, TDDStatsActivity::class.java)) }
actions_bgcheck.setOnClickListener { actions_bgcheck.setOnClickListener {
fragmentManager?.let { CareDialog().setOptions(CareDialog.EventType.BGCHECK, R.string.careportal_bgcheck).show(it, "Actions") } CareDialog().setOptions(CareDialog.EventType.BGCHECK, R.string.careportal_bgcheck).show(childFragmentManager, "Actions")
} }
actions_cgmsensorinsert.setOnClickListener { actions_cgmsensorinsert.setOnClickListener {
fragmentManager?.let { CareDialog().setOptions(CareDialog.EventType.SENSOR_INSERT, R.string.careportal_cgmsensorinsert).show(it, "Actions") } CareDialog().setOptions(CareDialog.EventType.SENSOR_INSERT, R.string.careportal_cgmsensorinsert).show(childFragmentManager, "Actions")
} }
actions_pumpbatterychange.setOnClickListener { actions_pumpbatterychange.setOnClickListener {
fragmentManager?.let { CareDialog().setOptions(CareDialog.EventType.BATTERY_CHANGE, R.string.careportal_pumpbatterychange).show(it, "Actions") } CareDialog().setOptions(CareDialog.EventType.BATTERY_CHANGE, R.string.careportal_pumpbatterychange).show(childFragmentManager, "Actions")
} }
actions_note.setOnClickListener { actions_note.setOnClickListener {
fragmentManager?.let { CareDialog().setOptions(CareDialog.EventType.NOTE, R.string.careportal_note).show(it, "Actions") } CareDialog().setOptions(CareDialog.EventType.NOTE, R.string.careportal_note).show(childFragmentManager, "Actions")
} }
actions_exercise.setOnClickListener { actions_exercise.setOnClickListener {
fragmentManager?.let { CareDialog().setOptions(CareDialog.EventType.EXERCISE, R.string.careportal_exercise).show(it, "Actions") } CareDialog().setOptions(CareDialog.EventType.EXERCISE, R.string.careportal_exercise).show(childFragmentManager, "Actions")
} }
sp.putBoolean(R.string.key_objectiveuseactions, true) sp.putBoolean(R.string.key_objectiveuseactions, true)

View file

@ -72,7 +72,7 @@ class AutomationFragment : DaggerFragment(), OnStartDragListener {
args.putString("event", AutomationEvent(mainApp).toJSON()) args.putString("event", AutomationEvent(mainApp).toJSON())
args.putInt("position", -1) // New event args.putInt("position", -1) // New event
dialog.arguments = args dialog.arguments = args
fragmentManager?.let { dialog.show(it, "EditEventDialog") } dialog.show(childFragmentManager, "EditEventDialog")
} }
val callback: ItemTouchHelper.Callback = SimpleItemTouchHelperCallback(eventListAdapter) val callback: ItemTouchHelper.Callback = SimpleItemTouchHelperCallback(eventListAdapter)
@ -182,7 +182,7 @@ class AutomationFragment : DaggerFragment(), OnStartDragListener {
args.putString("event", event.toJSON()) args.putString("event", event.toJSON())
args.putInt("position", position) args.putInt("position", position)
dialog.arguments = args dialog.arguments = args
fragmentManager?.let { dialog.show(it, "EditEventDialog") } dialog.show(childFragmentManager, "EditEventDialog")
} }
// Start a drag whenever the handle view it touched // Start a drag whenever the handle view it touched
holder.iconSort.setOnTouchListener { v: View, motionEvent: MotionEvent -> holder.iconSort.setOnTouchListener { v: View, motionEvent: MotionEvent ->

View file

@ -66,15 +66,15 @@ class EditEventDialog : DialogFragmentWithDate() {
args.putString("trigger", event.trigger.toJSON()) args.putString("trigger", event.trigger.toJSON())
val dialog = EditTriggerDialog() val dialog = EditTriggerDialog()
dialog.arguments = args dialog.arguments = args
fragmentManager?.let { dialog.show(it, "EditTriggerDialog") } dialog.show(childFragmentManager, "EditTriggerDialog")
} }
// setup action list view // setup action list view
fragmentManager?.let { actionListAdapter = ActionListAdapter() } actionListAdapter = ActionListAdapter()
automation_actionListView.layoutManager = LinearLayoutManager(context) automation_actionListView.layoutManager = LinearLayoutManager(context)
automation_actionListView.adapter = actionListAdapter automation_actionListView.adapter = actionListAdapter
automation_addAction.setOnClickListener { fragmentManager?.let { ChooseActionDialog().show(it, "ChooseActionDialog") } } automation_addAction.setOnClickListener { ChooseActionDialog().show(childFragmentManager, "ChooseActionDialog") }
showPreconditions() showPreconditions()
@ -187,9 +187,7 @@ class EditEventDialog : DialogFragmentWithDate() {
args.putString("action", action.toJSON()) args.putString("action", action.toJSON())
val dialog = EditActionDialog() val dialog = EditActionDialog()
dialog.arguments = args dialog.arguments = args
fragmentManager?.let { dialog.show(childFragmentManager, "EditActionDialog")
dialog.show(it, "EditActionDialog")
}
} }
} }
view.findViewById<ImageView>(R.id.automation_iconTrash).setOnClickListener { view.findViewById<ImageView>(R.id.automation_iconTrash).setOnClickListener {

View file

@ -125,9 +125,7 @@ class CareportalFragment : DaggerFragment(), View.OnClickListener {
R.id.careportal_openapsoffline -> newDialog.setOptions(OPENAPSOFFLINE, R.string.careportal_openapsoffline) R.id.careportal_openapsoffline -> newDialog.setOptions(OPENAPSOFFLINE, R.string.careportal_openapsoffline)
R.id.careportal_temporarytarget -> newDialog.setOptions(TEMPTARGET, R.string.careportal_temporarytarget) R.id.careportal_temporarytarget -> newDialog.setOptions(TEMPTARGET, R.string.careportal_temporarytarget)
} }
fragmentManager?.let { NewNSTreatmentDialog().show(childFragmentManager, "CareportalFragment")
NewNSTreatmentDialog().show(it, "CareportalFragment")
}
} }
private fun updateGUI() { private fun updateGUI() {

View file

@ -58,7 +58,7 @@ class PrefImportListActivity : DaggerAppCompatActivity() {
init { init {
itemView.isClickable = true itemView.isClickable = true
itemView.setOnClickListener { v: View -> itemView.setOnClickListener {
val prefFile = fileName.tag as PrefsFile val prefFile = fileName.tag as PrefsFile
val i = Intent() val i = Intent()

View file

@ -65,6 +65,7 @@ import info.nightscout.androidaps.utils.extensions.toVisibility
import info.nightscout.androidaps.utils.protection.ProtectionCheck import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP import info.nightscout.androidaps.utils.sharedPreferences.SP
import info.nightscout.androidaps.utils.ui.UIRunnable
import info.nightscout.androidaps.utils.wizard.QuickWizard import info.nightscout.androidaps.utils.wizard.QuickWizard
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable import io.reactivex.disposables.CompositeDisposable
@ -293,22 +294,20 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
} }
override fun onContextItemSelected(item: MenuItem): Boolean { override fun onContextItemSelected(item: MenuItem): Boolean {
val manager = fragmentManager return if (overviewMenus.onContextItemSelected(item, childFragmentManager)) true else super.onContextItemSelected(item)
return if (manager != null && overviewMenus.onContextItemSelected(item, manager)) true else super.onContextItemSelected(item)
} }
override fun onClick(v: View) { override fun onClick(v: View) {
val manager = fragmentManager ?: return
// try to fix https://fabric.io/nightscout3/android/apps/info.nightscout.androidaps/issues/5aca7a1536c7b23527eb4be7?time=last-seven-days // try to fix https://fabric.io/nightscout3/android/apps/info.nightscout.androidaps/issues/5aca7a1536c7b23527eb4be7?time=last-seven-days
// https://stackoverflow.com/questions/14860239/checking-if-state-is-saved-before-committing-a-fragmenttransaction // https://stackoverflow.com/questions/14860239/checking-if-state-is-saved-before-committing-a-fragmenttransaction
if (manager.isStateSaved) return if (childFragmentManager.isStateSaved) return
activity?.let { activity -> activity?.let { activity ->
when (v.id) { when (v.id) {
R.id.overview_treatmentbutton -> protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, Runnable { TreatmentDialog().show(manager, "Overview") }) R.id.overview_treatmentbutton -> protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable(Runnable { TreatmentDialog().show(childFragmentManager, "Overview") }))
R.id.overview_wizardbutton -> protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, Runnable { WizardDialog().show(manager, "Overview") }) R.id.overview_wizardbutton -> protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable(Runnable { WizardDialog().show(childFragmentManager, "Overview") }))
R.id.overview_insulinbutton -> protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, Runnable { InsulinDialog().show(manager, "Overview") }) R.id.overview_insulinbutton -> protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable(Runnable { InsulinDialog().show(childFragmentManager, "Overview") }))
R.id.overview_quickwizardbutton -> protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, Runnable { onClickQuickWizard() }) R.id.overview_quickwizardbutton -> protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable(Runnable { onClickQuickWizard() }))
R.id.overview_carbsbutton -> protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, Runnable { CarbsDialog().show(manager, "Overview") }) R.id.overview_carbsbutton -> protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable(Runnable { CarbsDialog().show(childFragmentManager, "Overview") }))
R.id.overview_cgmbutton -> { R.id.overview_cgmbutton -> {
if (xdripPlugin.isEnabled(PluginType.BGSOURCE)) if (xdripPlugin.isEnabled(PluginType.BGSOURCE))
@ -323,7 +322,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
R.id.overview_calibrationbutton -> { R.id.overview_calibrationbutton -> {
if (xdripPlugin.isEnabled(PluginType.BGSOURCE)) { if (xdripPlugin.isEnabled(PluginType.BGSOURCE)) {
CalibrationDialog().show(manager, "CalibrationDialog") CalibrationDialog().show(childFragmentManager, "CalibrationDialog")
} else if (dexcomPlugin.isEnabled(PluginType.BGSOURCE)) { } else if (dexcomPlugin.isEnabled(PluginType.BGSOURCE)) {
try { try {
dexcomPlugin.findDexcomPackageName()?.let { dexcomPlugin.findDexcomPackageName()?.let {

View file

@ -178,7 +178,7 @@ class LocalProfileFragment : DaggerFragment() {
localprofile_profileswitch.setOnClickListener { localprofile_profileswitch.setOnClickListener {
// TODO: select in dialog localProfilePlugin.currentProfileIndex // TODO: select in dialog localProfilePlugin.currentProfileIndex
fragmentManager?.let { ProfileSwitchDialog().show(it, "NewNSTreatmentDialog") } ProfileSwitchDialog().show(childFragmentManager, "NewNSTreatmentDialog")
} }
localprofile_reset.setOnClickListener { localprofile_reset.setOnClickListener {

View file

@ -71,21 +71,19 @@ class DanaRFragment : DaggerFragment() {
danar_history.setOnClickListener { startActivity(Intent(context, DanaRHistoryActivity::class.java)) } danar_history.setOnClickListener { startActivity(Intent(context, DanaRHistoryActivity::class.java)) }
danar_viewprofile.setOnClickListener { danar_viewprofile.setOnClickListener {
fragmentManager?.let { fragmentManager -> val profile = danaRPump.createConvertedProfile()?.getDefaultProfile()
val profile = danaRPump.createConvertedProfile()?.getDefaultProfile() ?: return@setOnClickListener
?: return@let val profileName = danaRPump.createConvertedProfile()?.getDefaultProfileName()
val profileName = danaRPump.createConvertedProfile()?.getDefaultProfileName() ?: return@setOnClickListener
?: return@let val args = Bundle()
val args = Bundle() args.putLong("time", DateUtil.now())
args.putLong("time", DateUtil.now()) args.putInt("mode", ProfileViewerDialog.Mode.CUSTOM_PROFILE.ordinal)
args.putInt("mode", ProfileViewerDialog.Mode.CUSTOM_PROFILE.ordinal) args.putString("customProfile", profile.data.toString())
args.putString("customProfile", profile.data.toString()) args.putString("customProfileUnits", profile.units)
args.putString("customProfileUnits", profile.units) args.putString("customProfileName", profileName)
args.putString("customProfileName", profileName) val pvd = ProfileViewerDialog()
val pvd = ProfileViewerDialog() pvd.arguments = args
pvd.arguments = args pvd.show(childFragmentManager, "ProfileViewDialog")
pvd.show(fragmentManager, "ProfileViewDialog")
}
} }
danar_stats.setOnClickListener { startActivity(Intent(context, TDDStatsActivity::class.java)) } danar_stats.setOnClickListener { startActivity(Intent(context, TDDStatsActivity::class.java)) }
danar_user_options.setOnClickListener { startActivity(Intent(context, DanaRUserOptionsActivity::class.java)) } danar_user_options.setOnClickListener { startActivity(Intent(context, DanaRUserOptionsActivity::class.java)) }

View file

@ -176,7 +176,7 @@ class OmnipodFragment : DaggerFragment() {
disposable += rxBus disposable += rxBus
.toObservable(EventPreferenceChange::class.java) .toObservable(EventPreferenceChange::class.java)
.observeOn(Schedulers.io()) .observeOn(Schedulers.io())
.subscribe({ event -> .subscribe({
setVisibilityOfPodDebugButton() setVisibilityOfPodDebugButton()
}, { fabricPrivacy.logException(it) }) }, { fabricPrivacy.logException(it) })
} }

View file

@ -145,12 +145,10 @@ class TreatmentsBolusFragment : DaggerFragment() {
init { init {
calculation.setOnClickListener { calculation.setOnClickListener {
val treatment = it.tag as Treatment val treatment = it.tag as Treatment
fragmentManager?.let { fragmentManager -> if (treatment.getBoluscalc() != null) {
if (treatment.getBoluscalc() != null) { val wizardDialog = WizardInfoDialog()
val wizardDialog = WizardInfoDialog() wizardDialog.setData(treatment.getBoluscalc()!!)
wizardDialog.setData(treatment.getBoluscalc()!!) wizardDialog.show(childFragmentManager, "WizardInfoDialog")
wizardDialog.show(fragmentManager, "WizardInfoDialog")
}
} }
} }
calculation.paintFlags = calculation.paintFlags or Paint.UNDERLINE_TEXT_FLAG calculation.paintFlags = calculation.paintFlags or Paint.UNDERLINE_TEXT_FLAG

View file

@ -156,7 +156,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
args.putInt("mode", ProfileViewerDialog.Mode.RUNNING_PROFILE.ordinal) args.putInt("mode", ProfileViewerDialog.Mode.RUNNING_PROFILE.ordinal)
val pvd = ProfileViewerDialog() val pvd = ProfileViewerDialog()
pvd.arguments = args pvd.arguments = args
fragmentManager?.let { pvd.show(it, "ProfileViewDialog") } pvd.show(childFragmentManager, "ProfileViewDialog")
} }
} }
} }

View file

@ -0,0 +1,9 @@
package info.nightscout.androidaps.utils.ui
import info.nightscout.androidaps.utils.extensions.runOnUiThread
class UIRunnable (val runnable: Runnable) : Runnable {
override fun run() {
runOnUiThread(runnable)
}
}