Commit ef8d0d1f authored by Lorenzo Pichilli's avatar Lorenzo Pichilli

fix #190 keyboard not showing on the second or more created webviews

parent ec47b191
This diff is collapsed.
...@@ -36,14 +36,12 @@ public class FlutterWebView implements PlatformView, MethodCallHandler { ...@@ -36,14 +36,12 @@ public class FlutterWebView implements PlatformView, MethodCallHandler {
public final MethodChannel channel; public final MethodChannel channel;
public final Registrar registrar; public final Registrar registrar;
public FlutterWebView(Registrar registrar, int id, HashMap<String, Object> params, View containerView) { public FlutterWebView(Registrar registrar, final Context context, int id, HashMap<String, Object> params, View containerView) {
this.registrar = registrar; this.registrar = registrar;
this.activity = registrar.activity(); this.activity = registrar.activity();
DisplayListenerProxy displayListenerProxy = new DisplayListenerProxy(); DisplayListenerProxy displayListenerProxy = new DisplayListenerProxy();
DisplayManager displayManager = DisplayManager displayManager = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
(DisplayManager) this.registrar.context().getSystemService(Context.DISPLAY_SERVICE);
displayListenerProxy.onPreWebViewInitialization(displayManager); displayListenerProxy.onPreWebViewInitialization(displayManager);
String initialUrl = (String) params.get("initialUrl"); String initialUrl = (String) params.get("initialUrl");
...@@ -55,7 +53,7 @@ public class FlutterWebView implements PlatformView, MethodCallHandler { ...@@ -55,7 +53,7 @@ public class FlutterWebView implements PlatformView, MethodCallHandler {
InAppWebViewOptions options = new InAppWebViewOptions(); InAppWebViewOptions options = new InAppWebViewOptions();
options.parse(initialOptions); options.parse(initialOptions);
webView = new InAppWebView(registrar, this, id, options, containerView); webView = new InAppWebView(registrar, context, this, id, options, containerView);
displayListenerProxy.onPostWebViewInitialization(displayManager); displayListenerProxy.onPostWebViewInitialization(displayManager);
webView.prepare(); webView.prepare();
......
...@@ -23,7 +23,7 @@ public class FlutterWebViewFactory extends PlatformViewFactory { ...@@ -23,7 +23,7 @@ public class FlutterWebViewFactory extends PlatformViewFactory {
@Override @Override
public PlatformView create(Context context, int id, Object args) { public PlatformView create(Context context, int id, Object args) {
HashMap<String, Object> params = (HashMap<String, Object>) args; HashMap<String, Object> params = (HashMap<String, Object>) args;
return new FlutterWebView(registrar, id, params, containerView); return new FlutterWebView(registrar, context, id, params, containerView);
} }
} }
...@@ -508,8 +508,8 @@ final public class InAppWebView extends InputAwareWebView { ...@@ -508,8 +508,8 @@ final public class InAppWebView extends InputAwareWebView {
super(context, attrs, defaultStyle); super(context, attrs, defaultStyle);
} }
public InAppWebView(PluginRegistry.Registrar registrar, Object obj, int id, InAppWebViewOptions options, View containerView) { public InAppWebView(PluginRegistry.Registrar registrar, Context context, Object obj, int id, InAppWebViewOptions options, View containerView) {
super(registrar.activeContext(), containerView); super(context, containerView);
this.registrar = registrar; this.registrar = registrar;
if (obj instanceof InAppBrowserActivity) if (obj instanceof InAppBrowserActivity)
this.inAppBrowserActivity = (InAppBrowserActivity) obj; this.inAppBrowserActivity = (InAppBrowserActivity) obj;
......
This diff is collapsed.
...@@ -1284,7 +1284,7 @@ class InAppWebViewController { ...@@ -1284,7 +1284,7 @@ class InAppWebViewController {
///This should not be called if Safe Browsing has been disabled by manifest tag ///This should not be called if Safe Browsing has been disabled by manifest tag
///or [AndroidInAppWebViewOptions.safeBrowsingEnabled]. This prepares resources used for Safe Browsing. ///or [AndroidInAppWebViewOptions.safeBrowsingEnabled]. This prepares resources used for Safe Browsing.
/// ///
///**NOTE**: available only for Android. ///**NOTE**: available on Android 27+.
Future<bool> startSafeBrowsing() async { Future<bool> startSafeBrowsing() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
if (_inAppBrowserUuid != null && _inAppBrowser != null) { if (_inAppBrowserUuid != null && _inAppBrowser != null) {
...@@ -1308,7 +1308,7 @@ class InAppWebViewController { ...@@ -1308,7 +1308,7 @@ class InAppWebViewController {
/// ///
///[hosts] represents the list of hosts. This value must never be null. ///[hosts] represents the list of hosts. This value must never be null.
/// ///
///**NOTE**: available only for Android. ///**NOTE**: available on Android 27+.
Future<bool> setSafeBrowsingWhitelist({@required List<String> hosts}) async { Future<bool> setSafeBrowsingWhitelist({@required List<String> hosts}) async {
assert(hosts != null); assert(hosts != null);
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
...@@ -1322,7 +1322,7 @@ class InAppWebViewController { ...@@ -1322,7 +1322,7 @@ class InAppWebViewController {
///Returns a URL pointing to the privacy policy for Safe Browsing reporting. This value will never be `null`. ///Returns a URL pointing to the privacy policy for Safe Browsing reporting. This value will never be `null`.
/// ///
///**NOTE**: available only for Android. ///**NOTE**: available on Android 27+.
Future<String> getSafeBrowsingPrivacyPolicyUrl() async { Future<String> getSafeBrowsingPrivacyPolicyUrl() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
if (_inAppBrowserUuid != null && _inAppBrowser != null) { if (_inAppBrowserUuid != null && _inAppBrowser != null) {
...@@ -1344,7 +1344,7 @@ class InAppWebViewController { ...@@ -1344,7 +1344,7 @@ class InAppWebViewController {
///Clears the SSL preferences table stored in response to proceeding with SSL certificate errors. ///Clears the SSL preferences table stored in response to proceeding with SSL certificate errors.
/// ///
///**NOTE**: available only for Android. ///**NOTE**: available only on Android.
Future<void> clearSslPreferences() async { Future<void> clearSslPreferences() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
if (_inAppBrowserUuid != null && _inAppBrowser != null) { if (_inAppBrowserUuid != null && _inAppBrowser != null) {
...@@ -1360,7 +1360,7 @@ class InAppWebViewController { ...@@ -1360,7 +1360,7 @@ class InAppWebViewController {
/// ///
///**NOTE**: On iOS certificate-based credentials are never stored permanently. ///**NOTE**: On iOS certificate-based credentials are never stored permanently.
/// ///
///**NOTE**: available only for Android. ///**NOTE**: available on Android 21+.
Future<void> clearClientCertPreferences() async { Future<void> clearClientCertPreferences() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
if (_inAppBrowserUuid != null && _inAppBrowser != null) { if (_inAppBrowserUuid != null && _inAppBrowser != null) {
......
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