This commit is contained in:
Lorenzo Pichilli 2022-05-05 21:55:31 +02:00
parent 88e89bd102
commit b53703401e
2 changed files with 58 additions and 41 deletions

View File

@ -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`

View File

@ -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;
}