Skip to content

Christella_Ayuna_Time_Project_Submission #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 108 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
98aa91a
created UI layout for main screen, stopwatch and timer
ayunav Aug 22, 2015
3b99670
added files
cdolm92 Aug 23, 2015
594b0d2
updated UI for Timer
ayunav Aug 23, 2015
4631f06
Merge branch 'master' of https://github.com/ayunav/unit-1-final-project
ayunav Aug 23, 2015
e59cec1
just a commit to push. No major changes
ayunav Aug 23, 2015
128e32d
added segue from Timer VC to Preset Timer VC
ayunav Aug 23, 2015
5c376f8
work on stopwatch label
cdolm92 Aug 23, 2015
8717c43
working on stopwatch
cdolm92 Aug 24, 2015
757a52a
stopwatch start button works
cdolm92 Aug 25, 2015
a8ffaa5
fix small syntax error in header file
Aug 25, 2015
d791f8f
Merge pull request #1 from cspickert/master
ayunav Aug 25, 2015
a4201a9
changed stopwatch code
cdolm92 Aug 26, 2015
3ab08fe
working on laps
cdolm92 Aug 29, 2015
d50a138
fix
cdolm92 Aug 29, 2015
b879920
Fixing lap button crash
cdolm92 Aug 29, 2015
1d705a6
More lap changes. Still crashes
cdolm92 Aug 29, 2015
af870da
CD layout
cdolm92 Aug 30, 2015
2a0ed1d
starting over
cdolm92 Aug 31, 2015
a4fd798
work on button starts
cdolm92 Aug 31, 2015
1e9a37a
start button works
cdolm92 Aug 31, 2015
64c917f
lapreset button work
cdolm92 Aug 31, 2015
ac5afa1
set buttons on autolayout
cdolm92 Aug 31, 2015
7c3671e
remove some ints
cdolm92 Aug 31, 2015
7ffc019
refactored a bit
cdolm92 Aug 31, 2015
9b9dc18
deleted uneeded files
cdolm92 Aug 31, 2015
592ab2b
added to countdown
cdolm92 Aug 31, 2015
197989e
setting countdown up
cdolm92 Aug 31, 2015
220b2a1
working on buttons
cdolm92 Sep 1, 2015
7443e66
added laps
cdolm92 Sep 1, 2015
280cbc9
update
cdolm92 Sep 1, 2015
f1cef2a
added
cdolm92 Sep 1, 2015
897f491
working on reset
cdolm92 Sep 1, 2015
2b91760
more on reset
cdolm92 Sep 1, 2015
fa87986
lap displays now
cdolm92 Sep 1, 2015
dbbe125
fixed a start button glitch
cdolm92 Sep 1, 2015
6ce5ec4
added view for countdown
cdolm92 Sep 1, 2015
ccc4458
added the view files
cdolm92 Sep 1, 2015
715c16f
setup countdown views
cdolm92 Sep 1, 2015
9f50d67
added few lines of code in Timer VC.m and added a label over the date…
ayunav Aug 23, 2015
2342bf3
made the buttons start and pause round
ayunav Aug 23, 2015
aeacf80
fixed UI for Timer VC
ayunav Aug 23, 2015
8c22a31
set the image for countdown tab but needs to be resized to display pr…
ayunav Aug 24, 2015
042593a
added navigation controller to TimerVC UI, and it works.
ayunav Aug 24, 2015
f666d01
added code for tableview in TimerVC to display the strings for the ex…
ayunav Aug 24, 2015
398335b
added properties for label, date picker view, and buttons in the Time…
ayunav Aug 24, 2015
8044069
current state. Working on the code for TimerVC. Committing changes be…
ayunav Aug 25, 2015
9f150e4
code with comments. TableView in TimerVC doesn't display the strings …
ayunav Aug 25, 2015
8199d12
Fixed countdown tab bar image to be appropriate size when running the…
ayunav Aug 25, 2015
3543860
minor changes to storyboard
ayunav Aug 26, 2015
4f5dbfc
added changes to NSTimer code in TimerVC
ayunav Aug 26, 2015
5a25b07
added code for NSTimer, viewDidLoad method, timerFired, and buttons S…
ayunav Aug 27, 2015
8959497
fixed cancel timer button issue. Works properly now.
ayunav Aug 27, 2015
bf55563
fixed UI for start/cancel & pause/resume buttons in TimerVC.
ayunav Aug 27, 2015
7f1f2a8
commit to push before creating a new branch to experiment with a NSDa…
ayunav Aug 28, 2015
9aad749
changes in main.Storyboard. Changed UI for New Timer VC and Preset Ti…
ayunav Aug 28, 2015
079d039
commit to push before creating a new branch timerClass-branch. No maj…
ayunav Aug 28, 2015
61782a2
Added files for CQTimer class and some properties to it.
ayunav Aug 29, 2015
c4e899b
Added methods in the CQNewTimerViewController files.
ayunav Aug 29, 2015
415a8ab
commit to push. No major changes.
ayunav Aug 29, 2015
6c99ef2
small changes. Pushing to commit before lunch break.
ayunav Aug 29, 2015
274108d
lots of changes. Some things work. Want to push it before I break eve…
ayunav Aug 29, 2015
eb83885
few minor changes. Fixed up storyboard and cleaned up the code.
ayunav Aug 29, 2015
df3a92f
added methods to pass data to CQPresetTimerVC.
ayunav Aug 29, 2015
597648d
Cleaned the code and fixed the issue with timerTitleLabel in the Pres…
ayunav Aug 29, 2015
d004f92
non working changes.
ayunav Aug 29, 2015
3f32405
the PresetTimerVC doens't display the timerDuration of the TimerObjec…
ayunav Aug 30, 2015
abb9e62
fixed timer issue for setting timer to an uneven number like 2 min 45…
ayunav Aug 30, 2015
2af88f8
starting work on adding sounds to the project. Commit before checking…
ayunav Aug 31, 2015
f813f8a
Added audioPlayer methods to play a sound when the timer is up. Every…
ayunav Aug 31, 2015
e90b505
Added demo timer that is 5 sec long. Works.
ayunav Sep 1, 2015
d1080a8
No major changes. Commit to push before checking out to master branch.
ayunav Sep 1, 2015
58e1e23
everything is working. merged code
ayunav Sep 1, 2015
0200d4f
changed UI. Minor update.
ayunav Sep 1, 2015
077dc8e
uitextfield
cdolm92 Sep 2, 2015
d994fce
setting up model for cdevents
cdolm92 Sep 2, 2015
9944678
initialize event name
cdolm92 Sep 2, 2015
64811fd
saveButton Method work
cdolm92 Sep 2, 2015
549bf32
made storyboard changes and save button
cdolm92 Sep 2, 2015
7fac530
adding to cdview with table view
cdolm92 Sep 2, 2015
a4e3c03
code is broken
cdolm92 Sep 2, 2015
8d0dffd
fixed run app error
cdolm92 Sep 2, 2015
033a31e
keeping up to date
cdolm92 Sep 2, 2015
f752abe
added sound picker view to the new timer vc, timer vc & preset timer …
ayunav Sep 3, 2015
bc247d1
Merge branch 'soundPickerView-branch'
ayunav Sep 3, 2015
99dd7c9
Added a method to play a sound when it is selected at the sound picke…
ayunav Sep 3, 2015
d613376
Added a vibration method when timer is up.
ayunav Sep 3, 2015
99237fc
added vibration methods to all vc's.
ayunav Sep 3, 2015
dfbe585
No major changes. Commit to push.
ayunav Sep 3, 2015
5839829
reworking cd
cdolm92 Sep 3, 2015
bcbda6a
tableview
cdolm92 Sep 3, 2015
31e1d18
new Event button
cdolm92 Sep 3, 2015
b465972
add to array delegate
cdolm92 Sep 3, 2015
da6e24c
starting on showcdvc
cdolm92 Sep 3, 2015
6bf948c
save button
cdolm92 Sep 3, 2015
22bf7c7
uichanges app still not passing data
cdolm92 Sep 3, 2015
86486b2
added some things
cdolm92 Sep 3, 2015
5ca5af5
not working
cdolm92 Sep 3, 2015
e7f9ad4
working
cdolm92 Sep 3, 2015
1def6be
ui stuff
cdolm92 Sep 3, 2015
86244bb
more ui
cdolm92 Sep 3, 2015
14cd8ce
enabling buttons
cdolm92 Sep 3, 2015
ff8f7e6
No major changes. Commit to push before creating new branch to work o…
ayunav Sep 3, 2015
9a9bc83
Major changes to UI for Timer VC, Preset Timer VC, New Timer VC to di…
ayunav Sep 3, 2015
78039b3
user input passes :D
cdolm92 Sep 3, 2015
210002e
title passes
cdolm92 Sep 3, 2015
2ca0bd5
almost done
cdolm92 Sep 3, 2015
055482f
ui changes
cdolm92 Sep 3, 2015
72fe2c3
date left out
cdolm92 Sep 3, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 158 additions & 24 deletions Time/Time.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions Time/Time/AddCDViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// AddCDViewController.h
// Time
//
// Created by Christella on 9/1/15.
// Copyright (c) 2015 Mike Kavouras. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "CDEvents.h"

