diff --git a/CHANGELOG.md b/CHANGELOG.md index 78cc38b6..f860eb34 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,15 @@ - On Android, the `InAppWebView` widget uses hybrid composition by default (`useHybridComposition: true`). - All properties of `GeolocationPermissionShowPromptResponse` cannot be `null`; +## 5.4.3+6 + +- Fixed "iOS flutter_inappwebview/URLRequest.swift:13: Fatal error: Unexpectedly found nil while unwrapping an Optional value" [#1173](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1173) + +## 5.4.3+5 + +- Fixed possible java.lang.NullPointerException in `Runnable` of `InputAwareWebView.setInputConnectionTarget` method +- Fixed "Android Crash in latest 5.4.3+4 - java.lang.NullPointerException: Attempt to invoke virtual method java.lang.String android.webkit.WebView.getUrl()" [#1168](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1168) + ## 5.4.3+4 - Updated docs for `ChromeSafariBrowser.open` and throw error on iOS if the `url` parameter use a different scheme then `http` or `https` diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_browser/InAppBrowserActivity.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_browser/InAppBrowserActivity.java index d8126de2..8e3401b2 100755 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_browser/InAppBrowserActivity.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_browser/InAppBrowserActivity.java @@ -219,51 +219,59 @@ public class InAppBrowserActivity extends AppCompatActivity implements InAppBrow // Inflate menu to add items to action bar if it is present. inflater.inflate(R.menu.menu_main, menu); - searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView(); - searchView.setFocusable(true); + MenuItem menuItem = menu.findItem(R.id.menu_search); + if (menuItem != null) { + if (customSettings.hideUrlBar) + menuItem.setVisible(false); - if (customSettings.hideUrlBar) - menu.findItem(R.id.menu_search).setVisible(false); + searchView = (SearchView) menuItem.getActionView(); + if (searchView != null) { + searchView.setFocusable(true); - searchView.setQuery(webView != null ? webView.getUrl() : "", false); + searchView.setQuery(webView != null ? webView.getUrl() : "", false); - searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { - @Override - public boolean onQueryTextSubmit(String query) { - if (!query.isEmpty()) { - webView.loadUrl(query); - searchView.setQuery("", false); - searchView.setIconified(true); - return true; - } - return false; + searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { + @Override + public boolean onQueryTextSubmit(String query) { + if (!query.isEmpty()) { + if (webView != null) + webView.loadUrl(query); + if (searchView != null) { + searchView.setQuery("", false); + searchView.setIconified(true); + } + return true; + } + return false; + } + + @Override + public boolean onQueryTextChange(String newText) { + return false; + } + + }); + + searchView.setOnCloseListener(new SearchView.OnCloseListener() { + @Override + public boolean onClose() { + if (searchView != null && searchView.getQuery().toString().isEmpty()) + searchView.setQuery(webView != null ? webView.getUrl() : "", false); + return false; + } + }); + + searchView.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() { + @Override + public void onFocusChange(View view, boolean b) { + if (!b && searchView != null) { + searchView.setQuery("", false); + searchView.setIconified(true); + } + } + }); } - - @Override - public boolean onQueryTextChange(String newText) { - return false; - } - - }); - - searchView.setOnCloseListener(new SearchView.OnCloseListener() { - @Override - public boolean onClose() { - if (searchView.getQuery().toString().isEmpty()) - searchView.setQuery(webView.getUrl(), false); - return false; - } - }); - - searchView.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() { - @Override - public void onFocusChange(View view, boolean b) { - if (!b) { - searchView.setQuery("", false); - searchView.setIconified(true); - } - } - }); + } return true; }