Fix for message composer losing focus in Compose 1.8.0 (#4853)

Co-authored-by: ElementBot <android@element.io>
This commit is contained in:
Jorge Martin Espinosa 2025-06-10 18:39:26 +02:00 committed by GitHub
parent 2eda54d264
commit eff693ccd9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 46 additions and 25 deletions

View file

@ -27,6 +27,11 @@ fun View.showKeyboard(andRequestFocus: Boolean = false) {
imm?.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT)
}
fun View.isKeyboardVisible(): Boolean {
val imm = context?.getSystemService<InputMethodManager>()
return imm?.isAcceptingText == true
}
suspend fun View.awaitWindowFocus() = suspendCancellableCoroutine { continuation ->
if (hasWindowFocus()) {
continuation.resume(Unit)