Skip to content

Commit

Permalink
Initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
soffes committed Jul 26, 2012
0 parents commit c88307d
Show file tree
Hide file tree
Showing 174 changed files with 6,538 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.DS_Store
*xcuserdata/
*build/
*.mode1v3
*.pbxuser
*.xcworkspace
*.moved-aside/
DerivedData

Resources/Fonts/*
Other Sources/CDIDefines.*
15 changes: 15 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[submodule "Vendor/CheddarKit"]
path = Vendor/CheddarKit
url = https://github.com/nothingmagical/cheddarkit.git
[submodule "Vendor/Localytics"]
path = Vendor/Localytics
url = https://github.com/samsoffes/localytics-ios.git
[submodule "Vendor/SSToolkit"]
path = Vendor/SSToolkit
url = https://github.com/samsoffes/sstoolkit.git
[submodule "Vendor/TTTAttributedLabel"]
path = Vendor/TTTAttributedLabel
url = https://github.com/mattt/TTTAttributedLabel.git
[submodule "Vendor/SSPullToRefresh"]
path = Vendor/SSPullToRefresh
url = https://github.com/samsoffes/sspulltorefresh.git
1,232 changes: 1,232 additions & 0 deletions Cheddar for iOS.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions Classes/CDIAddListTableViewCell.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// CDIAddListTableViewCell.h
// Cheddar for iOS
//
// Created by Sam Soffes on 5/30/12.
// Copyright (c) 2012 Nothing Magical. All rights reserved.
//

@interface CDIAddListTableViewCell : UITableViewCell

@property (nonatomic, strong, readonly) SSTextField *textField;
@property (nonatomic, strong, readonly) UIButton *closeButton;

@end
54 changes: 54 additions & 0 deletions Classes/CDIAddListTableViewCell.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//
// CDIAddListTableViewCell.m
// Cheddar for iOS
//
// Created by Sam Soffes on 5/30/12.
// Copyright (c) 2012 Nothing Magical. All rights reserved.
//

#import "CDIAddListTableViewCell.h"
#import "UIFont+Cheddar.h"
#import "UIColor+Cheddar.h"

@implementation CDIAddListTableViewCell

@synthesize textField = _textField;
@synthesize closeButton = _closeButton;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) {
self.selectionStyle = UITableViewCellSelectionStyleNone;

SSBorderedView *background = [[SSBorderedView alloc] initWithFrame:CGRectZero];
background.backgroundColor = [UIColor whiteColor];
background.bottomBorderColor = [UIColor colorWithWhite:0.92f alpha:1.0f];
background.contentMode = UIViewContentModeRedraw;
self.backgroundView = background;

_textField = [[SSTextField alloc] initWithFrame:CGRectZero];
_textField.textColor = [UIColor cheddarTextColor];
_textField.placeholderTextColor = [UIColor cheddarLightTextColor];
_textField.font = [UIFont cheddarFontOfSize:20.0f];
_textField.backgroundColor = [UIColor whiteColor];
_textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
_textField.returnKeyType = UIReturnKeyDone;
_textField.placeholder = @"Name your list";
_textField.autocapitalizationType = UITextAutocapitalizationTypeWords;
[self.contentView addSubview:_textField];

_closeButton = [[UIButton alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 15.0f, 15.0f)];
[_closeButton setImage:[UIImage imageNamed:@"x.png"] forState:UIControlStateNormal];
self.accessoryView = _closeButton;
}
return self;
}


- (void)layoutSubviews {
[super layoutSubviews];

CGSize size = self.contentView.bounds.size;
_textField.frame = CGRectMake(10.0f, 1.0f, size.width - 20.0f, size.height - 2.0f);
}

@end
15 changes: 15 additions & 0 deletions Classes/CDIAddTaskAnimationView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// CDIAddTaskAnimationView.h
// Cheddar for iOS
//
// Created by Sam Soffes on 4/29/12.
// Copyright (c) 2012 Nothing Magical. All rights reserved.
//

@interface CDIAddTaskAnimationView : UIView

@property (nonatomic, strong) NSString *title;

- (void)animationToPoint:(CGPoint)point height:(CGFloat)height insertTask:(void(^)(void))insertTask completion:(void(^)(void))completion;

@end
118 changes: 118 additions & 0 deletions Classes/CDIAddTaskAnimationView.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
//
// CDIAddTaskAnimationView.m
// Cheddar for iOS
//
// Created by Sam Soffes on 4/29/12.
// Copyright (c) 2012 Nothing Magical. All rights reserved.
//

#import "CDIAddTaskAnimationView.h"
#import "CDITableViewCell.h"
#import "UIFont+Cheddar.h"
#import "UIColor+Cheddar.h"
#import <QuartzCore/QuartzCore.h>

@implementation CDIAddTaskAnimationView

@synthesize title = _title;

#pragma mark - Animation

- (void)animationToPoint:(CGPoint)point height:(CGFloat)height insertTask:(void(^)(void))insertTask completion:(void(^)(void))completion {
CGSize size = self.bounds.size;
CGFloat cellHeight = [CDITableViewCell cellHeight];
CGFloat topShadowHeight = 6.0f;
CGFloat bottomShadowHeight = 6.0f;

UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0.0f, -topShadowHeight, size.width, cellHeight + topShadowHeight + bottomShadowHeight)];
container.alpha = 0.0f;
[self addSubview:container];

// Top shadow
SSGradientView *topShadow = [[SSGradientView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, size.width, topShadowHeight)];
topShadow.backgroundColor = [UIColor clearColor];
topShadow.alpha = 0.0f;
topShadow.colors = [NSArray arrayWithObjects:
[UIColor colorWithWhite:0.0f alpha:0.0f],
[UIColor colorWithWhite:0.0f alpha:0.09f],
nil];
[container addSubview:topShadow];

// Bottom shadow
SSGradientView *bottomShadow = [[SSGradientView alloc] initWithFrame:CGRectMake(0.0f, cellHeight + topShadowHeight, size.width, bottomShadowHeight)];
bottomShadow.backgroundColor = [UIColor clearColor];
bottomShadow.alpha = 0.0f;
bottomShadow.colors = [NSArray arrayWithObjects:
[UIColor colorWithWhite:0.0f alpha:0.13f],
[UIColor colorWithWhite:0.0f alpha:0.0f],
nil];
[container addSubview:bottomShadow];

// Background
SSBorderedView *background = [[SSBorderedView alloc] initWithFrame:CGRectMake(0.0f, topShadowHeight, size.width, cellHeight)];
background.backgroundColor = [UIColor whiteColor];
background.bottomBorderColor = [UIColor colorWithWhite:0.92f alpha:1.0f];
background.contentMode = UIViewContentModeRedraw;
[container addSubview:background];

// Checkbox
UIImageView *checkbox = [[UIImageView alloc] initWithImage:[[UIImage imageNamed:@"checkbox.png"] stretchableImageWithLeftCapWidth:4 topCapHeight:4]];
checkbox.frame = CGRectMake(-34.0f, 13.0f, 24.0f, 24.0f);
[background addSubview:checkbox];

// Label
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(16.0f, 7.0f, size.width - 32.0f, 38.0f)];
label.font = [UIFont cheddarFontOfSize:18.0f];
label.textColor = [UIColor cheddarTextColor];
label.backgroundColor = [UIColor clearColor];
label.text = self.title;
[background addSubview:label];

// Adjust point
point.y = fminf(point.y, size.height);

// Animate
UIViewAnimationOptions options = UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionAllowUserInteraction;
[UIView animateWithDuration:0.2 delay:0.0 options:options animations:^{
container.alpha = 1.0f;
} completion:nil];

NSTimeInterval boxDuration = 0.2f;
NSTimeInterval moveDuration = fmax(0.2, 0.3 * (point.y / height));

[UIView animateWithDuration:boxDuration delay:0.10 options:options animations:^{
topShadow.alpha = 1.0f;
bottomShadow.alpha = 1.0f;

CGRect frame = checkbox.frame;
frame.origin.x = 10.0f;
checkbox.frame = frame;

label.frame = CGRectMake(44.0f, 13.0f, size.width - 54.0f, 24.0f);
label.font = [UIFont cheddarFontOfSize:20.0f];

frame = container.frame;
frame.origin.y += 20.0f;
container.frame = frame;
} completion:^(BOOL finished) {
[UIView animateWithDuration:moveDuration delay:0.0 options:options animations:^{
CGRect frame = container.frame;
frame.origin.y = point.y - topShadowHeight;
container.frame = frame;
} completion:^(BOOL finished) {
if (insertTask) {
insertTask();
}
}];

[UIView animateWithDuration:0.2 delay:moveDuration options:options animations:^{
container.alpha = 0.0f;
} completion:^(BOOL finished) {
if (completion) {
completion();
}
}];
}];
}

@end
44 changes: 44 additions & 0 deletions Classes/CDIAddTaskView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// CDIAddTaskView.h
// Cheddar for iOS
//
// Created by Sam Soffes on 4/16/12.
// Copyright (c) 2012 Nothing Magical. All rights reserved.
//

@protocol CDIAddTaskViewDelegate;

@interface CDIAddTaskView : UIView

@property (nonatomic, weak) id<CDIAddTaskViewDelegate> delegate;
@property (nonatomic, strong, readonly) SSTextField *textField;
@property (nonatomic, strong, readonly) SSGradientView *shadowView;
@property (nonatomic, strong, readonly) UIButton *renameListButton;
@property (nonatomic, strong, readonly) UIButton *archiveTasksButton;
@property (nonatomic, strong, readonly) UIButton *archiveAllTasksButton;
@property (nonatomic, strong, readonly) UIButton *archiveCompletedTasksButton;
@property (nonatomic, assign) BOOL editing;

+ (CGFloat)height;
+ (CGFloat)margin;
- (void)setEditing:(BOOL)editing animated:(BOOL)animated;

- (void)showTag:(NSString *)tagName;
- (void)hideTag;

@end


@protocol CDIAddTaskViewDelegate <NSObject>

@required

- (void)addTaskView:(CDIAddTaskView *)addTaskView didReturnWithTitle:(NSString *)title;

@optional

- (void)addTaskViewDidBeginEditing:(CDIAddTaskView *)addTaskView;
- (void)addTaskViewDidEndEditing:(CDIAddTaskView *)addTaskView;
- (void)addTaskViewShouldCloseTag:(CDIAddTaskView *)addTaskView;

@end
Loading

0 comments on commit c88307d

Please sign in to comment.