Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit cbae154

Browse files
committed
Fix TextInputPluginTest
1 parent bf325ba commit cbae154

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,12 @@ public void sendTextInputAppPrivateCommand(String action, Bundle data) {
364364
mImm.sendAppPrivateCommand(mView, action, data);
365365
}
366366

367+
private boolean canShowTextInput() {
368+
return configuration.inputType != null && configuration.inputType.type != TextInputChannel.TextInputType.NONE;
369+
}
370+
367371
private void showTextInput(View view) {
368-
if (configuration.inputType.type != TextInputChannel.TextInputType.NONE) {
372+
if (canShowTextInput()) {
369373
view.requestFocus();
370374
mImm.showSoftInput(view, 0);
371375
} else {
@@ -388,7 +392,7 @@ private void hideTextInput(View view) {
388392
void setTextInputClient(int client, TextInputChannel.Configuration configuration) {
389393
// Call notifyViewExited on the previous field.
390394
notifyViewExited();
391-
if (configuration.inputType.type != TextInputChannel.TextInputType.NONE) {
395+
if (canShowTextInput()) {
392396
inputTarget = new InputTarget(InputTarget.Type.FRAMEWORK_CLIENT, client);
393397
} else {
394398
inputTarget = new InputTarget(InputTarget.Type.NO_TARGET, client);

0 commit comments

Comments
 (0)