From bb12a667811efe46c0ef42a35b7b9e801463b55e Mon Sep 17 00:00:00 2001 From: Grishka Date: Sat, 26 Nov 2022 18:40:17 +0300 Subject: [PATCH] Fix #313 --- .../android/ui/views/ComposeEditText.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/views/ComposeEditText.java b/mastodon/src/main/java/org/joinmastodon/android/ui/views/ComposeEditText.java index f15bee3b..0d03085b 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/views/ComposeEditText.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/views/ComposeEditText.java @@ -8,7 +8,6 @@ import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.util.AttributeSet; -import android.util.Log; import android.view.DragEvent; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; @@ -22,7 +21,6 @@ import androidx.annotation.RequiresApi; public class ComposeEditText extends EditText{ private SelectionListener selectionListener; - private MediaAcceptingInputConnection inputConnectionWrapper=new MediaAcceptingInputConnection(); public ComposeEditText(Context context){ super(context); @@ -54,11 +52,10 @@ public class ComposeEditText extends EditText{ // Support receiving images from keyboards @Override public InputConnection onCreateInputConnection(EditorInfo outAttrs){ - final var ic = super.onCreateInputConnection(outAttrs); + final InputConnection ic=super.onCreateInputConnection(outAttrs); if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.N_MR1){ outAttrs.contentMimeTypes=selectionListener.onGetAllowedMediaMimeTypes(); - inputConnectionWrapper.setTarget(ic); - return inputConnectionWrapper; + return new MediaAcceptingInputConnection(ic); } return ic; } @@ -106,8 +103,8 @@ public class ComposeEditText extends EditText{ } private class MediaAcceptingInputConnection extends InputConnectionWrapper{ - public MediaAcceptingInputConnection(){ - super(null, true); + public MediaAcceptingInputConnection(InputConnection conn){ + super(conn, false); } @RequiresApi(api=Build.VERSION_CODES.N_MR1)