forked from blinksh/blink
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Carlos Cabanero
committed
Oct 30, 2016
1 parent
a0c5ab0
commit 10988ab
Showing
40 changed files
with
2,960 additions
and
668 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// SKButton.h | ||
// smartkeys | ||
// | ||
// Created by Atul M on 27/10/16. | ||
// Copyright © 2016 CARLOS CABANERO. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface SKButton : UIButton | ||
|
||
@property (nonatomic, strong) CALayer *backgroundLayer; | ||
|
||
- (void)animatedButtonSelection:(BOOL)selected; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// | ||
// SKButton.m | ||
// smartkeys | ||
// | ||
// Created by Atul M on 27/10/16. | ||
// Copyright © 2016 CARLOS CABANERO. All rights reserved. | ||
// | ||
|
||
#import "SKButton.h" | ||
|
||
@implementation SKButton | ||
@synthesize backgroundLayer; | ||
|
||
- (void)animatedButtonSelection:(BOOL)selected{ | ||
if(selected){ | ||
if(self.backgroundLayer != nil){ | ||
[self.backgroundLayer removeFromSuperlayer]; | ||
} | ||
self.backgroundLayer = [[CALayer alloc]init]; | ||
self.backgroundLayer.cornerRadius = 5; | ||
self.backgroundLayer.frame = CGRectMake(2, 2, self.frame.size.width-4, self.frame.size.height-4); | ||
self.backgroundLayer.backgroundColor = [UIColor colorWithRed:86.0/255.0 green:234.0/255.0 blue:241.0/255.0 alpha:1.0].CGColor; | ||
|
||
CABasicAnimation *theAnimation=[CABasicAnimation animationWithKeyPath:@"opacity"]; | ||
theAnimation.duration=0.2; | ||
theAnimation.fromValue=[NSNumber numberWithFloat:0.0]; | ||
theAnimation.toValue=[NSNumber numberWithFloat:1.0]; | ||
[self.backgroundLayer addAnimation:theAnimation forKey:@"animateOpacity"]; | ||
|
||
[self.layer insertSublayer:self.backgroundLayer atIndex:0]; | ||
}else{ | ||
self.backgroundLayer.opacity = 0.0; | ||
|
||
[CATransaction begin]; | ||
CABasicAnimation *theAnimation=[CABasicAnimation animationWithKeyPath:@"opacity"]; | ||
theAnimation.duration=0.2; | ||
theAnimation.fromValue=[NSNumber numberWithFloat:1.0]; | ||
theAnimation.toValue=[NSNumber numberWithFloat:0.0]; | ||
[CATransaction setCompletionBlock:^{ | ||
if(self.backgroundLayer != nil){ | ||
[self.backgroundLayer removeFromSuperlayer]; | ||
|
||
} | ||
}]; | ||
[self.backgroundLayer addAnimation:theAnimation forKey:@"animateOpacity"]; | ||
[CATransaction commit]; | ||
} | ||
} | ||
|
||
- (void)layoutSubviews | ||
{ | ||
[super layoutSubviews]; | ||
self.backgroundLayer.frame = CGRectMake(2, 2, self.frame.size.width-4, self.frame.size.height-4); | ||
} | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// SKModifierButton.h | ||
// smartkeys | ||
// | ||
// Created by Atul M on 26/10/16. | ||
// Copyright © 2016 CARLOS CABANERO. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
#import "SKButton.h" | ||
|
||
@interface SKModifierButton : SKButton | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// SKModifierButton.m | ||
// smartkeys | ||
// | ||
// Created by Atul M on 26/10/16. | ||
// Copyright © 2016 CARLOS CABANERO. All rights reserved. | ||
// | ||
|
||
#import "SKModifierButton.h" | ||
|
||
#define DEFAULT_BG_COLOR [UIColor viewFlipsideBackgroundColor]; | ||
#define SELECTED_BG_COLOR [UIColor blueColor] | ||
|
||
@implementation SKModifierButton | ||
|
||
-(void)setSelected:(BOOL)selected{ | ||
[super setSelected:selected]; | ||
[super animatedButtonSelection:selected]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// SKNonModifierButton.h | ||
// smartkeys | ||
// | ||
// Created by Atul M on 27/10/16. | ||
// Copyright © 2016 CARLOS CABANERO. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
#import "SKButton.h" | ||
|
||
@interface SKNonModifierButton : SKButton | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// SKNonModifierButton.m | ||
// smartkeys | ||
// | ||
// Created by Atul M on 27/10/16. | ||
// Copyright © 2016 CARLOS CABANERO. All rights reserved. | ||
// | ||
|
||
#import "SKNonModifierButton.h" | ||
@implementation SKNonModifierButton | ||
|
||
- (void)setHighlighted:(BOOL)highlighted{ | ||
[super setHighlighted:highlighted]; | ||
[super animatedButtonSelection:highlighted]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.