forked from mirrors/linphone-iphone
Fix Camera orientation when orientation is forced
This commit is contained in:
parent
7ec5036058
commit
6dcfbf0814
5 changed files with 30 additions and 27 deletions
|
|
@ -127,10 +127,6 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||
name:@"LinphoneCallUpdate"
|
||||
object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||
name:UIDeviceOrientationDidChangeNotification
|
||||
object:nil];
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
|
|
@ -145,16 +141,11 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
name:@"LinphoneCallUpdate"
|
||||
object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(orientationChanged:)
|
||||
name:UIDeviceOrientationDidChangeNotification
|
||||
object:nil];
|
||||
|
||||
// Update on show
|
||||
LinphoneCall* call = linphone_core_get_current_call([LinphoneManager getLc]);
|
||||
LinphoneCallState state = (call != NULL)?linphone_call_get_state(call): 0;
|
||||
[self callUpdate:call state:state animated:FALSE];
|
||||
[self orientationUpdate];
|
||||
[self orientationUpdate:[PhoneMainView instance].interfaceOrientation];
|
||||
|
||||
if ([[UIDevice currentDevice].systemVersion doubleValue] < 5.0) {
|
||||
[callTableController viewDidAppear:animated];
|
||||
|
|
@ -196,7 +187,13 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
|
||||
|
||||
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
|
||||
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
|
||||
[self orientationUpdate:toInterfaceOrientation];
|
||||
}
|
||||
|
||||
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
|
||||
[super willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration];
|
||||
CGRect frame = [videoPreview frame];
|
||||
switch (toInterfaceOrientation) {
|
||||
case UIInterfaceOrientationPortrait:
|
||||
|
|
@ -217,25 +214,25 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[videoPreview setFrame:frame];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)orientationUpdate {
|
||||
- (void)orientationUpdate:(UIInterfaceOrientation)orientation {
|
||||
int oldLinphoneOrientation = linphone_core_get_device_rotation([LinphoneManager getLc]);
|
||||
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
|
||||
int newRotation = 0;
|
||||
switch (orientation) {
|
||||
case UIDeviceOrientationPortrait:
|
||||
case UIInterfaceOrientationPortrait:
|
||||
newRotation = 0;
|
||||
break;
|
||||
case UIDeviceOrientationPortraitUpsideDown:
|
||||
case UIInterfaceOrientationPortraitUpsideDown:
|
||||
newRotation = 180;
|
||||
break;
|
||||
case UIDeviceOrientationLandscapeRight:
|
||||
newRotation = 90;
|
||||
break;
|
||||
case UIDeviceOrientationLandscapeLeft:
|
||||
case UIInterfaceOrientationLandscapeRight:
|
||||
newRotation = 270;
|
||||
break;
|
||||
case UIInterfaceOrientationLandscapeLeft:
|
||||
newRotation = 90;
|
||||
break;
|
||||
default:
|
||||
newRotation = oldLinphoneOrientation;
|
||||
}
|
||||
|
|
@ -477,10 +474,6 @@ static void hideSpinner(LinphoneCall* call, void* user_data) {
|
|||
|
||||
#pragma mark - Event Functions
|
||||
|
||||
- (void)orientationChanged:(NSNotification*) notif {
|
||||
[self orientationUpdate];
|
||||
}
|
||||
|
||||
- (void)callUpdateEvent: (NSNotification*) notif {
|
||||
LinphoneCall *call = [[notif.userInfo objectForKey: @"call"] pointerValue];
|
||||
LinphoneCallState state = [[notif.userInfo objectForKey: @"state"] intValue];
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@
|
|||
|
||||
UICompositeViewDescription *currentViewDescription;
|
||||
CATransition *viewTransition;
|
||||
UIDeviceOrientation currentOrientation;
|
||||
UIInterfaceOrientation currentOrientation;
|
||||
}
|
||||
|
||||
@property (retain) CATransition *viewTransition;
|
||||
|
|
@ -90,5 +90,6 @@
|
|||
- (void)setStateBarHidden:(BOOL) hidden;
|
||||
- (void)setToolBarHidden:(BOOL) hidden;
|
||||
- (UIViewController *)getCurrentViewController;
|
||||
- (UIInterfaceOrientation)currentOrientation;
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@
|
|||
|
||||
- (void)initUICompositeViewController {
|
||||
self->viewControllerCache = [[NSMutableDictionary alloc] init];
|
||||
self->currentOrientation = UIDeviceOrientationUnknown;
|
||||
currentOrientation = UIDeviceOrientationUnknown;
|
||||
}
|
||||
|
||||
- (id)init{
|
||||
|
|
@ -219,6 +219,10 @@
|
|||
|
||||
#pragma mark -
|
||||
|
||||
- (UIInterfaceOrientation)currentOrientation {
|
||||
return currentOrientation;
|
||||
}
|
||||
|
||||
+ (void)addSubView:(UIViewController*)controller view:(UIView*)view {
|
||||
if(controller != nil) {
|
||||
if ([[UIDevice currentDevice].systemVersion doubleValue] < 5.0) {
|
||||
|
|
@ -379,9 +383,10 @@
|
|||
UIInterfaceOrientation correctOrientation = [self getCorrectInterfaceOrientation:[[UIDevice currentDevice] orientation]];
|
||||
if(currentOrientation != correctOrientation) {
|
||||
[PhoneMainView forceOrientation:correctOrientation animated:currentOrientation!=UIDeviceOrientationUnknown];
|
||||
currentOrientation = correctOrientation;
|
||||
} else {
|
||||
[self updateInterfaceOrientation:correctOrientation];
|
||||
}
|
||||
currentOrientation = correctOrientation;
|
||||
[self updateInterfaceOrientation:correctOrientation];
|
||||
} else {
|
||||
oldViewDescription = (currentViewDescription != nil)? [currentViewDescription copy]: nil;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,6 +235,10 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
[mainViewController didRotateFromInterfaceOrientation:fromInterfaceOrientation];
|
||||
}
|
||||
|
||||
- (UIInterfaceOrientation)interfaceOrientation {
|
||||
return [mainViewController currentOrientation];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Event Functions
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 54ec1064fdff1c56c796f0e25437c414e328e105
|
||||
Subproject commit e93d9096ff433d3195c177e4c767881406e71d88
|
||||
Loading…
Add table
Reference in a new issue