forked from github/Toast-PhoneGap-Plugin
Remove show toast method call from cancel timer to ensure that toast show is called only once. #118
This commit is contained in:
parent
e4e18f143a
commit
8869b81749
@ -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.
|
||||
|
@ -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",
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||
id="cordova-plugin-x-toast"
|
||||
version="2.6.2">
|
||||
version="2.7.0">
|
||||
|
||||
<name>Toast</name>
|
||||
|
||||
|
@ -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 class Toast extends CordovaPlugin {
|
||||
}
|
||||
// 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 class Toast extends CordovaPlugin {
|
||||
public void onResume(boolean multitasking) {
|
||||
this.isPaused = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user