#26 Crosswalk compatibility

This commit is contained in:
EddyVerbruggen 2015-02-04 11:53:32 +01:00
parent cd65647841
commit bd2cb63e52
2 changed files with 11 additions and 3 deletions

View File

@ -2,7 +2,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
id="nl.x-services.plugins.toast" id="nl.x-services.plugins.toast"
version="2.0.3"> version="2.0.4">
<name>Toast</name> <name>Toast</name>

View File

@ -22,12 +22,14 @@ public class Toast extends CordovaPlugin {
private android.widget.Toast mostRecentToast; private android.widget.Toast mostRecentToast;
// note that webView.isPaused() is not Xwalk compatible, so tracking it poor-man style
private boolean isPaused;
@Override @Override
public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException { public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException {
if (ACTION_SHOW_EVENT.equals(action)) { if (ACTION_SHOW_EVENT.equals(action)) {
if (webView.isPaused()) { if (this.isPaused) {
// suppress while paused
return true; return true;
} }
@ -77,5 +79,11 @@ public class Toast extends CordovaPlugin {
if (mostRecentToast != null) { if (mostRecentToast != null) {
mostRecentToast.cancel(); mostRecentToast.cancel();
} }
this.isPaused = true;
}
@Override
public void onResume(boolean multitasking) {
this.isPaused = false;
} }
} }