Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hide keyboard on resume #1170

Closed

Conversation

davotoula
Copy link
Collaborator

@davotoula davotoula commented Nov 5, 2024

workaround for #1166

@davotoula
Copy link
Collaborator Author

davotoula commented Nov 6, 2024

This seems to have resolved this issue.

@vitorpamplona my only guess is that low memory on the device stops and resumes the app occasionally and the windowSoftInputMode="adjustResize" pops up the keyboard on each resume.

Old phones (tried Oreo):

The adjustResize causes the keyboard to always be up when app is resumed. From google docs: "Android gives focus to the first text field in your layout when the activity starts". (https://developer.android.com/develop/ui/views/touch-and-input/keyboard-input/visibility)

It looks like the "Status update" field is put in focus and the keyboard is shown.

Exiting a text field does NOT close the keyboard on older phones. The keyboard has to be minimised manually.

Using stateHidden will not show keyboard on resume... Even if a text field is in focus (eg. create a not or login screen nsec). One has to click on the text field for keyboard to show up

Newer phones (tried API 34):

The keyboard is not shown on resume, the "Status update" is not in focus.

If you exit a text field the keyboard is closed automatically.

Only drawback with this change I noticed on newer phones: If you exit app while in a text field and resume the keyboard will not show until you click the text field again.

@KotlinGeekDev
Copy link
Contributor

Only drawback with this change I noticed on newer phones: If you exit app while in a text field and resume the keyboard will not show until you click the text field again.

Interesting. IMHO I don't know if it's much of a drawback though. 🤔

@davotoula
Copy link
Collaborator Author

davotoula commented Nov 7, 2024

Just investitigating one more on device workaround with the user before requesting this pull request.

@KotlinGeekDev
Copy link
Contributor

Just investitigating one more on device workaround with the user before requesting this pull request.

Got it.

@davotoula
Copy link
Collaborator Author

Marking as ready for merge as the user reported this fix is the only thing that resolves their "popping up-onscreen keyboard" issue on their Samsung A5 Android 8 device.

@davotoula davotoula marked this pull request as ready for review November 8, 2024 07:53
@vitorpamplona
Copy link
Owner

Hum... isn't this an issue with the status update in the drawer being in focus? That element is not visible so the code for the drawer shouldn't even be running.

We might need to keep resize there, like on stateHidden|adjustResize, but the issue with not showing the keyboard on newer phones if you leave the app on the new post screen is quite annoying.

@davotoula
Copy link
Collaborator Author

I agree. There should be a higher percentage of newer phones that benefit from keyboard being closed/open promptly than this fix.

Maybe there is a solution to avoid focus in elements that are not visible. Perhaps using FocusRequester() in addition to the focusManager.

I'm happy to close this!

@davotoula davotoula closed this Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants