eltos / SimpleDialogFragments

An Android library to create dialogs with ease and handle user interaction reliably, using fragments and material design.
Apache License 2.0
119 stars 17 forks source link

Pin input dialog #32

Closed isabsent closed 6 years ago

isabsent commented 6 years ago

I need to show PIN code input dialog with number keyboard only. If I set inputType(InputType.TYPE_CLASS_NUMBER) as follows:

         SimpleFormDialog.build()
            .extra(extras)
            .title("Title")
            .msg("Message")
            .fields(
                    Input.password(USER_PIN)
                            .showPasswordToggle(false)
                            .inputType(InputType.TYPE_CLASS_NUMBER)
                        )
            .neut()
            .cancelable(false)
            .show(this, CASH_BACK_DIALOG);

my PIN code becomes visible during input. If I remove inputType(InputType.TYPE_CLASS_NUMBER) PIN code is closed by stars during input, but keyboard has letter symbols too instead of numbers only. Is it posible to have closed PIN code input and numeric only keyboard?

eltos commented 6 years ago

That's possible, just specify the input type as follows:

.inputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD)

I think it's a good idea to add a method Input.pin(...) for this so I'll leave this issue open.

isabsent commented 6 years ago

Thanks!

isabsent commented 6 years ago

Sorry, but .inputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_TEXT_VARIATION_PASSWORD) doesn't work for me. Keyboard is numeric, but PIN-code is visible during input...

eltos commented 6 years ago

Sorry, it has to be TYPE_NUMBER_VARIATION_PASSWORD of course.

eltos commented 6 years ago

There will be a nice SimplePinDialog in the next release:

screenshot_20180328-204208