diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/composer/TextComposerEditText.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/composer/TextComposerEditText.kt
new file mode 100644
index 0000000000..04d63f39b8
--- /dev/null
+++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/composer/TextComposerEditText.kt
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2019 New Vector Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package im.vector.riotx.features.home.room.detail.composer
+
+import android.content.Context
+import android.os.Build
+import android.util.AttributeSet
+import android.view.inputmethod.EditorInfo
+import android.view.inputmethod.InputConnection
+import androidx.appcompat.widget.AppCompatEditText
+import androidx.core.view.inputmethod.EditorInfoCompat
+import androidx.core.view.inputmethod.InputConnectionCompat
+
+class TextComposerEditText @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0)
+ : AppCompatEditText(context, attrs, defStyleAttr) {
+
+ override fun onCreateInputConnection(editorInfo: EditorInfo): InputConnection {
+ val ic: InputConnection = super.onCreateInputConnection(editorInfo)
+ EditorInfoCompat.setContentMimeTypes(editorInfo, arrayOf("image/png"))
+
+ val callback =
+ InputConnectionCompat.OnCommitContentListener { inputContentInfo, flags, opts ->
+ val lacksPermission = (flags and
+ InputConnectionCompat.INPUT_CONTENT_GRANT_READ_URI_PERMISSION) != 0
+ // read and display inputContentInfo asynchronously
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1 && lacksPermission) {
+ try {
+ inputContentInfo.requestPermission()
+ } catch (e: Exception) {
+ return@OnCommitContentListener false // return false if failed
+ }
+ }
+ // read and display inputContentInfo asynchronously.
+ // call inputContentInfo.releasePermission() as needed.
+ true // return true if succeeded
+ }
+ return InputConnectionCompat.createWrapper(ic, editorInfo, callback)
+ }
+
+}
diff --git a/vector/src/main/res/layout/constraint_set_composer_layout_compact.xml b/vector/src/main/res/layout/constraint_set_composer_layout_compact.xml
index ffc77da3fb..b2fff0880b 100644
--- a/vector/src/main/res/layout/constraint_set_composer_layout_compact.xml
+++ b/vector/src/main/res/layout/constraint_set_composer_layout_compact.xml
@@ -143,7 +143,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/attachmentButton" />
-
-
-