Compare commits

...
8 Commits
Author SHA1 Message Date
EddyVerbruggen 2add9bef7b Cordova id change & version bump 2015-08-27 16:34:49 +02:00
EddyVerbruggen c252764372 #41 npm prep (name was taken) 2015-08-04 22:17:28 +02:00
EddyVerbruggen ba7c60f324 #41 npm prep 2015-08-04 22:09:57 +02:00
EddyVerbruggen eed523111b bump 2015-08-04 22:07:13 +02:00
EddyVerbruggen e0420e0aef bump 2015-08-04 22:06:46 +02:00
Eddy Verbruggen 8c10bcaec5 Merge pull request #45 from martinoss/android-fix-blurry-toast
Fix blurry toast on Android 5, resolves #44
2015-08-04 21:39:56 +02:00
Martin Oss 5d9aa4f187 Fix blurry toast on Android 5, resolves EddyVerbruggen/Toast-PhoneGap-Plugin#44 2015-08-04 21:09:29 +02:00
EddyVerbruggen 50290d83de #37 Support landscape mode on iOS 7 2015-06-19 12:28:29 +02:00
5 changed files with 61 additions and 15 deletions
+4 -7
View File
@@ -63,18 +63,19 @@ Toast is compatible with [Cordova Plugman](https://github.com/apache/cordova-plu
Using the Cordova CLI and the [Cordova Plugin Registry](http://plugins.cordova.io)
```
$ cordova plugin add nl.x-services.plugins.toast
$ cordova plugin add cordova-plugin-x-toast
$ cordova prepare
```
Or using the phonegap CLI
```
$ phonegap local plugin add nl.x-services.plugins.toast
$ phonegap local plugin add cordova-plugin-x-toast
```
Toast.js is brought in automatically. There is no need to change or add anything in your html.
### Manually
You'd better use the CLI, but here goes:
1\. Add the following xml to your `config.xml` in the root directory of your `www` folder:
```xml
@@ -118,11 +119,7 @@ Toast works with PhoneGap build too, but only with PhoneGap 3.0 and up.
Just add the following xml to your `config.xml` to always use the latest version of this plugin:
```xml
<gap:plugin name="nl.x-services.plugins.toast" source="plugins.cordova.io" />
```
or to use a specific version:
```xml
<gap:plugin name="nl.x-services.plugins.toast" source="plugins.cordova.io" version="2.0.6" />
<gap:plugin name="cordova-plugin-x-toast" source="npm" />
```
Toast.js is brought in automatically. There is no need to change or add anything in your html.
+41
View File
@@ -0,0 +1,41 @@
{
"name": "cordova-plugin-x-toast",
"version": "2.2.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",
"platforms": [
"ios",
"android",
"wp8",
"blackberry10"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git"
},
"keywords": [
"Toast",
"Notification",
"Message",
"Alert",
"ecosystem:cordova",
"cordova-ios",
"cordova-android",
"cordova-wp8",
"cordova-blackberry10"
],
"engines": [
{
"name": "cordova",
"version": ">=3.0.0"
}
],
"author": "Eddy Verbruggen <eddyverbruggen@gmail.com> (https://github.com/EddyVerbruggen)",
"license": "MIT",
"bugs": {
"url": "https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin/issues"
},
"homepage": "https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin#readme"
}
+2 -2
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
id="cordova-plugin-x-toast"
version="2.2.0">
<name>Toast</name>
+2 -2
View File
@@ -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
View File
@@ -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 {