From 59dfbc4d74ff26e81607f6019abcaa8a154eab29 Mon Sep 17 00:00:00 2001 From: Kyle Fang Date: Mon, 25 Feb 2013 21:53:21 +0800 Subject: [PATCH] Added VC to the AppDelegate --- Progress.xcodeproj/project.pbxproj | 10 ++ Progress/PPAppDelegate.m | 6 +- Progress/PPRemindersViewController.h | 13 +++ Progress/PPRemindersViewController.m | 125 +++++++++++++++++++++++++ Progress/Progress-Info.plist | 2 + Progress/Progress.nss | 127 ++++++++++++++++++++++++++ Progress/en.lproj/Progress.storyboard | 89 ++++++++++++++++-- Progress/main.m | 2 +- 8 files changed, 365 insertions(+), 9 deletions(-) create mode 100644 Progress/PPRemindersViewController.h create mode 100644 Progress/PPRemindersViewController.m create mode 100644 Progress/Progress.nss diff --git a/Progress.xcodeproj/project.pbxproj b/Progress.xcodeproj/project.pbxproj index 7fe3978..d04f846 100644 --- a/Progress.xcodeproj/project.pbxproj +++ b/Progress.xcodeproj/project.pbxproj @@ -13,6 +13,8 @@ 044C661516AFE28100F9BC1E /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 044C661416AFE28100F9BC1E /* Icon@2x.png */; }; 044C661816AFE29F00F9BC1E /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 044C661716AFE29F00F9BC1E /* Icon.png */; }; 0486284C16B000D700F62384 /* Progress.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 0486284A16B000D700F62384 /* Progress.xcdatamodeld */; }; + 048D433D16DB9BA400A40CB1 /* Progress.nss in Resources */ = {isa = PBXBuildFile; fileRef = 048D433C16DB9BA400A40CB1 /* Progress.nss */; }; + 048D434016DB9D5400A40CB1 /* PPRemindersViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 048D433F16DB9D5400A40CB1 /* PPRemindersViewController.m */; }; 04BDDEC516902D0900D04A9E /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04BDDEC416902D0900D04A9E /* UIKit.framework */; }; 04BDDEC716902D0900D04A9E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04BDDEC616902D0900D04A9E /* Foundation.framework */; }; 04BDDEC916902D0900D04A9E /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04BDDEC816902D0900D04A9E /* CoreGraphics.framework */; }; @@ -54,6 +56,9 @@ 044C661416AFE28100F9BC1E /* Icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon@2x.png"; path = "../Icon@2x.png"; sourceTree = ""; }; 044C661716AFE29F00F9BC1E /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon.png; path = ../Icon.png; sourceTree = ""; }; 0486284B16B000D700F62384 /* Progress.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Progress.xcdatamodel; sourceTree = ""; }; + 048D433C16DB9BA400A40CB1 /* Progress.nss */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Progress.nss; sourceTree = ""; }; + 048D433E16DB9D5300A40CB1 /* PPRemindersViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PPRemindersViewController.h; sourceTree = ""; }; + 048D433F16DB9D5400A40CB1 /* PPRemindersViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PPRemindersViewController.m; sourceTree = ""; }; 04BDDEC016902D0900D04A9E /* Progress.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Progress.app; sourceTree = BUILT_PRODUCTS_DIR; }; 04BDDEC416902D0900D04A9E /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 04BDDEC616902D0900D04A9E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; @@ -153,6 +158,8 @@ 04BDDECA16902D0900D04A9E /* Progress */ = { isa = PBXGroup; children = ( + 048D433E16DB9D5300A40CB1 /* PPRemindersViewController.h */, + 048D433F16DB9D5400A40CB1 /* PPRemindersViewController.m */, 04FD824516DB02910028AF2A /* GVUserDefaults+Progress.h */, 04FD824616DB02910028AF2A /* GVUserDefaults+Progress.m */, 04FD824016DAFB770028AF2A /* PPEvenKitManager.h */, @@ -177,6 +184,7 @@ 04BDDECC16902D0900D04A9E /* Progress-Info.plist */, 04BDDECD16902D0900D04A9E /* InfoPlist.strings */, 04BDDED016902D0900D04A9E /* main.m */, + 048D433C16DB9BA400A40CB1 /* Progress.nss */, 04BDDED216902D0900D04A9E /* Progress-Prefix.pch */, 04BDDED616902D0900D04A9E /* Default.png */, 04BDDED816902D0900D04A9E /* Default@2x.png */, @@ -287,6 +295,7 @@ 04BDDEDE16902D0900D04A9E /* Progress.storyboard in Resources */, 044C661516AFE28100F9BC1E /* Icon@2x.png in Resources */, 044C661816AFE29F00F9BC1E /* Icon.png in Resources */, + 048D433D16DB9BA400A40CB1 /* Progress.nss in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -355,6 +364,7 @@ 0486284C16B000D700F62384 /* Progress.xcdatamodeld in Sources */, 04FD824216DAFB770028AF2A /* PPEvenKitManager.m in Sources */, 04FD824716DB02910028AF2A /* GVUserDefaults+Progress.m in Sources */, + 048D434016DB9D5400A40CB1 /* PPRemindersViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Progress/PPAppDelegate.m b/Progress/PPAppDelegate.m index fb124e7..4f1d6e6 100644 --- a/Progress/PPAppDelegate.m +++ b/Progress/PPAppDelegate.m @@ -31,9 +31,13 @@ [[GAI sharedInstance] trackerWithTrackingId:@"UA-37324298-1"]; [[PPEvenKitManager sharedManager] setupEventManagerWithCompletionBlock:^(BOOL success) { + UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Progress" bundle:nil]; if (success) { - NSLog(@"success"); + UIViewController *reminedrsVC = [storyBoard instantiateViewControllerWithIdentifier:@"Reminders"]; + self.window.rootViewController = reminedrsVC; } else { + UIViewController *accessDenyVC = [storyBoard instantiateViewControllerWithIdentifier:@"AccessDeny"]; + self.window.rootViewController = accessDenyVC; NSLog(@"failed"); } }]; diff --git a/Progress/PPRemindersViewController.h b/Progress/PPRemindersViewController.h new file mode 100644 index 0000000..0b11b0e --- /dev/null +++ b/Progress/PPRemindersViewController.h @@ -0,0 +1,13 @@ +// +// PPRemindersViewController.h +// Progress +// +// Created by Kyle Fang on 2/25/13. +// Copyright (c) 2013 kylefang. All rights reserved. +// + +#import + +@interface PPRemindersViewController : UITableViewController + +@end diff --git a/Progress/PPRemindersViewController.m b/Progress/PPRemindersViewController.m new file mode 100644 index 0000000..4c2ff70 --- /dev/null +++ b/Progress/PPRemindersViewController.m @@ -0,0 +1,125 @@ +// +// PPRemindersViewController.m +// Progress +// +// Created by Kyle Fang on 2/25/13. +// Copyright (c) 2013 kylefang. All rights reserved. +// + +#import "PPRemindersViewController.h" +#import "PPEvenKitManager.h" +#import + +@interface PPRemindersViewController () +@property (nonatomic) NSArray *remindersDatasource; +@end + +@implementation PPRemindersViewController + +- (id)initWithStyle:(UITableViewStyle)style +{ + self = [super initWithStyle:style]; + if (self) { + // Custom initialization + } + return self; +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.clearsSelectionOnViewWillAppear = NO; + self.navigationController.navigationBarHidden = YES; + +} + +- (void)viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; + [SVProgressHUD show]; + NSString *defaultReminderIdentifier = [[PPEvenKitManager sharedManager] defaultReminderListIdentifier]; + [[PPEvenKitManager sharedManager] getReminderItemsInListWithIdentifier:defaultReminderIdentifier includeCompleted:YES includeImcompleted:YES withCompletionBlock:^(NSArray *reminedrItems) { + self.remindersDatasource = reminedrItems; + [self.tableView reloadData]; + [SVProgressHUD dismiss]; + }]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +#pragma mark - Table view data source + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return self.remindersDatasource.count; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + static NSString *CellIdentifier = @"ReminderCell"; + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; + + EKReminder *reminder = [self.remindersDatasource objectAtIndex:indexPath.row]; + cell.textLabel.text = reminder.title; + cell.accessoryType = reminder.completed ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone; + + return cell; +} + +/* +// Override to support conditional editing of the table view. +- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath +{ + // Return NO if you do not want the specified item to be editable. + return YES; +} +*/ + +/* +// Override to support editing the table view. +- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath +{ + if (editingStyle == UITableViewCellEditingStyleDelete) { + // Delete the row from the data source + [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; + } + else if (editingStyle == UITableViewCellEditingStyleInsert) { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } +} +*/ + +/* +// Override to support rearranging the table view. +- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath +{ +} +*/ + +/* +// Override to support conditional rearranging of the table view. +- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath +{ + // Return NO if you do not want the item to be re-orderable. + return YES; +} +*/ + +#pragma mark - Table view delegate + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + // Navigation logic may go here. Create and push another view controller. + /* + <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil]; + // ... + // Pass the selected object to the new view controller. + [self.navigationController pushViewController:detailViewController animated:YES]; + */ +} + +@end diff --git a/Progress/Progress-Info.plist b/Progress/Progress-Info.plist index d2c0263..209bf13 100644 --- a/Progress/Progress-Info.plist +++ b/Progress/Progress-Info.plist @@ -45,6 +45,8 @@ armv7 + UIStatusBarHidden + UISupportedInterfaceOrientations UIInterfaceOrientationPortrait diff --git a/Progress/Progress.nss b/Progress/Progress.nss new file mode 100644 index 0000000..e194810 --- /dev/null +++ b/Progress/Progress.nss @@ -0,0 +1,127 @@ +@primaryFontName: AppleGothic; +@secondaryFontName: HelveticaNeue-Light; +@secondaryFontNameBold: HelveticaNeue; +@secondaryFontNameStrong: HelveticaNeue-Medium; +@inputFontName: HelveticaNeue; +@primaryFontColor: #555555; +@secondaryFontColor: #888888; +@primaryBackgroundColor: #E6E6E6; +@primaryBackgroundTintColor: #ECECEC; +@primaryBackgroundColorTop: #F3F3F3; +@primaryBackgroundColorBottom: #E6E6E6; +@primaryBackgroundColorBottomStrong: #DDDDDD; +@secondaryBackgroundColorTop: #FCFCFC; +@secondaryBackgroundColorBottom: #F9F9F9; +@primaryBorderColor: #A2A2A2; +@primaryBorderWidth: 1; + +BarButton { + background-color: @primaryBackgroundColor; + background-color-highlighted: #CCCCCC; + border-color: @primaryBorderColor; + border-width: @primaryBorderWidth; + corner-radius: 7; + font-name: @secondaryFontNameBold; + font-color: @primaryFontColor; + font-color-disabled: @secondaryFontColor; + font-size: 13; + text-shadow-color: clear; +} +CustomButton { + background-color-top: #FFFFFF; + background-color-bottom: @primaryBackgroundColorBottom; + border-color: @primaryBorderColor; + border-width: @primaryBorderWidth; + font-color: @primaryFontColor; + font-color-highlighted: @secondaryFontColor; + font-name: @secondaryFontName; + font-size: 18; + height: 37; + corner-radius: 7; +} +LargeButton { + height: 50; + font-size: 20; + corner-radius: 10; +} +SmallButton { + height: 24; + font-size: 14; + corner-radius: 5; +} +Label { + font-name: @secondaryFontName; + font-size: 20; + font-color: @primaryFontColor; + text-auto-fit: false; +} +LargeLabel { + font-size: 24; +} +SmallLabel { + font-size: 15; +} +NavigationBar { + font-name: @secondaryFontName; + font-size: 20; + font-color: @primaryFontColor; + text-shadow-color: clear; + background-color-top: @primaryBackgroundColorTop; + background-color-bottom: @primaryBackgroundColorBottomStrong; +} +SearchBar { + background-color-top: @primaryBackgroundColorTop; + background-color-bottom: @primaryBackgroundColorBottom; + scope-background-color: #FFFFFF; +} +SegmentedControl { + background-color: @primaryBackgroundColorTop; + background-color-selected: @primaryBackgroundColorBottomStrong; + border-color: @primaryBorderColor; + border-width: @primaryBorderWidth; + corner-radius: 7; + font-name: @secondaryFontNameBold; + font-size: 13; + font-color: @primaryFontColor; + text-shadow-color: clear; +} +Switch { + on-tint-color: @primaryBackgroundTintColor; +} +TabBar { + background-color-top: @primaryBackgroundColorTop; + background-color-bottom: @primaryBackgroundColorBottom; +} +TabBarItem { + font-name: @secondaryFontName; + font-color: @primaryFontColor; + font-size: 18; + text-offset: 0,-11; +} +TableCell { + background-color-top: @secondaryBackgroundColorTop; + background-color-bottom: @secondaryBackgroundColorBottom; + font-color: @primaryFontColor; + font-name: @secondaryFontNameBold; + font-size: 17; +} +TableCellDetail { + font-name: @secondaryFontName; + font-size: 14; + font-color: @secondaryFontColor; +} +TextField { + height: 37; + font-name: @inputFontName; + font-size: 18; + border-style: rounded; + vertical-align: center; +} +LargeTextField { + height: 50; + font-size: 28; +} +CustomView { + background-color: @primaryBackgroundColor; + background-image: NUIViewBackground.png; +} \ No newline at end of file diff --git a/Progress/en.lproj/Progress.storyboard b/Progress/en.lproj/Progress.storyboard index 9c0b3f9..dc47ba0 100644 --- a/Progress/en.lproj/Progress.storyboard +++ b/Progress/en.lproj/Progress.storyboard @@ -9,24 +9,99 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + \ No newline at end of file diff --git a/Progress/main.m b/Progress/main.m index 4205be2..b0fa612 100644 --- a/Progress/main.m +++ b/Progress/main.m @@ -13,7 +13,7 @@ int main(int argc, char *argv[]) { @autoreleasepool { - [NUISettings init]; + [NUISettings initWithStylesheet:@"Progress"]; return UIApplicationMain(argc, argv, nil, NSStringFromClass([PPAppDelegate class])); } }