@interface AddCDViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>

@property (nonatomic) CDEvents *eventObject;


@end
105 changes: 105 additions & 0 deletions Time/Time/AddCDViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
//
// AddCDViewController.m
// Time
//
// Created by Christella on 9/1/15.
// Copyright (c) 2015 Mike Kavouras. All rights reserved.
//

#import "AddCDViewController.h"
#import "CDEvents.h"
#import "CDViewController.h"
#import "ShowCDViewController.h"


@interface AddCDViewController ()<NewEventDelegate>


@property (weak, nonatomic) IBOutlet UITableView *eventsView;
@property (nonatomic) NSMutableArray *userEvents;



@end

@implementation AddCDViewController

//Delete Action

- (void)viewDidLoad {
[super viewDidLoad];

self.title = @"Your Countdowns";
self.userEvents = [[NSMutableArray alloc] init];

}


#pragma mark Table View Methods

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

return self.userEvents.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

UITableViewCell *cell = [self.eventsView dequeueReusableCellWithIdentifier:@"eventCellIdentifier" forIndexPath:indexPath];

CDEvents *eventTemp;
eventTemp = [self.userEvents objectAtIndex:indexPath.row];

cell.textLabel.text = eventTemp.userEventTitle;

return cell;
}


#pragma mark New Event Button

