diff --git a/Classes/InCallViewController.h b/Classes/InCallViewController.h index b11f30ae3..0808ebeac 100644 --- a/Classes/InCallViewController.h +++ b/Classes/InCallViewController.h @@ -28,6 +28,10 @@ @class VideoViewController; +@interface UIPreviewView : UIView + +@end + @interface InCallViewController : UIViewController { InCallTableViewController* callTableController; diff --git a/Classes/InCallViewController.m b/Classes/InCallViewController.m index 509d38038..15926c9ff 100644 --- a/Classes/InCallViewController.m +++ b/Classes/InCallViewController.m @@ -35,6 +35,17 @@ const NSInteger SECURE_BUTTON_TAG=5; +@implementation UIPreviewView + +- (void)layoutSubviews { + [super layoutSubviews]; + [self.layer setFrame:self.frame]; + for(CALayer *layer in self.layer.sublayers) { + [layer setFrame:self.bounds]; + } +} + +@end @implementation InCallViewController @@ -102,6 +113,22 @@ static UICompositeViewDescription *compositeDescription = nil; #pragma mark - ViewController Functions +// Resize preview view keep same ratio +- (void)viewWillLayoutSubviews { + [super viewWillLayoutSubviews]; + CGRect frame = [videoPreview frame]; + frame.origin.x += frame.size.width; + frame.origin.y += frame.size.height; + + CGRect selfFrame = [self.view frame]; + int size = 100.0f/460.0f * MAX(selfFrame.size.width, selfFrame.size.height); + frame.origin.x -= size; + frame.origin.y -= size; + frame.size.height = size; + frame.size.width = size; + [videoPreview setFrame:frame]; +} + - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; @@ -204,14 +231,20 @@ static UICompositeViewDescription *compositeDescription = nil; UIDeviceOrientation orientation = [UIDevice currentDevice].orientation; int newRotation = 0; switch (orientation) { - case UIInterfaceOrientationLandscapeRight: - newRotation = 270; + case UIDeviceOrientationPortrait: + newRotation = 0; break; - case UIInterfaceOrientationLandscapeLeft: + case UIDeviceOrientationPortraitUpsideDown: + newRotation = 180; + break; + case UIDeviceOrientationLandscapeRight: newRotation = 90; break; + case UIDeviceOrientationLandscapeLeft: + newRotation = 270; + break; default: - newRotation = 0; + newRotation = oldLinphoneOrientation; } if (oldLinphoneOrientation != newRotation) { linphone_core_set_device_rotation([LinphoneManager getLc], newRotation); @@ -307,6 +340,7 @@ static UICompositeViewDescription *compositeDescription = nil; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.3]; [[PhoneMainView instance] showTabBar: true]; + [[PhoneMainView instance] showStateBar: true]; [videoCameraSwitch setAlpha:1.0]; [UIView commitAnimations]; @@ -333,6 +367,7 @@ static UICompositeViewDescription *compositeDescription = nil; [[PhoneMainView instance] showTabBar: false]; + [[PhoneMainView instance] showStateBar: false]; } } @@ -383,6 +418,7 @@ static UICompositeViewDescription *compositeDescription = nil; [[PhoneMainView instance] fullScreen: true]; [[PhoneMainView instance] showTabBar: false]; + [[PhoneMainView instance] showStateBar: false]; #ifdef TEST_VIDEO_VIEW_CHANGE [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(_debugChangeVideoView) userInfo:nil repeats:YES]; diff --git a/Classes/InCallViewController.xib b/Classes/InCallViewController.xib index e25d6a35b..8d6106c7d 100644 --- a/Classes/InCallViewController.xib +++ b/Classes/InCallViewController.xib @@ -67,7 +67,7 @@ {320, 460} - + _NS:196 3 @@ -77,12 +77,13 @@ - 283 - {{214, 354}, {106, 106}} + 265 + {{220, 360}, {100, 100}} - + + 1 IBCocoaTouchFramework @@ -91,7 +92,7 @@ {{141, 212}, {37, 37}} - + _NS:1030 NO IBCocoaTouchFramework @@ -399,6 +400,7 @@ -2.IBPluginDependency 106.IBPluginDependency 126.IBPluginDependency + 127.CustomClassName 127.IBPluginDependency 132.IBPluginDependency 144.IBPluginDependency @@ -418,6 +420,7 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIPreviewView com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -556,6 +559,14 @@ ./Classes/UICamSwitch.h + + UIPreviewView + UIView + + IBProjectSource + ./Classes/UIPreviewView.h + + 0 diff --git a/Classes/LinphoneUI/UICompositeViewController.h b/Classes/LinphoneUI/UICompositeViewController.h index d19634296..f4ad7f907 100644 --- a/Classes/LinphoneUI/UICompositeViewController.h +++ b/Classes/LinphoneUI/UICompositeViewController.h @@ -87,6 +87,7 @@ - (void)changeView:(UICompositeViewDescription *)description; - (void)setFullScreen:(BOOL) enabled; +- (void)setStateBarHidden:(BOOL) hidden; - (void)setToolBarHidden:(BOOL) hidden; - (UIViewController *)getCurrentViewController; diff --git a/Classes/LinphoneUI/UICompositeViewController.m b/Classes/LinphoneUI/UICompositeViewController.m index 4d99f1a6b..598a50483 100644 --- a/Classes/LinphoneUI/UICompositeViewController.m +++ b/Classes/LinphoneUI/UICompositeViewController.m @@ -190,7 +190,7 @@ [contentViewController willAnimateRotationToInterfaceOrientation:currentOrientation duration:duration]; [tabBarViewController willAnimateRotationToInterfaceOrientation:currentOrientation duration:duration]; [stateBarViewController willAnimateRotationToInterfaceOrientation:currentOrientation duration:duration]; - [self update:nil tabBar:nil fullscreen:nil]; + [self update:nil tabBar:nil stateBar:nil fullscreen:nil]; } - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { @@ -342,7 +342,7 @@ #define IPHONE_STATUSBAR_HEIGHT 20 -- (void)update: (UICompositeViewDescription*) description tabBar:(NSNumber*)tabBar fullscreen:(NSNumber*)fullscreen { +- (void)update: (UICompositeViewDescription*) description tabBar:(NSNumber*)tabBar stateBar:(NSNumber*)stateBar fullscreen:(NSNumber*)fullscreen { // Copy view description UICompositeViewDescription *oldViewDescription = nil; @@ -398,6 +398,14 @@ } } + if(stateBar != nil) { + if(currentViewDescription.stateBarEnabled != [stateBar boolValue]) { + currentViewDescription.stateBarEnabled = [stateBar boolValue]; + } else { + stateBar = nil; // No change = No Update + } + } + if(fullscreen != nil) { if(currentViewDescription.fullscreen != [fullscreen boolValue]) { currentViewDescription.fullscreen = [fullscreen boolValue]; @@ -410,7 +418,7 @@ } // Start animation - if(tabBar != nil || fullscreen != nil) { + if(tabBar != nil || stateBar != nil || fullscreen != nil) { [UIView beginAnimations:@"resize" context:nil]; [UIView setAnimationDuration:0.35]; [UIView setAnimationBeginsFromCurrentState:TRUE]; @@ -454,8 +462,10 @@ tabFrame.origin.y = viewFrame.size.height; } - if(currentViewDescription.fullscreen) + if(currentViewDescription.fullscreen) { + contentFrame.origin.y = origin; contentFrame.size.height = viewFrame.size.height - contentFrame.origin.y; + } // Set frames [contentView setFrame: contentFrame]; @@ -470,7 +480,7 @@ [stateBarViewController.view setFrame:frame]; // Commit animation - if(tabBar != nil || fullscreen != nil) { + if(tabBar != nil || stateBar != nil || fullscreen != nil) { [UIView commitAnimations]; } @@ -493,15 +503,19 @@ - (void) changeView:(UICompositeViewDescription *)description { [self view]; // Force view load - [self update:description tabBar:nil fullscreen:nil]; + [self update:description tabBar:nil stateBar:nil fullscreen:nil]; } - (void) setFullScreen:(BOOL) enabled { - [self update:nil tabBar:nil fullscreen:[NSNumber numberWithBool:enabled]]; + [self update:nil tabBar:nil stateBar:nil fullscreen:[NSNumber numberWithBool:enabled]]; } - (void) setToolBarHidden:(BOOL) hidden { - [self update:nil tabBar:[NSNumber numberWithBool:!hidden] fullscreen:nil]; + [self update:nil tabBar:[NSNumber numberWithBool:!hidden] stateBar:nil fullscreen:nil]; +} + +- (void) setStateBarHidden:(BOOL) hidden { + [self update:nil tabBar: nil stateBar:[NSNumber numberWithBool:!hidden] fullscreen:nil]; } - (UIViewController *) getCurrentViewController { diff --git a/Classes/PhoneMainView.h b/Classes/PhoneMainView.h index ef034965a..9d5150131 100644 --- a/Classes/PhoneMainView.h +++ b/Classes/PhoneMainView.h @@ -57,6 +57,7 @@ - (UIViewController*)popCurrentView; - (void)popToView:(UICompositeViewDescription *)currentView; - (UICompositeViewDescription *)firstView; +- (void)showStateBar:(BOOL)show; - (void)showTabBar:(BOOL)show; - (void)fullScreen:(BOOL)enabled; + (void)forceOrientation:(UIInterfaceOrientation)orientation; diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index d5ae047c5..b8695218f 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -398,6 +398,10 @@ static PhoneMainView* phoneMainViewInstance=nil; [mainViewController setToolBarHidden:!show]; } +- (void) showStateBar:(BOOL) show { + [mainViewController setStateBarHidden:!show]; +} + - (void)fullScreen:(BOOL) enabled { [mainViewController setFullScreen:enabled]; } diff --git a/submodules/linphone b/submodules/linphone index 9a0097a97..78fae7aca 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 9a0097a9748862b91448bb71c10c619e122e739a +Subproject commit 78fae7acaf65bf083a8d35ae0c0bdddc87b649cc