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

Keybord does not appear for text fields in Android 11 #74

Closed mendhak closed 3 years ago

mendhak commented 3 years ago

Add a description of the goal of this merge request

On Android 11, the keyboard does not seem to be appearing when using a text input field. On Android 10 and below, the keyboard appears just fine. I noticed this behavior with the SimpleFormDialog and SimpleInputDialog.

By introducing a postDelayed, the soft keyboard appears. Ref: https://stackoverflow.com/questions/5520085/android-show-softkeyboard-with-showsoftinput-is-not-working

Please reject or modify this PR if it isn't the right approach. UI stuff is not my area of expertise, I'm just tinkering.

Testing

Run the app on Android 11, or Android 11 emulator.

Click "Text input" button. When dialog appears, keyboard should also appear.
Click "Form with different input types" button. When dialog appears, keyboard should also appear.

Before:

https://user-images.githubusercontent.com/746276/134811204-53910c64-1d74-4063-9655-ef7e9c22bd9f.mp4

After:

https://user-images.githubusercontent.com/746276/134811208-a96bd6c1-0f87-405d-8b16-722c2d193c52.mp4

eltos commented 3 years ago

@mendhak thanks a lot for reporting and for submitting the merge request. I just moved that bit of code to SimpleDialog so it can be reused throughout the library.