- (IBAction)newEvent:(UIBarButtonItem *)sender {


if([sender.title isEqualToString:@"New Event"]){

CDViewController *newEventVC = [self.storyboard instantiateViewControllerWithIdentifier:@"NewEventViewController"];
newEventVC.delegate = self;
[self.navigationController pushViewController:newEventVC animated:YES];
}

}

#pragma mark - Delegate methods

- (void) addToTheArrayNewEvent:(CDEvents *)newEvent {
[self.userEvents addObject:newEvent];
[self.eventsView reloadData];
}


#pragma mark - didSelectRowAtIndexPath

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

ShowCDViewController *cdEventsVC= [self.storyboard instantiateViewControllerWithIdentifier:@"CDEventsViewController"];

CDEvents *eventObject = self.userEvents[indexPath.row];

//pass the CQTimer timerObject to the next VC
cdEventsVC.eventObject = eventObject;


[self.navigationController pushViewController:cdEventsVC animated:YES];
}





@end
18 changes: 6 additions & 12 deletions Time/Time/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,32 @@

#import "AppDelegate.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
return YES;
return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.

}

- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.

}

- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.

}

- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.

}

- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.

}

@end
25 changes: 0 additions & 25 deletions Time/Time/Base.lproj/Main.storyboard

This file was deleted.

