Commit 2ae07055 authored by Lorenzo Pichilli's avatar Lorenzo Pichilli

fix name dropDownWorkaroundEnabled

parent e4625d5c
...@@ -567,7 +567,7 @@ final public class InAppWebView extends InputAwareWebView { ...@@ -567,7 +567,7 @@ final public class InAppWebView extends InputAwareWebView {
" });" + " });" +
" }" + " }" +
" var isMultiple = !!this.flutterInAppWebViewSelect.multiple;" + " var isMultiple = !!this.flutterInAppWebViewSelect.multiple;" +
" window." + JavaScriptBridgeInterface.name + ".callHandler('flutterInAppWebViewDropDownWorkaroud', getIndexSelectValues(this.flutterInAppWebViewSelect), isMultiple, options).then(function(result) {" + " window." + JavaScriptBridgeInterface.name + ".callHandler('flutterInAppWebViewDropDownWorkaround', getIndexSelectValues(this.flutterInAppWebViewSelect), isMultiple, options).then(function(result) {" +
" if (result != null && result.values != null) {" + " if (result != null && result.values != null) {" +
" if (!isMultiple) {" + " if (!isMultiple) {" +
" if (result.values.length > 0) {" + " if (result.values.length > 0) {" +
...@@ -1470,7 +1470,7 @@ final public class InAppWebView extends InputAwareWebView { ...@@ -1470,7 +1470,7 @@ final public class InAppWebView extends InputAwareWebView {
new PrintAttributes.Builder().build()); new PrintAttributes.Builder().build());
} }
public void showDropDownWorkaroud(final List<Integer> selectedValues, final List<List<String>> values, final boolean isMultiSelect, final DropDownWorkaroudCallback callback) { public void showDropDownWorkaround(final List<Integer> selectedValues, final List<List<String>> values, final boolean isMultiSelect, final DropDownWorkaroundCallback callback) {
FrameLayout layout = new FrameLayout(getContext()); FrameLayout layout = new FrameLayout(getContext());
final List<String> listViewValues = new ArrayList<String>(); final List<String> listViewValues = new ArrayList<String>();
...@@ -1495,7 +1495,6 @@ final public class InAppWebView extends InputAwareWebView { ...@@ -1495,7 +1495,6 @@ final public class InAppWebView extends InputAwareWebView {
String value = values.get(position).get(1); String value = values.get(position).get(1);
if (!isMultiSelect) { if (!isMultiSelect) {
result.add(value); result.add(value);
//callback.result(result);
alertDialog.dismiss(); alertDialog.dismiss();
} else { } else {
if (!result.contains(value)) { if (!result.contains(value)) {
...@@ -1530,7 +1529,7 @@ final public class InAppWebView extends InputAwareWebView { ...@@ -1530,7 +1529,7 @@ final public class InAppWebView extends InputAwareWebView {
alertDialog.show(); alertDialog.show();
} }
public static class DropDownWorkaroudCallback { public static class DropDownWorkaroundCallback {
public void result(List<String> value) { public void result(List<String> value) {
} }
......
...@@ -274,7 +274,7 @@ public class JavaScriptBridgeInterface { ...@@ -274,7 +274,7 @@ public class JavaScriptBridgeInterface {
public void run() { public void run() {
// workaround for https://github.com/pichillilorenzo/flutter_inappwebview/issues/182 // workaround for https://github.com/pichillilorenzo/flutter_inappwebview/issues/182
if (handlerName.equals("flutterInAppWebViewDropDownWorkaroud")) { if (handlerName.equals("flutterInAppWebViewDropDownWorkaround")) {
try { try {
JSONArray jsonArray = new JSONArray(args); JSONArray jsonArray = new JSONArray(args);
...@@ -301,7 +301,7 @@ public class JavaScriptBridgeInterface { ...@@ -301,7 +301,7 @@ public class JavaScriptBridgeInterface {
values.add(value); values.add(value);
} }
webView.showDropDownWorkaroud(selectedValues, values, isMultiSelect, new InAppWebView.DropDownWorkaroudCallback() { webView.showDropDownWorkaround(selectedValues, values, isMultiSelect, new InAppWebView.DropDownWorkaroundCallback() {
@Override @Override
public void result(List<String> values) { public void result(List<String> values) {
String value = "{values: " + (new JSONArray(values)) + "}"; String value = "{values: " + (new JSONArray(values)) + "}";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment