Android GH-470 InAppBrowser: java.lang.IllegalArgumentException (#616)

Fix interacting with views when Activity destroyed
Bug description https://stackoverflow.com/questions/22924825/view-not-attached-to-window-manager-crash

Co-authored-by: Sarafanov Valeriy <sarafanov_v@firma-gamma.ru>
This commit is contained in:
Slayterik 2020-03-20 17:07:48 +03:00 committed by GitHub
parent 6c55e6172c
commit e658c8c201
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -313,7 +313,7 @@ public class InAppBrowser extends CordovaPlugin {
this.cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (dialog != null) {
if (dialog != null && !cordova.getActivity().isFinishing()) {
dialog.show();
}
}
@ -326,7 +326,7 @@ public class InAppBrowser extends CordovaPlugin {
this.cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (dialog != null) {
if (dialog != null && !cordova.getActivity().isFinishing()) {
dialog.hide();
}
}
@ -537,7 +537,7 @@ public class InAppBrowser extends CordovaPlugin {
childView.setWebViewClient(new WebViewClient() {
// NB: wait for about:blank before dismissing
public void onPageFinished(WebView view, String url) {
if (dialog != null) {
if (dialog != null && !cordova.getActivity().isFinishing()) {
dialog.dismiss();
dialog = null;
}