diff --git a/plugin.xml b/plugin.xml index f4c955a..b4bf9c4 100755 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="nl.x-services.plugins.toast" - version="2.0.3"> + version="2.0.4"> <name>Toast</name> diff --git a/src/android/nl/xservices/plugins/Toast.java b/src/android/nl/xservices/plugins/Toast.java index 396b6b7..cf563d7 100644 --- a/src/android/nl/xservices/plugins/Toast.java +++ b/src/android/nl/xservices/plugins/Toast.java @@ -22,12 +22,14 @@ public class Toast extends CordovaPlugin { private android.widget.Toast mostRecentToast; + // note that webView.isPaused() is not Xwalk compatible, so tracking it poor-man style + private boolean isPaused; + @Override public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException { if (ACTION_SHOW_EVENT.equals(action)) { - if (webView.isPaused()) { - // suppress while paused + if (this.isPaused) { return true; } @@ -77,5 +79,11 @@ public class Toast extends CordovaPlugin { if (mostRecentToast != null) { mostRecentToast.cancel(); } + this.isPaused = true; + } + + @Override + public void onResume(boolean multitasking) { + this.isPaused = false; } } \ No newline at end of file