Simplify message composer layout (#4884)

Co-authored-by: ElementBot <android@element.io>
This commit is contained in:
Jorge Martin Espinosa 2025-06-24 14:05:28 +02:00 committed by GitHub
parent 6a088396ed
commit a10734de02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 574 additions and 435 deletions

View file

@ -7,8 +7,10 @@
package io.element.android.libraries.androidutils.ui
import android.os.Build
import android.view.View
import android.view.ViewTreeObserver
import android.view.WindowInsets
import android.view.inputmethod.InputMethodManager
import androidx.core.content.getSystemService
import kotlinx.coroutines.suspendCancellableCoroutine
@ -23,8 +25,13 @@ fun View.showKeyboard(andRequestFocus: Boolean = false) {
if (andRequestFocus) {
requestFocus()
}
val imm = context?.getSystemService<InputMethodManager>()
imm?.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
windowInsetsController?.show(WindowInsets.Type.ime())
} else {
val imm = context?.getSystemService<InputMethodManager>()
imm?.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT)
}
}
fun View.isKeyboardVisible(): Boolean {