Skip to content

Commit

Permalink
UI: fix some animations when changing of view - still having view on …
Browse files Browse the repository at this point in the history
…top of status bar in landscape mode and fix upsidedown
  • Loading branch information
bagage committed Dec 3, 2015
1 parent 4171455 commit 5a99184
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 56 deletions.
14 changes: 7 additions & 7 deletions Classes/Base.lproj/PhoneMainView.xib
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14F1021" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="PhoneMainView">
Expand All @@ -23,17 +24,21 @@
<view tag="1" contentMode="scaleToFill" id="avX-6g-QDq" userLabel="background">
<rect key="frame" x="0.0" y="0.0" width="375" height="559"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<view contentMode="scaleToFill" id="6sv-JD-j8Z" userLabel="statusBarBG">
<rect key="frame" x="0.0" y="0.0" width="375" height="20"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<animations/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
</view>
</subviews>
<animations/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
</view>
</subviews>
<animations/>
<color key="backgroundColor" red="1" green="1" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/>
</view>
Expand All @@ -42,9 +47,4 @@
<nil key="simulatedStatusBarMetrics"/>
</viewController>
</objects>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>
2 changes: 1 addition & 1 deletion Classes/LinphoneUI/Base.lproj/UICompositeView.xib
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
</view>
<view clearsContextBeforeDrawing="NO" tag="4" contentMode="scaleToFill" id="JXU-o0-1po" userLabel="sideMenuView">
<rect key="frame" x="0.0" y="42" width="667" height="333"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
</view>
</subviews>
Expand Down
73 changes: 37 additions & 36 deletions Classes/LinphoneUI/UICompositeView.m
Original file line number Diff line number Diff line change
Expand Up @@ -268,37 +268,37 @@ + (void)setOrientation:(UIInterfaceOrientation)orientation animated:(BOOL)animat
[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 {
Expand Down Expand Up @@ -390,21 +390,22 @@ - (void)update:(UICompositeViewDescription *)description
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"];
}
Expand Down Expand Up @@ -582,8 +583,8 @@ - (void)update:(UICompositeViewDescription *)description
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) {
Expand Down
20 changes: 8 additions & 12 deletions Classes/PhoneMainView.m
Original file line number Diff line number Diff line change
Expand Up @@ -227,18 +227,14 @@ - (void)setVolumeHidden:(BOOL)hidden {
}
}

//#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 {
Expand Down
1 change: 1 addition & 0 deletions linphone-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
Expand Down

0 comments on commit 5a99184

Please sign in to comment.