From 5a9918445064f12a10eb1b262d17250a7b6afccf Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Thu, 3 Dec 2015 16:42:38 +0100 Subject: [PATCH] UI: fix some animations when changing of view - still having view on top of status bar in landscape mode and fix upsidedown --- Classes/Base.lproj/PhoneMainView.xib | 14 ++-- .../LinphoneUI/Base.lproj/UICompositeView.xib | 2 +- Classes/LinphoneUI/UICompositeView.m | 73 ++++++++++--------- Classes/PhoneMainView.m | 20 ++--- linphone-Info.plist | 1 + 5 files changed, 54 insertions(+), 56 deletions(-) diff --git a/Classes/Base.lproj/PhoneMainView.xib b/Classes/Base.lproj/PhoneMainView.xib index 2d62804da..13d8cc75c 100644 --- a/Classes/Base.lproj/PhoneMainView.xib +++ b/Classes/Base.lproj/PhoneMainView.xib @@ -1,7 +1,8 @@ - + - + + @@ -23,17 +24,21 @@ + + + + @@ -42,9 +47,4 @@ - - - - - diff --git a/Classes/LinphoneUI/Base.lproj/UICompositeView.xib b/Classes/LinphoneUI/Base.lproj/UICompositeView.xib index e36ae20f5..32428d092 100644 --- a/Classes/LinphoneUI/Base.lproj/UICompositeView.xib +++ b/Classes/LinphoneUI/Base.lproj/UICompositeView.xib @@ -79,7 +79,7 @@ - + diff --git a/Classes/LinphoneUI/UICompositeView.m b/Classes/LinphoneUI/UICompositeView.m index 718901e27..14426b4f4 100644 --- a/Classes/LinphoneUI/UICompositeView.m +++ b/Classes/LinphoneUI/UICompositeView.m @@ -268,37 +268,37 @@ [firstResponder resignFirstResponder]; [firstResponder becomeFirstResponder]; } - } +} - + (UIView *)findFirstResponder:(UIView *)view { - if (view.isFirstResponder) { - return view; - } - for (UIView *subView in view.subviews) { - UIView *ret = [UICompositeView findFirstResponder:subView]; - if (ret != nil) - return ret; - } - return nil; ++ (UIView *)findFirstResponder:(UIView *)view { + if (view.isFirstResponder) { + return view; } + for (UIView *subView in view.subviews) { + UIView *ret = [UICompositeView findFirstResponder:subView]; + if (ret != nil) + return ret; + } + return nil; +} - - (void)clearCache:(NSArray *)exclude { - for (NSString *key in [viewControllerCache allKeys]) { - bool remove = true; - if (exclude != nil) { - for (UICompositeViewDescription *description in exclude) { - if ([key isEqualToString:description.content] || [key isEqualToString:description.statusBar] || - [key isEqualToString:description.tabBar] || [key isEqualToString:description.sideMenu]) { - remove = false; - break; - } +- (void)clearCache:(NSArray *)exclude { + for (NSString *key in [viewControllerCache allKeys]) { + bool remove = true; + if (exclude != nil) { + for (UICompositeViewDescription *description in exclude) { + if ([key isEqualToString:description.content] || [key isEqualToString:description.statusBar] || + [key isEqualToString:description.tabBar] || [key isEqualToString:description.sideMenu]) { + remove = false; + break; } } - if (remove) { - LOGI(@"Free cached view: %@", key); - [viewControllerCache removeObjectForKey:key]; - } } + if (remove) { + LOGI(@"Free cached view: %@", key); + [viewControllerCache removeObjectForKey:key]; + } + } } - (UIInterfaceOrientation)currentOrientation { @@ -390,21 +390,22 @@ if (oldViewDescription != nil && self.viewTransition != nil) { [self.contentView.layer removeAnimationForKey:@"transition"]; [self.contentView.layer addAnimation:self.viewTransition forKey:@"transition"]; - if (oldViewDescription.statusBar != currentViewDescription.statusBar || - oldViewDescription.statusBarEnabled != currentViewDescription.statusBarEnabled || - [self.statusBarView.layer animationForKey:@"transition"] != nil) { + if (![oldViewDescription.statusBar isEqualToString:currentViewDescription.statusBar] || + oldViewDescription.statusBarEnabled != currentViewDescription.statusBarEnabled) { [self.statusBarView.layer removeAnimationForKey:@"transition"]; [self.statusBarView.layer addAnimation:self.viewTransition forKey:@"transition"]; + } else { + [self.statusBarView.layer removeAnimationForKey:@"transition"]; } - if (oldViewDescription.tabBar != currentViewDescription.tabBar || - oldViewDescription.tabBarEnabled != currentViewDescription.tabBarEnabled || - [self.tabBarView.layer animationForKey:@"transition"] != nil) { + if (![oldViewDescription.tabBar isEqualToString:currentViewDescription.tabBar] || + oldViewDescription.tabBarEnabled != currentViewDescription.tabBarEnabled) { [self.tabBarView.layer removeAnimationForKey:@"transition"]; [self.tabBarView.layer addAnimation:self.viewTransition forKey:@"transition"]; + } else { + [self.tabBarView.layer removeAnimationForKey:@"transition"]; } - if (oldViewDescription.sideMenu != currentViewDescription.sideMenu || - oldViewDescription.sideMenuEnabled != currentViewDescription.sideMenuEnabled || - [self.sideMenuView.layer animationForKey:@"transition"] != nil) { + if (![oldViewDescription.sideMenu isEqualToString:currentViewDescription.sideMenu] || + oldViewDescription.sideMenuEnabled != currentViewDescription.sideMenuEnabled) { [self.sideMenuView.layer removeAnimationForKey:@"transition"]; [self.sideMenuView.layer addAnimation:self.viewTransition forKey:@"transition"]; } @@ -582,8 +583,8 @@ sideMenuFrame.size.height += tabFrame.size.height; } else { sideMenuFrame = viewFrame; - sideMenuFrame.size.height -= statusBarFrame.size.height; - sideMenuFrame.origin.y = statusBarFrame.size.height; + sideMenuFrame.size.height -= origin + statusBarFrame.size.height; + sideMenuFrame.origin.y = origin + statusBarFrame.size.height; } if (!currentViewDescription.sideMenuEnabled) { diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index b44428915..bf8aa5aa7 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -227,18 +227,14 @@ static RootViewManager *rootViewManagerInstance = nil; } } -//#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 90000 -//- (UIInterfaceOrientationMask)supportedInterfaceOrientations -//#else -//- (NSUInteger)supportedInterfaceOrientations -//#endif -//{ -// if ([LinphoneManager runningOnIpad] || [mainViewController currentViewSupportsLandscape]) { -// return UIInterfaceOrientationMaskAll; -// } else { -// return UIInterfaceOrientationMaskPortrait; -// } -//} +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 90000 +- (UIInterfaceOrientationMask)supportedInterfaceOrientations +#else +- (NSUInteger)supportedInterfaceOrientations +#endif +{ + return UIInterfaceOrientationMaskAll; +} - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { diff --git a/linphone-Info.plist b/linphone-Info.plist index 72d0ca10e..bbdda263a 100644 --- a/linphone-Info.plist +++ b/linphone-Info.plist @@ -84,6 +84,7 @@ UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + UIInterfaceOrientationPortraitUpsideDown UISupportedInterfaceOrientations~ipad