Skip to content

Commit

Permalink
Removed PlatformViewsController if-statements from TextInputPlugin (f…
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-carroll authored Jul 19, 2019
1 parent ede88d7 commit 649e025
Showing 1 changed file with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,14 @@ public class TextInputPlugin {
private boolean mRestartInputPending;
@Nullable
private InputConnection lastInputConnection;

@NonNull
private PlatformViewsController platformViewsController;

// When true following calls to createInputConnection will return the cached lastInputConnection if the input
// target is a platform view. See the comments on lockPlatformViewInputConnection for more details.
private boolean isInputConnectionLocked;

// TODO(mattcarroll): change @Nullable to @NonNull once new embedding integrates PlatformViewsController (#34286).
public TextInputPlugin(View view, @NonNull DartExecutor dartExecutor, @Nullable PlatformViewsController platformViewsController) {
public TextInputPlugin(View view, @NonNull DartExecutor dartExecutor, @NonNull PlatformViewsController platformViewsController) {
mView = view;
mImm = (InputMethodManager) view.getContext().getSystemService(
Context.INPUT_METHOD_SERVICE);
Expand Down Expand Up @@ -84,11 +83,9 @@ public void clearClient() {
clearTextInputClient();
}
});

this.platformViewsController = platformViewsController;
// TODO(mattcarroll): remove if-statement once new embedding integrates PlatformViewsController (#34286).
if (platformViewsController != null) {
platformViewsController.attachTextInputPlugin(this);
}
this.platformViewsController.attachTextInputPlugin(this);
}

@NonNull
Expand Down Expand Up @@ -127,10 +124,7 @@ public void unlockPlatformViewInputConnection() {
* The TextInputPlugin instance should not be used after calling this.
*/
public void destroy() {
// TODO(mattcarroll): Remove if-statement once new embedding integrates PlatformViewsController (#34286).
if (platformViewsController != null) {
platformViewsController.detachTextInputPlugin();
}
platformViewsController.detachTextInputPlugin();
}

private static int inputTypeFromTextInputType(
Expand Down

0 comments on commit 649e025

Please sign in to comment.