From 06fcd32c074dd7413d54d1025276040128264fdf Mon Sep 17 00:00:00 2001 From: Eddie Ehlin Date: Sat, 23 Feb 2013 18:53:37 +0100 Subject: Initial version of the extraction timer for bean collection (drop-down style). --- iBean/iBean.xcodeproj/project.pbxproj | 4 + .../UserInterfaceState.xcuserstate | Bin 49744 -> 51543 bytes iBean/iBean/.DS_Store | Bin 6148 -> 6148 bytes .../iBean/BeanCollectionExtractionViewController.h | 4 +- .../iBean/BeanCollectionExtractionViewController.m | 57 ++++++++++++- .../ibean-extraction-dropdown-background.png | Bin 0 -> 81326 bytes .../ibean-extraction-dropdown-background.pxm | Bin 0 -> 201374 bytes iBean/iBean/iPhoneStoryboard.storyboard | 92 ++++++++++++++------- 8 files changed, 124 insertions(+), 33 deletions(-) create mode 100644 iBean/iBean/Graphics/ibean-extraction-dropdown-background.png create mode 100644 iBean/iBean/Graphics/ibean-extraction-dropdown-background.pxm diff --git a/iBean/iBean.xcodeproj/project.pbxproj b/iBean/iBean.xcodeproj/project.pbxproj index 3cabdce..f2f8088 100644 --- a/iBean/iBean.xcodeproj/project.pbxproj +++ b/iBean/iBean.xcodeproj/project.pbxproj @@ -37,6 +37,7 @@ 024CB03716C2EF10009CBC15 /* UITableView+Extra.m in Sources */ = {isa = PBXBuildFile; fileRef = 024CB03616C2EF10009CBC15 /* UITableView+Extra.m */; }; 024CB03916C2EFD5009CBC15 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 024CB03816C2EFD5009CBC15 /* QuartzCore.framework */; }; 024CC6B016D0F33200F84F3D /* Threshold.m in Sources */ = {isa = PBXBuildFile; fileRef = 024CC6AF16D0F33200F84F3D /* Threshold.m */; }; + 024CC6EB16D6B36000F84F3D /* ibean-extraction-dropdown-background.png in Resources */ = {isa = PBXBuildFile; fileRef = 024CC6EA16D6B36000F84F3D /* ibean-extraction-dropdown-background.png */; }; 024F676D16A4A61D004A1201 /* InstantExtractionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 024F676C16A4A61D004A1201 /* InstantExtractionViewController.m */; }; 0276253916B58D6000EE2F4E /* SettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0276253816B58D6000EE2F4E /* SettingsViewController.m */; }; 0276253C16B59E4C00EE2F4E /* Configuration.m in Sources */ = {isa = PBXBuildFile; fileRef = 0276253B16B59E4C00EE2F4E /* Configuration.m */; }; @@ -98,6 +99,7 @@ 024CB03816C2EFD5009CBC15 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 024CC6AE16D0F33200F84F3D /* Threshold.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Threshold.h; sourceTree = ""; }; 024CC6AF16D0F33200F84F3D /* Threshold.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Threshold.m; sourceTree = ""; }; + 024CC6EA16D6B36000F84F3D /* ibean-extraction-dropdown-background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "ibean-extraction-dropdown-background.png"; path = "Graphics/ibean-extraction-dropdown-background.png"; sourceTree = ""; }; 024F676B16A4A61D004A1201 /* InstantExtractionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InstantExtractionViewController.h; sourceTree = ""; }; 024F676C16A4A61D004A1201 /* InstantExtractionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InstantExtractionViewController.m; sourceTree = ""; }; 0276253716B58D6000EE2F4E /* SettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsViewController.h; sourceTree = ""; }; @@ -319,6 +321,7 @@ 024CB02216C0543B009CBC15 /* Graphics */ = { isa = PBXGroup; children = ( + 024CC6EA16D6B36000F84F3D /* ibean-extraction-dropdown-background.png */, 023AAB3D16C98B2A00B6886C /* ibean-beancell-bean.png */, ); name = Graphics; @@ -409,6 +412,7 @@ 020C55B01691014E00D8224C /* Default-568h@2x.png in Resources */, 020C55BD169101FB00D8224C /* iPhoneStoryboard.storyboard in Resources */, 023AAB3E16C98B2A00B6886C /* ibean-beancell-bean.png in Resources */, + 024CC6EB16D6B36000F84F3D /* ibean-extraction-dropdown-background.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate b/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate index f76b034..ca9b272 100644 Binary files a/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate and b/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/iBean/iBean/.DS_Store b/iBean/iBean/.DS_Store index 00a4276..e72bc32 100644 Binary files a/iBean/iBean/.DS_Store and b/iBean/iBean/.DS_Store differ diff --git a/iBean/iBean/BeanCollectionExtractionViewController.h b/iBean/iBean/BeanCollectionExtractionViewController.h index 88c8e92..79388f0 100644 --- a/iBean/iBean/BeanCollectionExtractionViewController.h +++ b/iBean/iBean/BeanCollectionExtractionViewController.h @@ -27,8 +27,10 @@ @property (weak, nonatomic) IBOutlet UITextView *beanCollectionNoteTextView; @property (weak, nonatomic) IBOutlet UILabel *extractionProgressLabel; @property (weak, nonatomic) IBOutlet UIButton *extractionButton; +@property (weak, nonatomic) IBOutlet UIView *extractionTimerView; +@property (weak, nonatomic) IBOutlet UIBarButtonItem *toggleExtractionTimerButton; /* UI Actions */ - (IBAction) startExtraction:(id)sender; - +- (IBAction) showExtractionTimer:(id)sender; @end diff --git a/iBean/iBean/BeanCollectionExtractionViewController.m b/iBean/iBean/BeanCollectionExtractionViewController.m index 7eeb574..21c27ba 100644 --- a/iBean/iBean/BeanCollectionExtractionViewController.m +++ b/iBean/iBean/BeanCollectionExtractionViewController.m @@ -13,6 +13,7 @@ #import "AppDelegate+Storage.h" #import "UITableView+Extra.h" #import "UIColor+Extra.h" +#import @interface BeanCollectionExtractionViewController () @@ -33,6 +34,10 @@ { [super viewDidLoad]; // Do any additional setup after loading the view. + + //Bring the extraction timer view on top + [self.view bringSubviewToFront:self.extractionTimerView]; + //[self.beanCollectionNoteTextView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed: @"textview-bg.png"]]]; } @@ -65,7 +70,10 @@ if (self.beanCollection != nil) { self.navigationItem.title = self.beanCollection.name; - self.extractionProgressLabel.text = [self.beanCollection.extractionTime stringValue]; + self.extractionProgressLabel.text = [NSString stringWithFormat:@"%1.1f", [self.beanCollection.extractionTime doubleValue]]; + + //Make sure that extraction button always is non-toggled when entering the view. + self.toggleExtractionTimerButton.style = UIBarButtonItemStylePlain; if (![self.beanCollection.note isEqualToString:@""]) { @@ -124,8 +132,8 @@ NSLog(@"BeanCollectionExtractionViewController - timerInterrupted"); //Return UI to "Start extraction" state. - [self.extractionButton setTitle:@"Start extraction" forState:UIControlStateNormal]; - self.extractionProgressLabel.text = [self.beanCollection.extractionTime stringValue]; + [self.extractionButton setTitle:@"Start" forState:UIControlStateNormal]; + self.extractionProgressLabel.text = [NSString stringWithFormat:@"%1.1f", [self.beanCollection.extractionTime doubleValue]]; self.extractionInProgress = NO; } @@ -140,7 +148,7 @@ if ([(AppDelegate*) [[UIApplication sharedApplication] delegate] getTimer] == nil || self.extractionInProgress == NO) { self.extractionProgress = [self.beanCollection.extractionTime doubleValue]; - [self.extractionButton setTitle:@"Stop extraction" forState:UIControlStateNormal]; + [self.extractionButton setTitle:@"Stop" forState:UIControlStateNormal]; self.extractionInProgress = YES; [(AppDelegate*) [[UIApplication sharedApplication] delegate] createTimer:self :@selector(updateExtractionProgress) :nil :YES]; @@ -151,6 +159,47 @@ } } +- (void) showExtractionTimer:(id)sender +{ + [UIView animateWithDuration:0.2f delay: 0.0f options: UIViewAnimationOptionCurveEaseInOut + animations:^{ + if (self.extractionTimerView.frame.origin.y < 0) + { + self.toggleExtractionTimerButton.style = UIBarButtonItemStyleDone; + //Slide in + self.extractionTimerView.frame = CGRectMake( + self.extractionTimerView.frame.origin.x, + 0.0, + self.extractionTimerView.frame.size.width, + self.extractionTimerView.frame.size.height); + + //Drop shadow + [self.extractionTimerView.layer setShadowColor:[UIColor blackColor].CGColor]; + [self.extractionTimerView.layer setShadowOpacity:0.8]; + [self.extractionTimerView.layer setShadowRadius:3.0]; + [self.extractionTimerView.layer setShadowOffset:CGSizeMake(2.0, 2.0)]; + } + else + { + self.toggleExtractionTimerButton.style = UIBarButtonItemStylePlain; + //Slide out + self.extractionTimerView.frame = CGRectMake( + self.extractionTimerView.frame.origin.x, + self.extractionTimerView.frame.size.height * -1, + self.extractionTimerView.frame.size.width, + self.extractionTimerView.frame.size.height); + //Remove shadow + //[self.extractionTimerView.layer setShadowOpacity:0.0]; + [self.extractionTimerView.layer setShadowRadius:0.0]; + [self.extractionTimerView.layer setShadowOffset:CGSizeMake(0.0, 0.0)]; + } + } + completion:^(BOOL finished){ + NSLog(@"Anim done!"); + } + ]; +} + /***************************************************** Delegates *****************************************************/ diff --git a/iBean/iBean/Graphics/ibean-extraction-dropdown-background.png b/iBean/iBean/Graphics/ibean-extraction-dropdown-background.png new file mode 100644 index 0000000..07b0dd6 Binary files /dev/null and b/iBean/iBean/Graphics/ibean-extraction-dropdown-background.png differ diff --git a/iBean/iBean/Graphics/ibean-extraction-dropdown-background.pxm b/iBean/iBean/Graphics/ibean-extraction-dropdown-background.pxm new file mode 100644 index 0000000..a84fc61 Binary files /dev/null and b/iBean/iBean/Graphics/ibean-extraction-dropdown-background.pxm differ diff --git a/iBean/iBean/iPhoneStoryboard.storyboard b/iBean/iBean/iPhoneStoryboard.storyboard index c23e3fc..5856bcd 100644 --- a/iBean/iBean/iPhoneStoryboard.storyboard +++ b/iBean/iBean/iPhoneStoryboard.storyboard @@ -1101,13 +1101,54 @@ + + + + + + + + + + + + + + + + + + - @@ -1186,51 +1227,42 @@ + - - + - - - + - - - - - - + + + + + + - + + + + + - - + + + + @@ -1260,6 +1292,7 @@ + @@ -1302,11 +1335,14 @@ + + + -- cgit v1.2.3