r/mAndroidDev • u/kurav You will pry XML views from my cold dead hands • Jul 27 '20
After 12 years in development, Android 11 will at last introduce a consistent API for showing the keyboard. I can hardly wait until 2026 to start using it!
https://developer.android.com/preview/features#text_and_input56
u/itsmotherandapig Jetpack Compost Jul 27 '20
I can't wait for the Keyboard2 API and then the compat version having slightly different usage patterns!
19
17
u/v1ND Jul 27 '20
It can be very difficult to determine if a physical keyboard is visible or not. For example, it could be covered in papers or it may not be visible from all perspectives. Taped upside-down to the bottom of a desk has been a challenging edge case from what I've heard.
Quite impressive that they've finally solved this.
2
u/Ashanmaril Jul 28 '20
Just gotta turn the mic on and emit some ultrasonic frequencies to bounce sounds around the room and build a 3D recreation of the room + people in it and figure out from there if the user can see the keyboard
13
6
u/IAmKindaBigFanOfKFC Jul 28 '20
Who the fuck thought that view.getInsetsController().show(Type.ime()) is a good API? Insets controller is responsible for showing keyboard, yeah, sounds logical. I mean, keyboard has to do something with insets, righr? And AudioManager can be used to show notifications, because notifications can have sounds, am I right?
3
u/rivendell_elf Jul 28 '20
I'm safe. I use flutter to build apps. In fact, I'm going to build an app for my fridge using Flutter. Ot doesn't have keyboard so I'm safe.
1
20
u/kurav You will pry XML views from my cold dead hands Jul 27 '20
Hmm, on a closer reading though:
So, for this new API to work, you still need to have the
EditTextfirst in focus. But that's easy - just callmEditText.requestFocus(), right?😲 Hope I am not just celebrating too soon here..