From cc8d784609c3131f779eb5588b432f371b567b4a Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 13 Jan 2020 14:02:22 +0800 Subject: [PATCH 1/5] add loading show for downloading cloud image --- src/ios/GMImagePicker/FeHourGlass.h | 30 +++ src/ios/GMImagePicker/FeHourGlass.m | 302 +++++++++++++++++++++++++ src/ios/GMImagePicker/GMGridViewCell.h | 5 +- src/ios/GMImagePicker/GMGridViewCell.m | 8 +- src/ios/GMImagePicker/UIColor+flat.h | 36 +++ src/ios/GMImagePicker/UIColor+flat.m | 177 +++++++++++++++ 6 files changed, 556 insertions(+), 2 deletions(-) create mode 100644 src/ios/GMImagePicker/FeHourGlass.h create mode 100644 src/ios/GMImagePicker/FeHourGlass.m create mode 100644 src/ios/GMImagePicker/UIColor+flat.h create mode 100644 src/ios/GMImagePicker/UIColor+flat.m diff --git a/src/ios/GMImagePicker/FeHourGlass.h b/src/ios/GMImagePicker/FeHourGlass.h new file mode 100644 index 00000000..848dea24 --- /dev/null +++ b/src/ios/GMImagePicker/FeHourGlass.h @@ -0,0 +1,30 @@ +// +// FeCandyLoader.h +// FeSpinner +// +// Created by Nghia Tran on 8/14/14. +// Copyright (c) 2014 fe. All rights reserved. +// + +#import + +@interface FeHourGlass : UIView + +// is running +@property (assign, readonly, nonatomic) BOOL isShowing; + +-(instancetype) initWithView:(UIView *) view; + +-(void) show; + +-(void) showWhileExecutingBlock:(dispatch_block_t) block; + +-(void) showWhileExecutingBlock:(dispatch_block_t)block completion:(dispatch_block_t) completion; + +-(void) showWhileExecutingSelector:(SEL) selector onTarget:(id) target withObject:(id) object; + +-(void) showWhileExecutingSelector:(SEL)selector onTarget:(id)target withObject:(id)object completion:(dispatch_block_t) completion; + +-(void) dismiss; + +@end diff --git a/src/ios/GMImagePicker/FeHourGlass.m b/src/ios/GMImagePicker/FeHourGlass.m new file mode 100644 index 00000000..35956177 --- /dev/null +++ b/src/ios/GMImagePicker/FeHourGlass.m @@ -0,0 +1,302 @@ +// +// FeCandyLoader.m +// FeSpinner +// +// Created by Nghia Tran on 8/14/14. +// Copyright (c) 2014 fe. All rights reserved. +// + +#import "FeHourGlass.h" +#import "UIColor+flat.h" +#import + +#define kFe_HourGlass_Length 30.0f +#define kFe_HourGlass_Duration 3.5f + +@interface FeHourGlass () +{ + CGFloat width; + CGFloat height; + + // Target, method, object and block + id targetForExecuting; + SEL methodForExecuting; + id objectForExecuting; + dispatch_block_t completionBlock; +} +// Top +@property (strong, nonatomic) CAShapeLayer *topLayer; + +// Bottom +@property (strong, nonatomic) CAShapeLayer *bottomLayer; + +// Dash line +@property (strong, nonatomic) CAShapeLayer *lineLayer; + +// container Layer +@property (strong, nonatomic) CALayer *containerLayer; + +// Container view +@property (weak, nonatomic) UIView *containerView; + +// Animaiton +@property (strong, nonatomic) CAKeyframeAnimation *topAnimation; + +@property (strong, nonatomic) CAKeyframeAnimation *bottomAnimation; + +@property (strong, nonatomic) CAKeyframeAnimation *lineAnimation; + +@property(strong, nonatomic) CAKeyframeAnimation *containerAnimation; + +/////////// +// Init +-(void) initCommon; +-(void) initContainer; +-(void) initTop; +-(void) initBottom; +-(void) initLine; +-(void) initAnimation; +@end + +@implementation FeHourGlass + +-(instancetype) initWithView:(UIView *)view +{ + self = [super init]; + if (self) + { + _containerView = view; + + [self initCommon]; + + [self initContainer]; + + [self initTop]; + + [self initBottom]; + + [self initLine]; + + [self initAnimation]; + } + return self; +} +-(void) initCommon +{ + _isShowing = NO; + + self.frame = CGRectMake(0, 0, _containerView.bounds.size.width, _containerView.bounds.size.height); + self.backgroundColor = [UIColor clearColor]; + + width = sqrtf(kFe_HourGlass_Length * kFe_HourGlass_Length + kFe_HourGlass_Length * kFe_HourGlass_Length); + height = sqrtf((kFe_HourGlass_Length * kFe_HourGlass_Length) - ((width / 2.0f) * (width / 2.0f))); +} +-(void) initContainer +{ + _containerLayer = [CALayer layer]; + _containerLayer.backgroundColor = [UIColor clearColor].CGColor; + _containerLayer.frame = CGRectMake(0, 0, width, height * 2); + _containerLayer.anchorPoint = CGPointMake(0.5f, 0.5f); + _containerLayer.position = CGPointMake(self.bounds.size.width / 2, self.bounds.size.height / 2); + + [self.layer addSublayer:_containerLayer]; +} +-(void) initTop +{ + // BezierPath + UIBezierPath *path = [UIBezierPath bezierPath]; + [path moveToPoint:CGPointMake(0, 0)]; + [path addLineToPoint:CGPointMake(width, 0)]; + [path addLineToPoint:CGPointMake(width / 2.0f, height)]; + [path addLineToPoint:CGPointMake(0, 0)]; + + [path closePath]; + + // Top Layer + _topLayer = [CAShapeLayer layer]; + _topLayer.frame = CGRectMake(0, 0, width, height); + _topLayer.path = path.CGPath; + _topLayer.fillColor = [UIColor whiteColor].CGColor; + _topLayer.strokeColor = [UIColor whiteColor].CGColor; + _topLayer.lineWidth = 0.0f; + _topLayer.anchorPoint = CGPointMake(0.5f, 1); + _topLayer.position = CGPointMake(width / 2.0f, height); + + [_containerLayer addSublayer:_topLayer]; +} +-(void) initBottom +{ + // BezierPath + UIBezierPath *path = [UIBezierPath bezierPath]; + [path moveToPoint:CGPointMake(width / 2, 0)]; + [path addLineToPoint:CGPointMake(width, height)]; + [path addLineToPoint:CGPointMake(0, height )]; + [path addLineToPoint:CGPointMake(width / 2, 0)]; + + [path closePath]; + + // Top Layer + _bottomLayer = [CAShapeLayer layer]; + _bottomLayer.frame = CGRectMake(0, height, width, height); + _bottomLayer.path = path.CGPath; + _bottomLayer.fillColor = [UIColor whiteColor].CGColor; + _bottomLayer.strokeColor = [UIColor whiteColor].CGColor; + _bottomLayer.lineWidth = 0.0f; + _bottomLayer.anchorPoint = CGPointMake(0.5f, 1.0f); + _bottomLayer.position = CGPointMake(width / 2.0f, height * 2.0f); + _bottomLayer.transform = CATransform3DMakeScale(0, 0, 0); + + [_containerLayer addSublayer:_bottomLayer]; +} +-(void) initLine +{ + // BezierPath + UIBezierPath *path = [UIBezierPath bezierPath]; + [path moveToPoint:CGPointMake(width / 2, 0)]; + [path addLineToPoint:CGPointMake(width / 2, height)]; + + // Line Layer + _lineLayer = [CAShapeLayer layer]; + _lineLayer.frame = CGRectMake(0, height, width, height); + _lineLayer.strokeColor = [UIColor whiteColor].CGColor; + _lineLayer.lineWidth = 1.0; + _lineLayer.lineJoin = kCALineJoinMiter; + _lineLayer.lineDashPattern = [NSArray arrayWithObjects:[NSNumber numberWithInt:1],[NSNumber numberWithInt:1], nil]; + _lineLayer.lineDashPhase = 3.0f; + _lineLayer.path = path.CGPath; + _lineLayer.strokeEnd = 0.0f; + + [_containerLayer addSublayer:_lineLayer]; +} +-(void) initAnimation +{ + if (YES) // Top Animation + { + _topAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"]; + _topAnimation.duration = kFe_HourGlass_Duration; + _topAnimation.repeatCount = HUGE_VAL; + _topAnimation.keyTimes = @[@0.0f, @0.9f, @1.0f]; + _topAnimation.values = @[@1.0f, @0.0f, @0.0f]; + } + if (YES) // Bottom Animation + { + _bottomAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"]; + _bottomAnimation.duration = kFe_HourGlass_Duration; + _bottomAnimation.repeatCount = HUGE_VAL; + _bottomAnimation.keyTimes = @[@0.1f, @0.9f, @1.0f]; + _bottomAnimation.values = @[@0.0f, @1.0f, @1.0f]; + } + if (YES) // Bottom Animation + { + _lineAnimation = [CAKeyframeAnimation animationWithKeyPath:@"strokeEnd"]; + _lineAnimation.duration = kFe_HourGlass_Duration; + _lineAnimation.repeatCount = HUGE_VAL; + _lineAnimation.keyTimes = @[@0.0f, @0.1f, @0.9f, @1.0f]; + _lineAnimation.values = @[@0.0f, @1.0f, @1.0f, @1.0f]; + } + if (YES) // Container Animation + { + _containerAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"]; + _containerAnimation.timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.2f :1 :0.8f :0.0f]; + _containerAnimation.duration = kFe_HourGlass_Duration; + _containerAnimation.repeatCount = HUGE_VAL; + _containerAnimation.keyTimes = @[@0.8f, @1.0f]; + _containerAnimation.values = @[[NSNumber numberWithFloat:0.0f], [NSNumber numberWithFloat:M_PI]]; + //_containerAnimation.calculationMode = kCAAnimationCubic; + } +} +#pragma mark - Action +-(void) show +{ + if (_isShowing) + return; + + _isShowing = YES; + + [_topLayer addAnimation:_topAnimation forKey:@"TopAnimatin"]; + [_bottomLayer addAnimation:_bottomAnimation forKey:@"BottomAnimation"]; + [_lineLayer addAnimation:_lineAnimation forKey:@"LineAnimation"]; + [_containerLayer addAnimation:_containerAnimation forKey:@"ContainerAnimation"]; +} +-(void) dismiss +{ + if (!_isShowing) + return; + + _isShowing = NO; + +} +-(void) showWhileExecutingBlock:(dispatch_block_t)block +{ + [self showWhileExecutingBlock:block completion:nil]; +} +-(void) showWhileExecutingSelector:(SEL)selector onTarget:(id)target withObject:(id)object +{ + [self showWhileExecutingSelector:selector onTarget:target withObject:object completion:nil]; + +} +-(void) showWhileExecutingBlock:(dispatch_block_t)block completion:(dispatch_block_t)completion +{ + // Check block != nil + if (block != nil) + { + [self show]; + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^ + { + block(); + + // Update UI + dispatch_async(dispatch_get_main_queue(), ^{ + completion(); + [self dismiss]; + }); + }); + } +} +-(void) showWhileExecutingSelector:(SEL)selector onTarget:(id)target withObject:(id)object completion:(dispatch_block_t)completion +{ + // Check Selector is responded + if ([target respondsToSelector:selector]) + { + methodForExecuting = selector; + targetForExecuting = target; + objectForExecuting = object; + completionBlock = completion; + + [self show]; + [NSThread detachNewThreadSelector:@selector(executingMethod) toTarget:self withObject:nil]; + } +} +#pragma mark Helper method +-(void) executingMethod +{ + @autoreleasepool { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-performSelector-leaks" + // Start executing the requested task + [targetForExecuting performSelector:methodForExecuting withObject:objectForExecuting]; +#pragma clang diagnostic pop + // Task completed, update view in main thread (note: view operations should + // be done only in the main thread) + dispatch_async(dispatch_get_main_queue(), ^{ + completionBlock(); + [self performSelectorOnMainThread:@selector(cleanUp) withObject:nil waitUntilDone:NO]; + }); + + } +} +-(void) cleanUp +{ + NSLog(@"Clean up"); + if (objectForExecuting) + objectForExecuting = nil; + if (methodForExecuting) + methodForExecuting = nil; + if (targetForExecuting) + targetForExecuting = nil; + if (completionBlock) + completionBlock = nil; + [self dismiss]; +} + +@end diff --git a/src/ios/GMImagePicker/GMGridViewCell.h b/src/ios/GMImagePicker/GMGridViewCell.h index b7b7d09d..757edb75 100755 --- a/src/ios/GMImagePicker/GMGridViewCell.h +++ b/src/ios/GMImagePicker/GMGridViewCell.h @@ -8,6 +8,7 @@ //#import "MRCircularProgressView.h" #import +#import "FeHourGlass.h" @interface GMGridViewCell : UICollectionViewCell @@ -29,6 +30,8 @@ - (void)bind:(PHAsset *)asset; //@property (nonatomic, strong) MRCircularProgressView *circularProgressView; + +@property (strong, nonatomic) FeHourGlass *hourGlass; -(void)show_progress; -(void)set_progress:(float)value animated:(BOOL)animated; -(void)hide_progress; @@ -37,4 +40,4 @@ -(void)show_fetching; -(void)hide_fetching; -@end \ No newline at end of file +@end diff --git a/src/ios/GMImagePicker/GMGridViewCell.m b/src/ios/GMImagePicker/GMGridViewCell.m index d7b5c0be..fdb140df 100755 --- a/src/ios/GMImagePicker/GMGridViewCell.m +++ b/src/ios/GMImagePicker/GMGridViewCell.m @@ -16,7 +16,6 @@ @interface GMGridViewCell () @implementation GMGridViewCell - //@synthesize circularProgressView; static UIFont *titleFont; @@ -27,6 +26,7 @@ @implementation GMGridViewCell static UIColor *selectedColor; static UIColor *disabledColor; + + (void)initialize { titleFont = [UIFont systemFontOfSize:12]; @@ -150,10 +150,16 @@ - (id)initWithFrame:(CGRect)frame -(void)show_progress{ // [self.circularProgressView setHidden:false]; + self.hourGlass = [[FeHourGlass alloc] initWithView:self]; + [self addSubview:self.hourGlass]; + [self.hourGlass show]; } -(void)hide_progress{ // [self.circularProgressView setHidden:true]; +// [self.hourGlass dismiss]; + [self.hourGlass removeFromSuperview]; + } -(void)set_progress:(float)value animated:(BOOL)animated{ diff --git a/src/ios/GMImagePicker/UIColor+flat.h b/src/ios/GMImagePicker/UIColor+flat.h new file mode 100644 index 00000000..ecb33efc --- /dev/null +++ b/src/ios/GMImagePicker/UIColor+flat.h @@ -0,0 +1,36 @@ +// +// UIColor+flat.h +// SaiGonRain +// +// Created by Bang Nguyen on 26/09/2013. +// Copyright (c) 2013 Bang Nguyen. All rights reserved. +// + +#import + +@interface UIColor (flat) + ++ (UIColor*)flatTurquoiseColor; ++ (UIColor*)flatGreenSeaColor; ++ (UIColor*)flatEmeraldColor; ++ (UIColor*)flatNephritisColor; ++ (UIColor*)flatPeterRiverColor; ++ (UIColor*)flatBelizeHoleColor; ++ (UIColor*)flatAmethystColor; ++ (UIColor*)flatWisteriaColor; ++ (UIColor*)flatWetAsphaltColor; ++ (UIColor*)flatMidNightColor; ++ (UIColor*)flatSunFlowerColor; ++ (UIColor*)flatOrangeColor; ++ (UIColor*)flatCarrotColor; ++ (UIColor*)flatPumpkinColor; ++ (UIColor*)flatAlizarinColor; ++ (UIColor*)flatPomegranateColor; ++ (UIColor*)flatCloudColor; ++ (UIColor*)flatSilverColor; ++ (UIColor*)flatConcreteColor; ++ (UIColor*)flatAsbestosColor; + ++(UIColor *) colorWithHexCode:(NSString *)hexCode; + +@end diff --git a/src/ios/GMImagePicker/UIColor+flat.m b/src/ios/GMImagePicker/UIColor+flat.m new file mode 100644 index 00000000..790c36b3 --- /dev/null +++ b/src/ios/GMImagePicker/UIColor+flat.m @@ -0,0 +1,177 @@ +// +// UIColor+flat.m +// SaiGonRain +// +// Created by Bang Nguyen on 26/09/2013. +// Copyright (c) 2013 Bang Nguyen. All rights reserved. +// + +#import "UIColor+flat.h" + +@implementation UIColor (flat) + ++ (UIColor*)flatTurquoiseColor { + return [UIColor colorWithRed:26.0f/255.0f + green:188.0f/255.0f + blue:156.0f/255.0f + alpha:1.0f]; +} + ++ (UIColor*)flatGreenSeaColor { + return [UIColor colorWithRed:22.0f/255.0f + green:160.0f/255.0f + blue:133.0f/255.0f + alpha:1.0f]; +} + ++ (UIColor*)flatEmeraldColor { + return [UIColor colorWithRed:46.0f/255.0f + green:204.0f/255.0f + blue:113.0f/255.0f + alpha:1.0f]; +} + ++ (UIColor*)flatNephritisColor { + return [UIColor colorWithRed:39.0f/255.0f + green:174.0f/255.0f + blue:96.0f/255.0f + alpha:1.0f]; +} + ++ (UIColor*)flatPeterRiverColor { + return [UIColor colorWithRed:52.0f/255.0f + green:152.0f/255.0f + blue:219.0f/255.0f + alpha:1.0f]; +} + ++ (UIColor*)flatBelizeHoleColor { + return [UIColor colorWithRed:41.0f/255.0f + green:128.0f/255.0f + blue:185.0f/255.0f + alpha:1.0f]; +} + ++ (UIColor*)flatAmethystColor { + return [UIColor colorWithRed:155.0f/255.0f + green:89.0f/255.0f + blue:182.0f/255.0f + alpha:1.0f]; +} + ++ (UIColor*)flatWisteriaColor { + return [UIColor colorWithRed:142.0f/255.0f + green:68.0f/255.0f + blue:173.0f/255.0f + alpha:1.0f]; +} + ++ (UIColor*)flatWetAsphaltColor { + return [UIColor colorWithRed:52.0f/255.0f + green:73.0f/255.0f + blue:94.0f/255.0f + alpha:1.0f]; +} + ++ (UIColor*)flatMidNightColor { + return [UIColor colorWithRed:44.0f/255.0f + green:62.0f/255.0f + blue:80.0f/255.0f + alpha:1.0f]; +} + ++ (UIColor*)flatSunFlowerColor { + return [UIColor colorWithRed:241.0f/255.0f + green:196.0f/255.0f + blue:15.0f/255.0f + alpha:1.0f]; +} + ++ (UIColor*)flatOrangeColor { + return [UIColor colorWithRed:243.0f/255.0f + green:156.0f/255.0f + blue:18.0f/255.0f + alpha:1.0f]; +} + ++ (UIColor*)flatCarrotColor { + return [UIColor colorWithRed:230.0f/255.0f + green:126.0f/255.0f + blue:34.0f/255.0f + alpha:1.0f]; +} + ++ (UIColor*)flatPumpkinColor { + return [UIColor colorWithRed:211.0f/255.0f + green:84.0f/255.0f + blue:0.0f/255.0f + alpha:1.0f]; +} + ++ (UIColor*)flatAlizarinColor { + return [UIColor colorWithRed:231.0f/255.0f + green:76.0f/255.0f + blue:60.0f/255.0f + alpha:1.0f]; +} + ++ (UIColor*)flatPomegranateColor { + return [UIColor colorWithRed:192.0f/255.0f + green:57.0f/255.0f + blue:43.0f/255.0f + alpha:1.0f]; +} + ++ (UIColor*)flatCloudColor { + return [UIColor colorWithRed:236.0f/255.0f + green:240.0f/255.0f + blue:241.0f/255.0f + alpha:1.0f]; +} + ++ (UIColor*)flatSilverColor { + return [UIColor colorWithRed:189.0f/255.0f + green:195.0f/255.0f + blue:199.0f/255.0f + alpha:1.0f]; +} + ++ (UIColor*)flatConcreteColor { + return [UIColor colorWithRed:149.0f/255.0f + green:165.0f/255.0f + blue:166.0f/255.0f + alpha:1.0f]; +} + ++ (UIColor*)flatAsbestosColor { + return [UIColor colorWithRed:127.0f/255.0f + green:140.0f/255.0f + blue:141.0f/255.0f + alpha:1.0f]; +} + ++(UIColor *) colorWithHexCode:(NSString *)hexCode +{ + NSString *cleanString = [hexCode stringByReplacingOccurrencesOfString:@"#" withString:@""]; + if([cleanString length] == 3) { + cleanString = [NSString stringWithFormat:@"%@%@%@%@%@%@", + [cleanString substringWithRange:NSMakeRange(0, 1)],[cleanString substringWithRange:NSMakeRange(0, 1)], + [cleanString substringWithRange:NSMakeRange(1, 1)],[cleanString substringWithRange:NSMakeRange(1, 1)], + [cleanString substringWithRange:NSMakeRange(2, 1)],[cleanString substringWithRange:NSMakeRange(2, 1)]]; + } + if([cleanString length] == 6) { + cleanString = [cleanString stringByAppendingString:@"ff"]; + } + + unsigned int baseValue; + [[NSScanner scannerWithString:cleanString] scanHexInt:&baseValue]; + + float red = ((baseValue >> 24) & 0xFF)/255.0f; + float green = ((baseValue >> 16) & 0xFF)/255.0f; + float blue = ((baseValue >> 8) & 0xFF)/255.0f; + float alpha = ((baseValue >> 0) & 0xFF)/255.0f; + + return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; +} + +@end From 0e23653c71405f2a451e0981cb6dfedd38f3ccdc Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 13 Jan 2020 14:13:46 +0800 Subject: [PATCH 2/5] Delete UIColor+flat.h --- src/ios/GMImagePicker/UIColor+flat.h | 36 ---------------------------- 1 file changed, 36 deletions(-) delete mode 100644 src/ios/GMImagePicker/UIColor+flat.h diff --git a/src/ios/GMImagePicker/UIColor+flat.h b/src/ios/GMImagePicker/UIColor+flat.h deleted file mode 100644 index ecb33efc..00000000 --- a/src/ios/GMImagePicker/UIColor+flat.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// UIColor+flat.h -// SaiGonRain -// -// Created by Bang Nguyen on 26/09/2013. -// Copyright (c) 2013 Bang Nguyen. All rights reserved. -// - -#import - -@interface UIColor (flat) - -+ (UIColor*)flatTurquoiseColor; -+ (UIColor*)flatGreenSeaColor; -+ (UIColor*)flatEmeraldColor; -+ (UIColor*)flatNephritisColor; -+ (UIColor*)flatPeterRiverColor; -+ (UIColor*)flatBelizeHoleColor; -+ (UIColor*)flatAmethystColor; -+ (UIColor*)flatWisteriaColor; -+ (UIColor*)flatWetAsphaltColor; -+ (UIColor*)flatMidNightColor; -+ (UIColor*)flatSunFlowerColor; -+ (UIColor*)flatOrangeColor; -+ (UIColor*)flatCarrotColor; -+ (UIColor*)flatPumpkinColor; -+ (UIColor*)flatAlizarinColor; -+ (UIColor*)flatPomegranateColor; -+ (UIColor*)flatCloudColor; -+ (UIColor*)flatSilverColor; -+ (UIColor*)flatConcreteColor; -+ (UIColor*)flatAsbestosColor; - -+(UIColor *) colorWithHexCode:(NSString *)hexCode; - -@end From 614ecdc7af7ba8c09f65fe48362948e17c869eb6 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 13 Jan 2020 14:14:05 +0800 Subject: [PATCH 3/5] Delete UIColor+flat.m --- src/ios/GMImagePicker/UIColor+flat.m | 177 --------------------------- 1 file changed, 177 deletions(-) delete mode 100644 src/ios/GMImagePicker/UIColor+flat.m diff --git a/src/ios/GMImagePicker/UIColor+flat.m b/src/ios/GMImagePicker/UIColor+flat.m deleted file mode 100644 index 790c36b3..00000000 --- a/src/ios/GMImagePicker/UIColor+flat.m +++ /dev/null @@ -1,177 +0,0 @@ -// -// UIColor+flat.m -// SaiGonRain -// -// Created by Bang Nguyen on 26/09/2013. -// Copyright (c) 2013 Bang Nguyen. All rights reserved. -// - -#import "UIColor+flat.h" - -@implementation UIColor (flat) - -+ (UIColor*)flatTurquoiseColor { - return [UIColor colorWithRed:26.0f/255.0f - green:188.0f/255.0f - blue:156.0f/255.0f - alpha:1.0f]; -} - -+ (UIColor*)flatGreenSeaColor { - return [UIColor colorWithRed:22.0f/255.0f - green:160.0f/255.0f - blue:133.0f/255.0f - alpha:1.0f]; -} - -+ (UIColor*)flatEmeraldColor { - return [UIColor colorWithRed:46.0f/255.0f - green:204.0f/255.0f - blue:113.0f/255.0f - alpha:1.0f]; -} - -+ (UIColor*)flatNephritisColor { - return [UIColor colorWithRed:39.0f/255.0f - green:174.0f/255.0f - blue:96.0f/255.0f - alpha:1.0f]; -} - -+ (UIColor*)flatPeterRiverColor { - return [UIColor colorWithRed:52.0f/255.0f - green:152.0f/255.0f - blue:219.0f/255.0f - alpha:1.0f]; -} - -+ (UIColor*)flatBelizeHoleColor { - return [UIColor colorWithRed:41.0f/255.0f - green:128.0f/255.0f - blue:185.0f/255.0f - alpha:1.0f]; -} - -+ (UIColor*)flatAmethystColor { - return [UIColor colorWithRed:155.0f/255.0f - green:89.0f/255.0f - blue:182.0f/255.0f - alpha:1.0f]; -} - -+ (UIColor*)flatWisteriaColor { - return [UIColor colorWithRed:142.0f/255.0f - green:68.0f/255.0f - blue:173.0f/255.0f - alpha:1.0f]; -} - -+ (UIColor*)flatWetAsphaltColor { - return [UIColor colorWithRed:52.0f/255.0f - green:73.0f/255.0f - blue:94.0f/255.0f - alpha:1.0f]; -} - -+ (UIColor*)flatMidNightColor { - return [UIColor colorWithRed:44.0f/255.0f - green:62.0f/255.0f - blue:80.0f/255.0f - alpha:1.0f]; -} - -+ (UIColor*)flatSunFlowerColor { - return [UIColor colorWithRed:241.0f/255.0f - green:196.0f/255.0f - blue:15.0f/255.0f - alpha:1.0f]; -} - -+ (UIColor*)flatOrangeColor { - return [UIColor colorWithRed:243.0f/255.0f - green:156.0f/255.0f - blue:18.0f/255.0f - alpha:1.0f]; -} - -+ (UIColor*)flatCarrotColor { - return [UIColor colorWithRed:230.0f/255.0f - green:126.0f/255.0f - blue:34.0f/255.0f - alpha:1.0f]; -} - -+ (UIColor*)flatPumpkinColor { - return [UIColor colorWithRed:211.0f/255.0f - green:84.0f/255.0f - blue:0.0f/255.0f - alpha:1.0f]; -} - -+ (UIColor*)flatAlizarinColor { - return [UIColor colorWithRed:231.0f/255.0f - green:76.0f/255.0f - blue:60.0f/255.0f - alpha:1.0f]; -} - -+ (UIColor*)flatPomegranateColor { - return [UIColor colorWithRed:192.0f/255.0f - green:57.0f/255.0f - blue:43.0f/255.0f - alpha:1.0f]; -} - -+ (UIColor*)flatCloudColor { - return [UIColor colorWithRed:236.0f/255.0f - green:240.0f/255.0f - blue:241.0f/255.0f - alpha:1.0f]; -} - -+ (UIColor*)flatSilverColor { - return [UIColor colorWithRed:189.0f/255.0f - green:195.0f/255.0f - blue:199.0f/255.0f - alpha:1.0f]; -} - -+ (UIColor*)flatConcreteColor { - return [UIColor colorWithRed:149.0f/255.0f - green:165.0f/255.0f - blue:166.0f/255.0f - alpha:1.0f]; -} - -+ (UIColor*)flatAsbestosColor { - return [UIColor colorWithRed:127.0f/255.0f - green:140.0f/255.0f - blue:141.0f/255.0f - alpha:1.0f]; -} - -+(UIColor *) colorWithHexCode:(NSString *)hexCode -{ - NSString *cleanString = [hexCode stringByReplacingOccurrencesOfString:@"#" withString:@""]; - if([cleanString length] == 3) { - cleanString = [NSString stringWithFormat:@"%@%@%@%@%@%@", - [cleanString substringWithRange:NSMakeRange(0, 1)],[cleanString substringWithRange:NSMakeRange(0, 1)], - [cleanString substringWithRange:NSMakeRange(1, 1)],[cleanString substringWithRange:NSMakeRange(1, 1)], - [cleanString substringWithRange:NSMakeRange(2, 1)],[cleanString substringWithRange:NSMakeRange(2, 1)]]; - } - if([cleanString length] == 6) { - cleanString = [cleanString stringByAppendingString:@"ff"]; - } - - unsigned int baseValue; - [[NSScanner scannerWithString:cleanString] scanHexInt:&baseValue]; - - float red = ((baseValue >> 24) & 0xFF)/255.0f; - float green = ((baseValue >> 16) & 0xFF)/255.0f; - float blue = ((baseValue >> 8) & 0xFF)/255.0f; - float alpha = ((baseValue >> 0) & 0xFF)/255.0f; - - return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; -} - -@end From 19d4d0eb007f93b74a77d130e6a0e86dea4a3f11 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 13 Jan 2020 14:15:47 +0800 Subject: [PATCH 4/5] add loading gif for downloading ios cloud image --- src/ios/GMImagePicker/FeHourGlass.m | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ios/GMImagePicker/FeHourGlass.m b/src/ios/GMImagePicker/FeHourGlass.m index 35956177..cb358aa3 100644 --- a/src/ios/GMImagePicker/FeHourGlass.m +++ b/src/ios/GMImagePicker/FeHourGlass.m @@ -7,7 +7,6 @@ // #import "FeHourGlass.h" -#import "UIColor+flat.h" #import #define kFe_HourGlass_Length 30.0f From f59b593f2954d6cf986ef810899355ca54ef849d Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 21 May 2020 10:07:18 +0800 Subject: [PATCH 5/5] Update plugin.xml auto add FeHourGlass.h/.m to xcode project --- plugin.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugin.xml b/plugin.xml index bdd748ea..a5ffcc82 100644 --- a/plugin.xml +++ b/plugin.xml @@ -36,6 +36,9 @@ + + +