Я пытаюсь поболтать в Jetpack Compose, и я хочу иметь возможность использовать стандартную клавиатуру GIF на моем Samsung, чтобы отправить GIF. Я пытаюсь это внутри AndroidView, теперь я больше не получаю сообщение об ошибке, но я также понятия не имею, где находится GIF и как оно представлено. < /P>
AndroidView(factory = {
val editText = @SuppressLint("AppCompatCustomView")
object : EditText(it) {
override fun setOnReceiveContentListener(
mimeTypes: Array?,
listener: OnReceiveContentListener?
) {
super.setOnReceiveContentListener(mimeTypes, listener)
}
override fun onCreateInputConnection(editorInfo: EditorInfo): InputConnection {
val ic: InputConnection = super.onCreateInputConnection(editorInfo)
EditorInfoCompat.setContentMimeTypes(editorInfo, arrayOf("image/gif"))
val callback =
InputConnectionCompat.OnCommitContentListener { inputContentInfo, _, _ ->
try {
inputContentInfo.requestPermission()
} catch (e: Exception) {
return@OnCommitContentListener false
}
true // return true if succeeded
}
return InputConnectionCompat.createWrapper(ic, editorInfo, callback)
}
}
editText
}) {}
Подробнее здесь: https://stackoverflow.com/questions/713 ... ck-compose