forked from github/Toast-PhoneGap-Plugin
#75 [Toast-PhoneGap-Plugin] styling.opacity is meanless
This commit is contained in:
parent
4f6463e3f2
commit
8dbcc43e68
@ -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+.
|
||||
|
@ -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",
|
||||
|
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user