Bubbles
Bubbles copied to clipboard
Keyboard doesn't opens
Using edit text in expanded view doesn't work.
There is a big problem at this point, the "focus" of a floating window depends on the android version and custom system. You can make a temp solution for all devices, you must require the focus to your edit text and enable the keyboard programatically.
// Get Android's focus
editText.requestFocus()
// Activate the keyboard on click
editText.setOnClickListener {
enableKeyboard()
}
And you can put the enableKeyboard()
function in your Utils or something
private fun enableKeyboard() {
if (params == null) {
Log.e("error_tag", "Not params found, can't enable keyboard")
return
}
if (params!!.flags and WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE != 0) {
params!!.flags = params!!.flags and WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE.inv()
updateView()
Log.v("dev_tag", "Updated floating window")
} else {
Log.e("error_tag", "View already focusable")
}
}
For this solution, the user must touch 2 times until the keyboard appears, you can remove the Log lines, i write this just for debug :P
Thanks @Nojipiz for the great explanation!!
I was a bit out of touch on this one. 😅