Skip to content

[BUG] - AlertDialog can always be cancelled, which leads to a black CropActivity #334

Description

@xvlaze
  • Lib Version 4.1.0

Describe the bug
When extending CropImageActivity, the AlertDialog is cancellable if touched outside. If the user accidentally touches outside the dialog, it is left into a black CropImageActivity and the dialog never comes back. If trying to override the method after my CropImageActivity extension's onCreate:

override fun showImageSourceDialog(openSource: (Source) -> Unit) {
        AlertDialog.Builder(this)
            .setTitle("sample title")
            .setCancellable(false) // Does not work :(
            .setItems(
                arrayOf(
                    getString(R.string.pick_image_camera),
                    getString(R.string.pick_image_gallery),
                )
            ) { _, position -> openSource(if (position == 0) Source.CAMERA else Source.GALLERY) }
            .show()
    }

...no custom title is assigned, plus the dialog is still cancellable even after told otherwise. The debugger never enters this method.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new CropImageActivity just as shown in the documentation.
  2. Touch outside the dialog once it appears.

Expected behavior
The dialog should not be cancelled on touch outside.

Media
Please add screenshots and/or screen recordings to help explain your problem.
We cannot help without more information

Smartphone (please complete the following information):

  • Device: Huawei P40 Pro, Nexus 5 (emulated).
  • OS: Android 10, Android 12 respectively.

Activity

  1. Canato commented on Mar 18, 2022

    @Canato
    Member

    Indeed, good spot. Will work on listen to dismiss action when I have time,

    Free to any one jump in and fix this

  2. RemiMabsout commented on Mar 28, 2022

    @RemiMabsout
    Contributor

    Can i work on it ?

  3. Canato commented on Mar 28, 2022

    @Canato
    Member

    Yes @RemiMabsout please =D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions