Fix crash on Android 12.

I guess we accept only images coming from the keyboard.
This commit is contained in:
Benoit Marty 2021-11-10 18:55:34 +01:00 committed by Benoit Marty
parent b26ea752b5
commit 60d75ff8e2

View file

@ -46,7 +46,7 @@ class ComposerEditText @JvmOverloads constructor(context: Context, attrs: Attrib
override fun onCreateInputConnection(editorInfo: EditorInfo): InputConnection? { override fun onCreateInputConnection(editorInfo: EditorInfo): InputConnection? {
var ic = super.onCreateInputConnection(editorInfo) ?: return null var ic = super.onCreateInputConnection(editorInfo) ?: return null
val mimeTypes = ViewCompat.getOnReceiveContentMimeTypes(this) ?: arrayOf("*/*") val mimeTypes = ViewCompat.getOnReceiveContentMimeTypes(this) ?: arrayOf("image/*")
EditorInfoCompat.setContentMimeTypes(editorInfo, mimeTypes) EditorInfoCompat.setContentMimeTypes(editorInfo, mimeTypes)
ic = InputConnectionCompat.createWrapper(this, ic, editorInfo) ic = InputConnectionCompat.createWrapper(this, ic, editorInfo)