24 changes: 24 additions & 0 deletions Time/Time/CDEvents.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// CDEvents.h
// Time
//
// Created by Christella on 9/2/15.
// Copyright (c) 2015 Mike Kavouras. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface CDEvents : NSObject

@property (nonatomic) CDEvents *eventObject;

@property (nonatomic) NSMutableArray *userEvents;

@property (nonatomic) NSString *userEventTitle;

@property (nonatomic) NSString *userEventDay;

@property (nonatomic) NSDate *date;


@end
16 changes: 16 additions & 0 deletions Time/Time/CDEvents.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// CDEvents.m
// Time
//
// Created by Christella on 9/2/15.
// Copyright (c) 2015 Mike Kavouras. All rights reserved.
//

#import "CDEvents.h"



@implementation CDEvents


@end
34 changes: 34 additions & 0 deletions Time/Time/CDViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// CDViewController.h
// Time
//
// Created by Christella on 8/31/15.
// Copyright (c) 2015 Mike Kavouras. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "CDEvents.h"



@protocol NewEventDelegate <NSObject>

-(void) addToTheArrayNewEvent:(CDEvents *)newEvent;



@end

@interface CDViewController : UIViewController


@property (nonatomic, weak) id <NewEventDelegate> delegate;

@property (nonatomic) NSString *cdEventTitle;




- (IBAction)startCountdown:(id)sender;

@end
102 changes: 102 additions & 0 deletions Time/Time/CDViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
//
// CDViewController.m
// Time
//
// Created by Christella on 8/31/15.
// Copyright (c) 2015 Mike Kavouras. All rights reserved.
//

#import "CDViewController.h"
#import "CDEvents.h"
#import "AddCDViewController.h"


@interface CDViewController ()


@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UITextField *countdownTitle;


@property (weak, nonatomic) IBOutlet UIDatePicker *datePicker;
@property (weak, nonatomic) IBOutlet UILabel *countdownLabel;

@property (weak, nonatomic) IBOutlet UILabel *eventDisplayed;




@end

@implementation CDViewController

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}



- (IBAction)startCountdown:(id)sender {

//Remove the time component from the datePicker. We care only about the date
NSCalendar *calendar = [NSCalendar autoupdatingCurrentCalendar];
NSUInteger preservedComponents = (NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay);
self.datePicker.date = [calendar dateFromComponents:[calendar components:preservedComponents fromDate:self.datePicker.date]];

//Set up a timer that calls the updateTime method every second to update the label
NSTimer *timer;
timer = [NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:@selector(updateTime)
userInfo:nil
repeats:YES];
}

-(void)updateTime
{
//Get the time left until the specified date
NSInteger ti = ((NSInteger)[self.datePicker.date timeIntervalSinceNow]);
NSInteger seconds = ti % 60;
NSInteger minutes = (ti / 60) % 60;
NSInteger hours = (ti / 3600) % 24;
NSInteger days = (ti / 86400);

//Update the label with the remaining time
self.countdownLabel.text = [NSString stringWithFormat:@"%02li days %02li hrs %02li min %02li sec", (long)days, (long)hours, (long)minutes, (long)seconds];

NSDate *myDate = self.datePicker.date;

NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"cccc, MMM d, hh:mm aa"];
NSString *theEventDate = [dateFormat stringFromDate:myDate];

self.eventDisplayed.text = theEventDate;
}

- (IBAction)saveButton:(id)sender {
CDEvents *newEvent = [[CDEvents alloc] init];
newEvent.userEventTitle = self.countdownTitle.text;
newEvent.date = self.datePicker.date;


[self.delegate addToTheArrayNewEvent: newEvent];

NSLog(@"%@", newEvent);

[self.navigationController popToRootViewControllerAnimated:YES];

}







@end
Loading