Skip to content

Commit

Permalink
New SmartKeys bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Cabanero committed Oct 30, 2016
1 parent a0c5ab0 commit 10988ab
Show file tree
Hide file tree
Showing 40 changed files with 2,960 additions and 668 deletions.
95 changes: 70 additions & 25 deletions Blink.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

77 changes: 0 additions & 77 deletions Blink/SmartKeys.m

This file was deleted.

325 changes: 0 additions & 325 deletions Blink/SmartKeys.xib

This file was deleted.

17 changes: 17 additions & 0 deletions Blink/SmartKeys/CustomViews/Button/SKButton.h
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
55 changes: 55 additions & 0 deletions Blink/SmartKeys/CustomViews/Button/SKButton.m
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
14 changes: 14 additions & 0 deletions Blink/SmartKeys/CustomViews/Button/SKModifierButton.h
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
21 changes: 21 additions & 0 deletions Blink/SmartKeys/CustomViews/Button/SKModifierButton.m
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
14 changes: 14 additions & 0 deletions Blink/SmartKeys/CustomViews/Button/SKNonModifierButton.h
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
17 changes: 17 additions & 0 deletions Blink/SmartKeys/CustomViews/Button/SKNonModifierButton.m
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
14 changes: 13 additions & 1 deletion Blink/SmartKeys.h → Blink/SmartKeys/SmartKeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,20 @@

#import <UIKit/UIKit.h>

@interface SmartKeys : UIViewController
#include "SmartKeysView.h"


extern NSString *const SpecialCursorKeyHome;
extern NSString *const SpecialCursorKeyEnd;
extern NSString *const SpecialCursorKeyPgUp;
extern NSString *const SpecialCursorKeyPgDown;

@interface SmartKeys : UIViewController <SmartKeysDelegate>

@property(nonatomic, weak) id< UIKeyInput > textInputDelegate;
@property(strong, nonatomic) SmartKeysView *view;

-(void)symbolDown:(NSString *)symbol;
-(void)symbolUp:(NSString *)symbol;

@end
Loading

0 comments on commit 10988ab

Please sign in to comment.