Set the IME action label to null if the label is null in the configuration JSON object (flutter/engine#3199)

(JSONObject.getString() will return the string "null" for a JSON null value)

Fixes https://github.com/flutter/flutter/issues/6643
This commit is contained in:
Jason Simmons 2016-11-03 12:08:15 -07:00 committed by GitHub
parent b0015c4e06
commit b91c77590b
2 changed files with 5 additions and 1 deletions

View File

@ -28,4 +28,8 @@ public abstract class JSONMessageListener implements FlutterView.OnMessageListen
}
public abstract JSONObject onJSONMessage(FlutterView view, JSONObject message) throws JSONException;
public static String getStringOrNull(JSONObject object, String name) throws JSONException {
return object.isNull(name) ? null : object.getString(name);
}
}

View File

@ -72,7 +72,7 @@ public class TextInputPlugin extends JSONMessageListener {
return null;
try {
outAttrs.inputType = inputTypeFromTextInputType(mConfiguration.getString("inputType"));
outAttrs.actionLabel = mConfiguration.getString("actionLabel");
outAttrs.actionLabel = getStringOrNull(mConfiguration, "actionLabel");
outAttrs.imeOptions = EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_FULLSCREEN;
InputConnectionAdaptor connection = new InputConnectionAdaptor(view, mClient);
if (mIncomingState != null) {