mirror of
https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git
synced 2026-07-31 00:02:14 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8dbcc43e68 | ||
|
|
4f6463e3f2 | ||
|
|
41a568c549 | ||
|
|
811e0a82ed |
@@ -251,6 +251,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.4.2: You can now also set the Toast `opacity` for iOS.
|
||||
- 2.4.1: As an addition to 2.4.0, [Sino](https://github.com/SinoBoeckmann) added the option to change the text color!
|
||||
- 2.4.0: You can now style the Toast with a number of properties. See
|
||||
- 2.3.2: The click event introduced with 2.3.0 did not work with Android 5+.
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
### Expected behaviour
|
||||
Tell us what should happen.
|
||||
|
||||
### Actual behaviour
|
||||
Tell us what happens instead. Provide a log message if relevant.
|
||||
|
||||
### I'm seeing this behaviour on
|
||||
_Remove this hint: these checkboxes can be checked like this: [x]_
|
||||
|
||||
- [ ] iOS device
|
||||
- [ ] iOS sim
|
||||
- [ ] Android device
|
||||
- [ ] Android sim
|
||||
|
||||
#### Hardware models
|
||||
Example: Samsung Galaxy S6, iPhone 6s
|
||||
|
||||
#### OS versions
|
||||
Example: Android 4.4.2, iOS 9.2
|
||||
|
||||
### I'm not a dummy, so I've checked these
|
||||
- [ ] It happens on a fresh Cordova CLI project as well.
|
||||
- [ ] I'm waiting for `deviceready` to fire.
|
||||
- [ ] My JavaScript has no errors (`window.onerror` catches nothing).
|
||||
|
||||
### So how can we reproduce this?
|
||||
_Remove this hint: Pick one of these - use the Preview feature of this editor to get a sense which option we like best_
|
||||
|
||||
#### Awesome :star::star::star::star::star:
|
||||
Provide a (link to a) minimal demo app showing the faulty behaviour.
|
||||
|
||||
#### Sweet :star::star::star::star:
|
||||
Provide a concise code sample which can be dropped into a freshly created Cordova CLI app.
|
||||
|
||||
#### Good :star::star::star:
|
||||
Provide your own app and instructions how to reproduce the issue.
|
||||
|
||||
#### Meh :star::star:
|
||||
Provide a code sample with a bunch of magic parameters which I need to interpolate by guessing to reconstruct the actual runtime code.
|
||||
|
||||
#### Worst :poop:
|
||||
Say the source code can't be disclosed and refuse to provide any of the above. Expect this issue to be closed by a bunch of angry aliens :alien::alien::alien::alien::alien: that will hunt you down and :fire: your :computer:. You've been warned. :fire_engine:
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cordova-plugin-x-toast",
|
||||
"version": "2.4.1",
|
||||
"version": "2.4.2",
|
||||
"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
-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="cordova-plugin-x-toast"
|
||||
version="2.4.1">
|
||||
version="2.4.2">
|
||||
|
||||
<name>Toast</name>
|
||||
|
||||
|
||||
@@ -140,11 +140,14 @@ static id styling;
|
||||
UIView *v = [vc view];
|
||||
[v addSubview:toast];
|
||||
|
||||
NSNumber * opacity = styling[@"opacity"];
|
||||
CGFloat theOpacity = opacity == nil ? CSToastOpacity : [opacity floatValue];
|
||||
|
||||
[UIView animateWithDuration:CSToastFadeDuration
|
||||
delay:0.0
|
||||
options:(UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionAllowUserInteraction)
|
||||
animations:^{
|
||||
toast.alpha = CSToastOpacity;
|
||||
toast.alpha = theOpacity;
|
||||
} completion:^(BOOL finished) {
|
||||
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:duration target:self selector:@selector(toastTimerDidFinish:) userInfo:toast repeats:NO];
|
||||
// associate the timer with the toast view
|
||||
@@ -319,16 +322,13 @@ static id styling;
|
||||
NSString * backgroundColor = styling[@"backgroundColor"];
|
||||
UIColor *theColor = backgroundColor == nil ? [UIColor blackColor] : [self colorFromHexString:backgroundColor];
|
||||
|
||||
NSNumber * opacity = styling[@"opacity"];
|
||||
CGFloat theOpacity = opacity == nil ? CSToastOpacity : [opacity floatValue];
|
||||
|
||||
NSNumber * horizontalPadding = styling[@"horizontalPadding"];
|
||||
NSNumber * verticalPadding = styling[@"verticalPadding"];
|
||||
CGFloat theHorizontalPadding = horizontalPadding == nil ? CSToastHorizontalPadding : [horizontalPadding floatValue];
|
||||
CGFloat theVerticalPadding = verticalPadding == nil ? CSToastVerticalPadding : [verticalPadding floatValue];
|
||||
|
||||
wrapperView.backgroundColor = [theColor colorWithAlphaComponent:theOpacity];
|
||||
|
||||
wrapperView.backgroundColor = theColor;
|
||||
|
||||
if(image != nil) {
|
||||
imageView = [[UIImageView alloc] initWithImage:image];
|
||||
imageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
@@ -349,7 +349,7 @@ static id styling;
|
||||
if (title != nil) {
|
||||
NSString * titleLabelTextColor = styling[@"textColor"];
|
||||
UIColor *theTitleLabelTextColor = titleLabelTextColor == nil ? [UIColor whiteColor] : [self colorFromHexString:titleLabelTextColor];
|
||||
|
||||
|
||||
titleLabel = [[UILabel alloc] init];
|
||||
titleLabel.numberOfLines = CSToastMaxTitleLines;
|
||||
titleLabel.font = [UIFont boldSystemFontOfSize:CSToastFontSize];
|
||||
@@ -369,7 +369,7 @@ static id styling;
|
||||
if (message != nil) {
|
||||
NSString * messageLabelTextColor = styling[@"textColor"];
|
||||
UIColor *theMessageLabelTextColor = messageLabelTextColor == nil ? [UIColor whiteColor] : [self colorFromHexString:messageLabelTextColor];
|
||||
|
||||
|
||||
messageLabel = [[UILabel alloc] init];
|
||||
messageLabel.numberOfLines = CSToastMaxMessageLines;
|
||||
messageLabel.font = [UIFont systemFontOfSize:CSToastFontSize];
|
||||
|
||||
Reference in New Issue
Block a user