diff options
author | Siqi LIU <me@siqi.fr> | 2013-08-05 19:34:49 +0200 |
---|---|---|
committer | Siqi LIU <me@siqi.fr> | 2013-08-05 19:41:03 +0200 |
commit | fd83796313aa431788066e3f33c0fff546d4f30f (patch) | |
tree | f1c3704c2113d8db1846e05c2874cb8cc33c50e5 /ios | |
parent | b0fd4d03087989e193b2bd2ad071339a975ac4cd (diff) |
display timer on the main slideshow screen & runloop fix
Change-Id: I4ea660a151992c74afb321f1bae19fdd2c5ee40e
Diffstat (limited to 'ios')
-rw-r--r-- | ios/iosremote/iosremote/en.lproj/iPhone_autoSize.storyboard | 75 | ||||
-rw-r--r-- | ios/iosremote/iosremote/slideShowSwipeInList_iphone.h | 4 | ||||
-rw-r--r-- | ios/iosremote/iosremote/slideShowSwipeInList_iphone.m | 1 | ||||
-rw-r--r-- | ios/iosremote/iosremote/slideShow_vc_iphone.m | 9 | ||||
-rw-r--r-- | ios/iosremote/iosremote/stopWatch.h | 1 | ||||
-rw-r--r-- | ios/iosremote/iosremote/stopWatch.m | 39 |
6 files changed, 109 insertions, 20 deletions
diff --git a/ios/iosremote/iosremote/en.lproj/iPhone_autoSize.storyboard b/ios/iosremote/iosremote/en.lproj/iPhone_autoSize.storyboard index 02363deb29f1..f3db34028193 100644 --- a/ios/iosremote/iosremote/en.lproj/iPhone_autoSize.storyboard +++ b/ios/iosremote/iosremote/en.lproj/iPhone_autoSize.storyboard @@ -284,12 +284,12 @@ <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/> <subviews> <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" verticalCompressionResistancePriority="1000" id="bZq-z2-OKU"> - <rect key="frame" x="97" y="8" width="220" height="167"/> + <rect key="frame" x="3" y="8" width="220" height="167"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" heightSizable="YES"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> </imageView> <view contentMode="scaleToFill" id="Y1f-iI-63a"> - <rect key="frame" x="3" y="3" width="86" height="172"/> + <rect key="frame" x="231" y="3" width="86" height="172"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/> <subviews> <imageView contentMode="scaleAspectFit" verticalCompressionResistancePriority="1000" id="B2g-rO-b9G"> @@ -301,7 +301,7 @@ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> </view> <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" alpha="0.80000000000000004" contentMode="left" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="3BV-KX-Qla"> - <rect key="frame" x="265" y="154" width="52" height="21"/> + <rect key="frame" x="3" y="154" width="52" height="21"/> <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/> <rect key="contentStretch" x="1.3877787807814457e-17" y="0.0" width="1" height="1"/> <fontDescription key="fontDescription" type="system" pointSize="17"/> @@ -332,7 +332,7 @@ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> </view> <view hidden="YES" opaque="NO" userInteractionEnabled="NO" alpha="0.60000000000000009" contentMode="scaleToFill" id="uSh-Ne-BdH" userLabel="blockview"> - <rect key="frame" x="0.0" y="0.0" width="320" height="640"/> + <rect key="frame" x="0.0" y="-46" width="320" height="640"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <color key="backgroundColor" cocoaTouchSystemColor="scrollViewTexturedBackgroundColor"/> <accessibility key="accessibilityConfiguration"> @@ -341,7 +341,7 @@ </view> <imageView hidden="YES" alpha="0.0" contentMode="scaleAspectFit" image="ic_launcher@2x.png" id="ExH-sw-Z1i"> <rect key="frame" x="0.0" y="148" width="320" height="253"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES"/> </imageView> <view hidden="YES" contentMode="scaleToFill" id="iCc-m2-vR5" userLabel="pointer"> <rect key="frame" x="157" y="272" width="5" height="5"/> @@ -528,13 +528,76 @@ <image name="timer_clear_btn.png" width="74" height="74"/> <image name="timer_start_btn.png" width="74" height="74"/> </resources> + <classes> + <class className="EditableTableViewCell" superclassName="UITableViewCell"> + <source key="sourceIdentifier" type="project" relativePath="./Classes/EditableTableViewCell.h"/> + </class> + <class className="SWRevealViewController" superclassName="UIViewController"> + <source key="sourceIdentifier" type="project" relativePath="./Classes/SWRevealViewController.h"/> + </class> + <class className="newServerViewController" superclassName="UITableViewController"> + <source key="sourceIdentifier" type="project" relativePath="./Classes/newServerViewController.h"/> + <relationships> + <relationship kind="action" name="save:"/> + </relationships> + </class> + <class className="pinValidation_vc" superclassName="UIViewController"> + <source key="sourceIdentifier" type="project" relativePath="./Classes/pinValidation_vc.h"/> + <relationships> + <relationship kind="outlet" name="pinLabel" candidateClass="UILabel"/> + <relationship kind="outlet" name="statusLabel" candidateClass="UILabel"/> + </relationships> + </class> + <class className="server_list_vc" superclassName="UITableViewController"> + <source key="sourceIdentifier" type="project" relativePath="./Classes/server_list_vc.h"/> + <relationships> + <relationship kind="outlet" name="serverTable" candidateClass="UITableView"/> + </relationships> + </class> + <class className="slideShowPreviewTable_vc" superclassName="UITableViewController"> + <source key="sourceIdentifier" type="project" relativePath="./Classes/slideShowPreviewTable_vc.h"/> + <relationships> + <relationship kind="action" name="startPresentationAction:"/> + <relationship kind="outlet" name="optionsTable" candidateClass="UITableView"/> + </relationships> + </class> + <class className="slideShowPreviewTable_vc_iphone" superclassName="slideShowPreviewTable_vc"> + <source key="sourceIdentifier" type="project" relativePath="./Classes/slideShowPreviewTable_vc_iphone.h"/> + <relationships> + <relationship kind="outlet" name="titleLabel" candidateClass="UILabel"/> + </relationships> + </class> + <class className="slideShowSwipeInList" superclassName="UITableViewController"> + <source key="sourceIdentifier" type="project" relativePath="./Classes/slideShowSwipeInList.h"/> + </class> + <class className="slideShow_vc" superclassName="UIViewController"> + <source key="sourceIdentifier" type="project" relativePath="./Classes/slideShow_vc.h"/> + <relationships> + <relationship kind="action" name="accPointerAction:"/> + <relationship kind="action" name="nextSlideAction:"/> + <relationship kind="action" name="pointerAction:"/> + <relationship kind="action" name="previousSlideAction:"/> + <relationship kind="outlet" name="blockingView" candidateClass="UIView"/> + <relationship kind="outlet" name="bottomView" candidateClass="UIView"/> + <relationship kind="outlet" name="lecturer_notes" candidateClass="UIWebView"/> + <relationship kind="outlet" name="movingPointer" candidateClass="UIView"/> + <relationship kind="outlet" name="notesView" candidateClass="UIView"/> + <relationship kind="outlet" name="pointerBtn" candidateClass="UIButton"/> + <relationship kind="outlet" name="revealButtonItem" candidateClass="UIBarButtonItem"/> + <relationship kind="outlet" name="secondarySlideView" candidateClass="UIImageView"/> + <relationship kind="outlet" name="slideNumber" candidateClass="UILabel"/> + <relationship kind="outlet" name="slideView" candidateClass="UIImageView"/> + <relationship kind="outlet" name="touchPointerImage" candidateClass="UIImageView"/> + </relationships> + </class> + </classes> <simulatedMetricsContainer key="defaultSimulatedMetrics"> <simulatedStatusBarMetrics key="statusBar"/> <simulatedOrientationMetrics key="orientation"/> <simulatedScreenMetrics key="destination" type="retina4"/> </simulatedMetricsContainer> <inferredMetricsTieBreakers> - <segue reference="eIY-4P-1sI"/> + <segue reference="UPp-kY-X3T"/> <segue reference="EWS-Nn-mQc"/> </inferredMetricsTieBreakers> </document>
\ No newline at end of file diff --git a/ios/iosremote/iosremote/slideShowSwipeInList_iphone.h b/ios/iosremote/iosremote/slideShowSwipeInList_iphone.h index 2953e59591cb..2ba829802055 100644 --- a/ios/iosremote/iosremote/slideShowSwipeInList_iphone.h +++ b/ios/iosremote/iosremote/slideShowSwipeInList_iphone.h @@ -7,6 +7,10 @@ */ #import <UIKit/UIKit.h> +@class stopWatch; + @interface slideShowSwipeInList : UITableViewController <UITableViewDataSource, UITableViewDelegate> +@property (nonatomic, strong) stopWatch *stopWatch; + @end diff --git a/ios/iosremote/iosremote/slideShowSwipeInList_iphone.m b/ios/iosremote/iosremote/slideShowSwipeInList_iphone.m index 67db07ac3a36..28a00a7be4a6 100644 --- a/ios/iosremote/iosremote/slideShowSwipeInList_iphone.m +++ b/ios/iosremote/iosremote/slideShowSwipeInList_iphone.m @@ -21,7 +21,6 @@ @property (nonatomic, strong) CommunicationManager *comManager; @property (nonatomic, strong) SlideShow *slideshow; -@property (nonatomic, strong) stopWatch *stopWatch; @end diff --git a/ios/iosremote/iosremote/slideShow_vc_iphone.m b/ios/iosremote/iosremote/slideShow_vc_iphone.m index 0d411b71e7eb..42ed69ffb0c6 100644 --- a/ios/iosremote/iosremote/slideShow_vc_iphone.m +++ b/ios/iosremote/iosremote/slideShow_vc_iphone.m @@ -11,8 +11,10 @@ #import "CommunicationManager.h" #import "SWRevealViewController.h" #import "CommandInterpreter.h" +#import "stopWatch.h" #import "CommandTransmitter.h" #import "slideShowPreviewTable_vc.h" +#import "slideShowSwipeInList_iphone.h" #import <QuartzCore/QuartzCore.h> #import <CoreMotion/CoreMotion.h> @@ -317,11 +319,18 @@ [self.navigationController popViewControllerAnimated:YES]; } +- (void) viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; +} + - (void) viewDidAppear:(BOOL)animated { NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; NSOperationQueue *mainQueue = [NSOperationQueue mainQueue]; + + [[(slideShowSwipeInList *)self.revealViewController.rearViewController stopWatch] setBarItem:self.navigationController.navigationBar.topItem]; self.slideShowImageNoteReadyObserver =[center addObserverForName:MSG_SLIDE_CHANGED object:nil diff --git a/ios/iosremote/iosremote/stopWatch.h b/ios/iosremote/iosremote/stopWatch.h index 733059669662..9cb716bc2e1b 100644 --- a/ios/iosremote/iosremote/stopWatch.h +++ b/ios/iosremote/iosremote/stopWatch.h @@ -18,6 +18,7 @@ @property (strong, nonatomic) NSTimer *stopWatchTimer; @property (strong, nonatomic) NSDate *startDate; @property BOOL set; +@property (weak, nonatomic) UINavigationItem * barItem; - (stopWatch *) initWithStartButton:(UIButton *)startButton ClearButton:(UIButton *)clearButton diff --git a/ios/iosremote/iosremote/stopWatch.m b/ios/iosremote/iosremote/stopWatch.m index 60c9ced3f303..b6d80f99275d 100644 --- a/ios/iosremote/iosremote/stopWatch.m +++ b/ios/iosremote/iosremote/stopWatch.m @@ -22,14 +22,19 @@ @synthesize startButton = _startButton; @synthesize clearButton = _clearButton; @synthesize timeLabel = _timeLabel; +@synthesize barItem = _barItem; @synthesize lastInterval = _lastInterval; +dispatch_queue_t backgroundQueue; + - (stopWatch *) init { self = [super init]; self.state = TIMER_STATE_CLEARED; self.set = NO; + backgroundQueue = dispatch_queue_create("com.libreoffice.iosremote", DISPATCH_QUEUE_CONCURRENT); + return self; } @@ -65,19 +70,24 @@ - (void)updateTimer { - // Create date from the elapsed time - NSDate *currentDate = [NSDate date]; - NSTimeInterval timeInterval = [currentDate timeIntervalSinceDate:self.startDate] + self.lastInterval; - NSDate *timerDate = [NSDate dateWithTimeIntervalSince1970:timeInterval]; - - // Create a date formatter - NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; - [dateFormatter setDateFormat:@"HH:mm:ss"]; - [dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0.0]]; - - // Format the elapsed time and set it to the label - NSString *timeString = [dateFormatter stringFromDate:timerDate]; - self.timeLabel.text = timeString; + dispatch_async(backgroundQueue, ^(void) { + // Create date from the elapsed time + NSDate *currentDate = [NSDate date]; + NSTimeInterval timeInterval = [currentDate timeIntervalSinceDate:self.startDate] + self.lastInterval; + NSDate *timerDate = [NSDate dateWithTimeIntervalSince1970:timeInterval]; + + // Create a date formatter + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + [dateFormatter setDateFormat:@"HH:mm:ss"]; + [dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0.0]]; + + // Format the elapsed time and set it to the label + NSString *timeString = [dateFormatter stringFromDate:timerDate]; + dispatch_async(dispatch_get_main_queue(), ^{ + self.timeLabel.text = timeString; + self.barItem.title = timeString; + }); + }); } @@ -97,6 +107,7 @@ selector:@selector(updateTimer) userInfo:nil repeats:YES]; + [[NSRunLoop currentRunLoop] addTimer:self.stopWatchTimer forMode:NSRunLoopCommonModes]; break; case TIMER_STATE_CLEARED: self.state = TIMER_STATE_RUNNING; @@ -107,6 +118,7 @@ selector:@selector(updateTimer) userInfo:nil repeats:YES]; + [[NSRunLoop currentRunLoop] addTimer:self.stopWatchTimer forMode:NSRunLoopCommonModes]; break; default: break; @@ -142,6 +154,7 @@ [self.startButton setImage:[UIImage imageNamed:@"timer_start_btn"] forState:UIControlStateNormal]; [self updateTimer]; + self.barItem.title = @""; } @end |