From 5be29fde9c2a77211fe491fcbd29bd2174b30b0a Mon Sep 17 00:00:00 2001 From: Andrei Vereha Date: Wed, 29 Dec 2021 16:50:32 +0100 Subject: [PATCH] add logging --- .../androidaps/dialogs/WizardDialog.kt | 7 ++++++- .../dialogs/DialogFragmentWithDate.kt | 18 ++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt index 8fc79e9928..e2eeed4393 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt @@ -97,6 +97,7 @@ class WizardDialog : DaggerDialogFragment() { override fun onStart() { super.onStart() dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) + aapsLogger.debug(LTag.APS, "Dialog opened: ${this.javaClass.name}") } override fun onSaveInstanceState(savedInstanceState: Bundle) { @@ -163,11 +164,15 @@ class WizardDialog : DaggerDialogFragment() { context?.let { context -> wizard?.confirmAndExecute(context) } + aapsLogger.debug(LTag.APS, "Dialog ok pressed: ${this.javaClass.name}") } dismiss() } // cancel button - binding.cancel.setOnClickListener { dismiss() } + binding.cancel.setOnClickListener { + aapsLogger.debug(LTag.APS, "Dialog canceled: ${this.javaClass.name}") + dismiss() + } // checkboxes binding.bgCheckbox.setOnCheckedChangeListener(::onCheckedChanged) binding.ttCheckbox.setOnCheckedChangeListener(::onCheckedChanged) diff --git a/core/src/main/java/info/nightscout/androidaps/dialogs/DialogFragmentWithDate.kt b/core/src/main/java/info/nightscout/androidaps/dialogs/DialogFragmentWithDate.kt index 01b8436419..729c57eeeb 100644 --- a/core/src/main/java/info/nightscout/androidaps/dialogs/DialogFragmentWithDate.kt +++ b/core/src/main/java/info/nightscout/androidaps/dialogs/DialogFragmentWithDate.kt @@ -44,6 +44,7 @@ abstract class DialogFragmentWithDate : DaggerDialogFragment() { ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT ) + aapsLogger.debug(LTag.APS, "Dialog opened: ${this.javaClass.name}") } override fun onSaveInstanceState(savedInstanceState: Bundle) { @@ -129,15 +130,24 @@ abstract class DialogFragmentWithDate : DaggerDialogFragment() { (view.findViewById(R.id.ok) as Button?)?.setOnClickListener { synchronized(okClicked) { if (okClicked) { - aapsLogger.warn(LTag.UI, "guarding: ok already clicked") + aapsLogger.warn(LTag.UI, "guarding: ok already clicked for dialog: ${this.javaClass.name}") } else { okClicked = true - if (submit()) dismiss() - else okClicked = false + if (submit()) { + aapsLogger.debug(LTag.APS, "Submit pressed for Dialog: ${this.javaClass.name}") + dismiss() + } else { + aapsLogger.debug(LTag.APS, "Submit returned false for Dialog: ${this.javaClass.name}") + okClicked = false + } } } } - (view.findViewById(R.id.cancel) as Button?)?.setOnClickListener { dismiss() } + (view.findViewById(R.id.cancel) as Button?)?.setOnClickListener { + aapsLogger.debug(LTag.APS, "Cancel pressed for dialog: ${this.javaClass.name}") + dismiss() + } + } override fun show(manager: FragmentManager, tag: String?) {