diff --git a/README.md b/README.md index 94654a9..94833b3 100644 --- a/README.md +++ b/README.md @@ -273,6 +273,7 @@ The Android code was entirely created by me. For iOS most credits go to this excellent [Toast for iOS project by Charles Scalesse] (https://github.com/scalessec/Toast). ## 6. CHANGELOG +- 2.7.0: [Android P compatibility.](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin/issues/116) - 2.6.2: [iOS view hierarchy fix.](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin/pull/112) - 2.6.0: Windows support! - 2.5.2: Multi-line wrapping Toasts are now center aligned. diff --git a/package.json b/package.json index df1c6df..c43546d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-plugin-x-toast", - "version": "2.6.2", + "version": "2.7.0", "description": "This plugin allows you to show a Toast. A Toast is a little non intrusive buttonless popup which automatically disappears.", "cordova": { "id": "cordova-plugin-x-toast", diff --git a/plugin.xml b/plugin.xml index 1b2f291..731f68c 100755 --- a/plugin.xml +++ b/plugin.xml @@ -1,7 +1,7 @@ + version="2.7.0"> Toast diff --git a/src/android/nl/xservices/plugins/Toast.java b/src/android/nl/xservices/plugins/Toast.java index f77b007..c06f184 100644 --- a/src/android/nl/xservices/plugins/Toast.java +++ b/src/android/nl/xservices/plugins/Toast.java @@ -36,6 +36,7 @@ public class Toast extends CordovaPlugin { private ViewGroup viewGroup; private static final boolean IS_AT_LEAST_LOLLIPOP = Build.VERSION.SDK_INT >= 21; + private static final boolean IS_AT_LEAST_PIE = Build.VERSION.SDK_INT >= 28; // note that webView.isPaused() is not Xwalk compatible, so tracking it poor-man style private boolean isPaused; @@ -192,7 +193,12 @@ public boolean onTouch(View view, MotionEvent motionEvent) { } // trigger show every 2500 ms for as long as the requested duration _timer = new CountDownTimer(hideAfterMs, 2500) { - public void onTick(long millisUntilFinished) { } + public void onTick(long millisUntilFinished) { + // see https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin/issues/116 + if (!IS_AT_LEAST_PIE) { + toast.show(); + } + } public void onFinish() { returnTapEvent("hide", msg, data, callbackContext); toast.cancel(); @@ -257,4 +263,4 @@ public void onPause(boolean multitasking) { public void onResume(boolean multitasking) { this.isPaused = false; } -} \ No newline at end of file +}