aboutsummaryrefslogtreecommitdiffstats
path: root/iBean
diff options
context:
space:
mode:
Diffstat (limited to 'iBean')
-rw-r--r--iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstatebin37321 -> 39557 bytes
-rw-r--r--iBean/iBean.xcodeproj/xcuserdata/eddiex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist13
-rw-r--r--iBean/iBean/BeanCollectionExtractionViewController.h7
-rw-r--r--iBean/iBean/BeanCollectionExtractionViewController.m50
-rw-r--r--iBean/iBean/InstantExtractionViewController.h1
-rw-r--r--iBean/iBean/InstantExtractionViewController.m13
-rw-r--r--iBean/iBean/iPhoneStoryboard.storyboard6
7 files changed, 69 insertions, 21 deletions
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 7208623..c566724 100644
--- a/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate
+++ b/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate
Binary files differ
diff --git a/iBean/iBean.xcodeproj/xcuserdata/eddiex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/iBean/iBean.xcodeproj/xcuserdata/eddiex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
index e8320d9..75119b6 100644
--- a/iBean/iBean.xcodeproj/xcuserdata/eddiex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
+++ b/iBean/iBean.xcodeproj/xcuserdata/eddiex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
@@ -8,19 +8,6 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "iBean/InstantExtractionViewController.m"
- timestampString = "380496617.591403"
- startingColumnNumber = "9223372036854775807"
- endingColumnNumber = "9223372036854775807"
- startingLineNumber = "113"
- endingLineNumber = "113"
- landmarkName = "-startExtraction:"
- landmarkType = "5">
- </FileBreakpoint>
- <FileBreakpoint
- shouldBeEnabled = "No"
- ignoreCount = "0"
- continueAfterRunningActions = "No"
- filePath = "iBean/InstantExtractionViewController.m"
timestampString = "380494622.652202"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
diff --git a/iBean/iBean/BeanCollectionExtractionViewController.h b/iBean/iBean/BeanCollectionExtractionViewController.h
index 1cb0f67..449642a 100644
--- a/iBean/iBean/BeanCollectionExtractionViewController.h
+++ b/iBean/iBean/BeanCollectionExtractionViewController.h
@@ -12,10 +12,15 @@
@interface BeanCollectionExtractionViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) BeanCollection *beanCollection;
+@property (nonatomic, assign) double extractionProgress;
+@property (nonatomic, assign) BOOL extractionInProgress;
/* Utility methods */
- (void) initViewController;
- (void) initWithBeanCollection:(BeanCollection*) bc;
+- (void) updateExtractionProgress;
+- (void) haltExtractionTimer;
+- (void) timerInterrupted;
/* UI Outlets */
@property (weak, nonatomic) IBOutlet UITableView *beanTableView;
@@ -24,6 +29,6 @@
@property (weak, nonatomic) IBOutlet UIButton *extractionButton;
/* UI Actions */
-
+- (IBAction) startExtraction:(id)sender;
@end
diff --git a/iBean/iBean/BeanCollectionExtractionViewController.m b/iBean/iBean/BeanCollectionExtractionViewController.m
index 4c26ab6..785c981 100644
--- a/iBean/iBean/BeanCollectionExtractionViewController.m
+++ b/iBean/iBean/BeanCollectionExtractionViewController.m
@@ -11,6 +11,7 @@
#import "BeanCollection+Interface.h"
#import "BeanCell.h"
#import "Bean+Interface.h"
+#import "AppDelegate+Storage.h"
@interface BeanCollectionExtractionViewController ()
@@ -87,7 +88,39 @@
- (void) initWithBeanCollection:(BeanCollection *)bc
{
self.beanCollection = bc;
+}
+
+- (void) updateExtractionProgress
+{
+ self.extractionProgress -= 0.1f;
+ self.extractionProgressLabel.text = [NSString stringWithFormat:@"%1.1f", self.extractionProgress];
+ if (self.extractionProgress <= 0.0f)
+ {
+ NSLog(@"Timer reached its limit!");
+ [self haltExtractionTimer];
+ }
+}
+
+- (void) haltExtractionTimer
+{
+ if ([(AppDelegate*) [[UIApplication sharedApplication] delegate] getTimer] != nil)
+ {
+ [(AppDelegate*) [[UIApplication sharedApplication] delegate] haltTimer:YES];
+
+ //Return UI to "Start extraction" state.
+ [self timerInterrupted];
+ }
+}
+
+- (void) timerInterrupted
+{
+ NSLog(@"BeanCollectionExtractionViewController - timerInterrupted");
+
+ //Return UI to "Start extraction" state.
+ [self.extractionButton setTitle:@"Start extraction" forState:UIControlStateNormal];
+ self.extractionProgressLabel.text = [self.beanCollection.extractionTime stringValue];
+ self.extractionInProgress = NO;
}
/*****************************************************
@@ -95,6 +128,23 @@
*****************************************************/
#pragma mark - UI action methods
+- (void) startExtraction:(id)sender
+{
+ //Extraction in progress?
+ if ([(AppDelegate*) [[UIApplication sharedApplication] delegate] getTimer] == nil || self.extractionInProgress == NO)
+ {
+ self.extractionProgress = [self.beanCollection.extractionTime doubleValue];
+ [self.extractionButton setTitle:@"Stop extraction" forState:UIControlStateNormal];
+ self.extractionInProgress = YES;
+
+ [(AppDelegate*) [[UIApplication sharedApplication] delegate] createTimer:self :@selector(updateExtractionProgress) :nil :YES];
+ }
+ else if ([(AppDelegate*) [[UIApplication sharedApplication] delegate] getTimer] != nil)
+ {
+ [self haltExtractionTimer];
+ }
+}
+
/*****************************************************
Delegates
*****************************************************/
diff --git a/iBean/iBean/InstantExtractionViewController.h b/iBean/iBean/InstantExtractionViewController.h
index 4fded92..92b265e 100644
--- a/iBean/iBean/InstantExtractionViewController.h
+++ b/iBean/iBean/InstantExtractionViewController.h
@@ -12,6 +12,7 @@
@interface InstantExtractionViewController : UIViewController
@property (nonatomic, assign) double extractionProgress;
+@property (nonatomic, assign) BOOL extractionInProgress;
@property (nonatomic, strong) Configuration *configuration;
/* Utility methods */
diff --git a/iBean/iBean/InstantExtractionViewController.m b/iBean/iBean/InstantExtractionViewController.m
index 3c53faa..d0205c8 100644
--- a/iBean/iBean/InstantExtractionViewController.m
+++ b/iBean/iBean/InstantExtractionViewController.m
@@ -87,10 +87,10 @@
{
if ([(AppDelegate*) [[UIApplication sharedApplication] delegate] getTimer] != nil)
{
- [(AppDelegate*) [[UIApplication sharedApplication] delegate] haltTimer:NO];
+ [(AppDelegate*) [[UIApplication sharedApplication] delegate] haltTimer:YES];
//Return UI to "Start extraction" state.
- [self timerInterrupted];
+ //[self timerInterrupted];
}
}
@@ -101,6 +101,7 @@
//Return UI to "Start extraction" state.
[self.extractionButton setTitle:@"Start extraction" forState:UIControlStateNormal];
[self.extractionSettingStepper setEnabled:YES];
+ self.extractionInProgress = NO;
}
/*****************************************************
@@ -108,17 +109,17 @@
*****************************************************/
#pragma mark - IBActions
- (IBAction)startExtraction:(id)sender {
-
- //Extraction in progress?
- if ([(AppDelegate*) [[UIApplication sharedApplication] delegate] getTimer] == nil)
+
+ if (([(AppDelegate*) [[UIApplication sharedApplication] delegate] getTimer] == nil) || self.extractionInProgress == NO)
{
self.extractionProgress = 0.0f;
[self.extractionButton setTitle:@"Stop extraction" forState:UIControlStateNormal];
[self.extractionSettingStepper setEnabled:NO];
+ self.extractionInProgress = YES;
[(AppDelegate*) [[UIApplication sharedApplication] delegate] createTimer:self :@selector(updateExtractionProgressLabel) :nil :YES];
}
- else
+ else if (([(AppDelegate*) [[UIApplication sharedApplication] delegate] getTimer] != nil))
{
[self haltExtractionTimer];
}
diff --git a/iBean/iBean/iPhoneStoryboard.storyboard b/iBean/iBean/iPhoneStoryboard.storyboard
index df40f8a..2cb8195 100644
--- a/iBean/iBean/iPhoneStoryboard.storyboard
+++ b/iBean/iBean/iPhoneStoryboard.storyboard
@@ -743,10 +743,13 @@
</scrollView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="YJ7-1f-6ZW">
<fontDescription key="fontDescription" name="Helvetica-Bold" family="Helvetica" pointSize="15"/>
- <state key="normal" title="Button">
+ <state key="normal" title="Start extraction">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
+ <connections>
+ <action selector="startExtraction:" destination="aA5-tc-vwr" eventType="touchUpInside" id="VkN-OE-9wh"/>
+ </connections>
</button>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Extraction counter" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OLN-e5-oOe">
<fontDescription key="fontDescription" type="system" pointSize="17"/>
@@ -826,6 +829,7 @@
<class className="BeanCollectionExtractionViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/BeanCollectionExtractionViewController.h"/>
<relationships>
+ <relationship kind="action" name="startExtraction:"/>
<relationship kind="outlet" name="beanCollectionNoteTextView" candidateClass="UITextView"/>
<relationship kind="outlet" name="beanTableView" candidateClass="UITableView"/>
<relationship kind="outlet" name="extractionButton" candidateClass="UIButton"/>