add logging

This commit is contained in:
Andrei Vereha 2021-12-29 16:50:32 +01:00
parent aee036e200
commit 5be29fde9c
2 changed files with 20 additions and 5 deletions

View file

@ -97,6 +97,7 @@ class WizardDialog : DaggerDialogFragment() {
override fun onStart() { override fun onStart() {
super.onStart() super.onStart()
dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) 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) { override fun onSaveInstanceState(savedInstanceState: Bundle) {
@ -163,11 +164,15 @@ class WizardDialog : DaggerDialogFragment() {
context?.let { context -> context?.let { context ->
wizard?.confirmAndExecute(context) wizard?.confirmAndExecute(context)
} }
aapsLogger.debug(LTag.APS, "Dialog ok pressed: ${this.javaClass.name}")
} }
dismiss() dismiss()
} }
// cancel button // cancel button
binding.cancel.setOnClickListener { dismiss() } binding.cancel.setOnClickListener {
aapsLogger.debug(LTag.APS, "Dialog canceled: ${this.javaClass.name}")
dismiss()
}
// checkboxes // checkboxes
binding.bgCheckbox.setOnCheckedChangeListener(::onCheckedChanged) binding.bgCheckbox.setOnCheckedChangeListener(::onCheckedChanged)
binding.ttCheckbox.setOnCheckedChangeListener(::onCheckedChanged) binding.ttCheckbox.setOnCheckedChangeListener(::onCheckedChanged)

View file

@ -44,6 +44,7 @@ abstract class DialogFragmentWithDate : DaggerDialogFragment() {
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT ViewGroup.LayoutParams.WRAP_CONTENT
) )
aapsLogger.debug(LTag.APS, "Dialog opened: ${this.javaClass.name}")
} }
override fun onSaveInstanceState(savedInstanceState: Bundle) { override fun onSaveInstanceState(savedInstanceState: Bundle) {
@ -129,15 +130,24 @@ abstract class DialogFragmentWithDate : DaggerDialogFragment() {
(view.findViewById(R.id.ok) as Button?)?.setOnClickListener { (view.findViewById(R.id.ok) as Button?)?.setOnClickListener {
synchronized(okClicked) { synchronized(okClicked) {
if (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 { } else {
okClicked = true okClicked = true
if (submit()) dismiss() if (submit()) {
else okClicked = false 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?) { override fun show(manager: FragmentManager, tag: String?) {