Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion shell/platform/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,6 @@ action("robolectric_tests") {
"test/io/flutter/embedding/android/FlutterFragmentTest.java",
"test/io/flutter/embedding/engine/FlutterEngineCacheTest.java",
"test/io/flutter/embedding/engine/systemchannels/PlatformChannelTest.java",
"test/io/flutter/embedding/engine/systemchannels/TextInputChannelTest.java",
"test/io/flutter/util/PreconditionsTest.java",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.json.JSONObject;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;

import io.flutter.Log;
Expand Down Expand Up @@ -223,17 +222,6 @@ public void unspecifiedAction(int inputClientId) {
);
}

/**
* Instructs Flutter to clear the current input client, which ends the text
* input interaction with the given input control.
*/
public void onConnectionClosed(int inputClientId) {
channel.invokeMethod(
"TextInputClient.onConnectionClosed",
Collections.singletonList(inputClientId)
);
}

/**
* Sets the {@link TextInputMethodHandler} which receives all events and requests
* that are parsed from the underlying platform channel.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
package io.flutter.plugin.editing;

import android.content.Context;
import android.support.annotation.NonNull;
import android.text.DynamicLayout;
import android.text.Editable;
import android.text.Layout;
import android.text.Layout.Directions;
import android.text.Selection;
import android.text.TextPaint;
import android.view.KeyEvent;
Expand All @@ -19,51 +19,37 @@

import io.flutter.embedding.engine.systemchannels.TextInputChannel;
import io.flutter.Log;
import io.flutter.plugin.common.ErrorLogResult;
import io.flutter.plugin.common.MethodChannel;

class InputConnectionAdaptor extends BaseInputConnection {
@NonNull
private final View mFlutterView;
private final int mClient;
@NonNull
private final TextInputChannel textInputChannel;
@NonNull
private final Editable mEditable;
@NonNull
private final Runnable onConnectionClosed;
private int mBatchCount;
@NonNull
private InputMethodManager mImm;
@NonNull
private final Layout mLayout;

@SuppressWarnings("deprecation")
public InputConnectionAdaptor(
@NonNull View view,
View view,
int client,
@NonNull TextInputChannel textInputChannel,
@NonNull Editable editable,
@NonNull Runnable onConnectionClosed
TextInputChannel textInputChannel,
Editable editable
) {
super(view, true);
mFlutterView = view;
mClient = client;
this.textInputChannel = textInputChannel;
mEditable = editable;
this.onConnectionClosed = onConnectionClosed;
mBatchCount = 0;
// We create a dummy Layout with max width so that the selection
// shifting acts as if all text were in one line.
mLayout = new DynamicLayout(mEditable, new TextPaint(), Integer.MAX_VALUE, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
mImm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
}

@Override
public void closeConnection() {
super.closeConnection();
textInputChannel.onConnectionClosed(mClient);
onConnectionClosed.run();
}

// Send the current state of the editable to Flutter.
private void updateEditingState() {
// If the IME is in the middle of a batch edit, then wait until it completes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,6 @@ public class TextInputPlugin {
// target is a platform view. See the comments on lockPlatformViewInputConnection for more details.
private boolean isInputConnectionLocked;

private final Runnable onInputConnectionClosed = new Runnable() {
@Override
public void run() {
clearTextInputClient();
}
};

public TextInputPlugin(View view, @NonNull DartExecutor dartExecutor, @NonNull PlatformViewsController platformViewsController) {
mView = view;
mImm = (InputMethodManager) view.getContext().getSystemService(
Expand Down Expand Up @@ -226,8 +219,7 @@ public InputConnection createInputConnection(View view, EditorInfo outAttrs) {
view,
inputTarget.id,
textInputChannel,
mEditable,
onInputConnectionClosed
mEditable
);
outAttrs.initialSelStart = Selection.getSelectionStart(mEditable);
outAttrs.initialSelEnd = Selection.getSelectionEnd(mEditable);
Expand Down
4 changes: 1 addition & 3 deletions shell/platform/android/test/io/flutter/FlutterTestSuite.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import io.flutter.embedding.android.FlutterActivityTest;
import io.flutter.embedding.android.FlutterFragmentTest;
import io.flutter.embedding.engine.FlutterEngineCacheTest;
import io.flutter.embedding.engine.systemchannels.TextInputChannelTest;
import io.flutter.embedding.engine.systemchannels.PlatformChannelTest;
import io.flutter.util.PreconditionsTest;

Expand All @@ -24,8 +23,7 @@
FlutterFragmentTest.class,
// FlutterActivityAndFragmentDelegateTest.class, TODO(mklim): Fix and re-enable this
FlutterEngineCacheTest.class,
PlatformChannelTest.class,
TextInputChannelTest.class
PlatformChannelTest.class
})
/** Runs all of the unit tests listed in the {@code @SuiteClasses} annotation. */
public class FlutterTestSuite {}

This file was deleted.