From bd2cb63e527b39f7fe8636deecb100df3d48bcae Mon Sep 17 00:00:00 2001 From: EddyVerbruggen Date: Wed, 4 Feb 2015 11:53:32 +0100 Subject: [PATCH] #26 Crosswalk compatibility --- plugin.xml | 2 +- src/android/nl/xservices/plugins/Toast.java | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/plugin.xml b/plugin.xml index f4c955a..b4bf9c4 100755 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="2.0.4"> Toast 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