FullScreenDialog icon indicating copy to clipboard operation
FullScreenDialog copied to clipboard

OnConfirmListener and OnDiscardListener are ignored

Open nologinatgit opened this issue 7 years ago • 0 comments

I just downloaded the library and tried to create a basic dialog.

I used the following code (it is in Kotlin):

      var dialog: FullScreenDialogFragment? = null

       val onDiscardListener = FullScreenDialogFragment.OnDiscardListener { dialog?.dismiss() }
       val onConfirmListener = FullScreenDialogFragment.OnConfirmListener {
           LogMessage("Confirm")
           dialog?.dismiss()
       }
       dialog = FullScreenDialogFragment.Builder(this@MainActivity)
               .setTitle(R.string.my_dialog_title)
               .setConfirmButton(R.string.dialog_save_button)
               .setOnConfirmListener(onConfirmListener)
               .setOnDiscardListener(onDiscardListener)
               .setContent(TestFragment::class.java, null)
               .build()
       dialog.show(supportFragmentManager, null)

The dialog shows up, but it doesn't matter if I click the X or Save buttons, they are ignored. I also tried to add it to the MainActivity with interface implementation, the result is the same. I can locse the dialog only by the Back button.

What should I try?

nologinatgit avatar May 21 '18 09:05 nologinatgit