mirror of
https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git
synced 2026-07-31 00:02:14 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eed523111b | ||
|
|
e0420e0aef | ||
|
|
8c10bcaec5 | ||
|
|
5d9aa4f187 | ||
|
|
50290d83de |
+1
-1
@@ -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.1.0">
|
||||
version="2.1.1">
|
||||
|
||||
<name>Toast</name>
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ public class Toast extends CordovaPlugin {
|
||||
cordova.getActivity().runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
android.widget.Toast toast = android.widget.Toast.makeText(
|
||||
webView.getContext(),
|
||||
cordova.getActivity().getApplicationContext(),
|
||||
message,
|
||||
"short".equals(duration) ? android.widget.Toast.LENGTH_SHORT : android.widget.Toast.LENGTH_LONG);
|
||||
|
||||
@@ -92,4 +92,4 @@ public class Toast extends CordovaPlugin {
|
||||
public void onResume(boolean multitasking) {
|
||||
this.isPaused = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
-4
@@ -114,9 +114,14 @@ static UIView *prevToast = NULL;
|
||||
toast.exclusiveTouch = YES;
|
||||
}
|
||||
|
||||
// make sure that if InAppBrowser is active, we're still showing Toasts on top of it
|
||||
[self.superview.superview addSubview:toast];
|
||||
|
||||
if ([[[UIDevice currentDevice] systemVersion] compare:@"8.0" options:NSNumericSearch] != NSOrderedAscending) {
|
||||
// on iOS8 when InAppBrowser is active, the Toast is below it,
|
||||
[self.superview.superview addSubview:toast];
|
||||
} else {
|
||||
// ..on iOS7 however with this fix on landscape the Toast isn't rotated automatically
|
||||
[self.superview addSubview:toast];
|
||||
}
|
||||
|
||||
[UIView animateWithDuration:CSToastFadeDuration
|
||||
delay:0.0
|
||||
options:(UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionAllowUserInteraction)
|
||||
@@ -156,7 +161,7 @@ static UIView *prevToast = NULL;
|
||||
- (void)handleToastTapped:(UITapGestureRecognizer *)recognizer {
|
||||
NSTimer *timer = (NSTimer *)objc_getAssociatedObject(self, &CSToastTimerKey);
|
||||
[timer invalidate];
|
||||
|
||||
|
||||
[self hideToast:recognizer.view];
|
||||
}
|
||||
|
||||
@@ -247,7 +252,10 @@ static UIView *prevToast = NULL;
|
||||
return CGSizeMake(ceilf(boundingRect.size.width), ceilf(boundingRect.size.height));
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
return [string sizeWithFont:font constrainedToSize:constrainedSize lineBreakMode:lineBreakMode];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
- (UIView *)viewForMessage:(NSString *)message title:(NSString *)title image:(UIImage *)image {
|
||||
|
||||
Reference in New Issue
Block a user