forked from mirrors/linphone-iphone
Fix preview bugs
Improve InCallView
This commit is contained in:
parent
3eea43c947
commit
1d48b9002d
8 changed files with 89 additions and 18 deletions
|
|
@ -28,6 +28,10 @@
|
|||
|
||||
@class VideoViewController;
|
||||
|
||||
@interface UIPreviewView : UIView
|
||||
|
||||
@end
|
||||
|
||||
@interface InCallViewController : UIViewController <CallActionSheetDelegate, UIGestureRecognizerDelegate, UICompositeViewDelegate> {
|
||||
|
||||
InCallTableViewController* callTableController;
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@
|
|||
<string key="NSFrameSize">{320, 460}</string>
|
||||
<reference key="NSSuperview" ref="1009068048"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="673568144"/>
|
||||
<reference key="NSNextKeyView" ref="69034748"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:196</string>
|
||||
<object class="NSColor" key="IBUIBackgroundColor" id="95762599">
|
||||
<int key="NSColorSpace">3</int>
|
||||
|
|
@ -77,12 +77,13 @@
|
|||
</object>
|
||||
<object class="IBUIView" id="673568144">
|
||||
<reference key="NSNextResponder" ref="1009068048"/>
|
||||
<int key="NSvFlags">283</int>
|
||||
<string key="NSFrame">{{214, 354}, {106, 106}}</string>
|
||||
<int key="NSvFlags">265</int>
|
||||
<string key="NSFrame">{{220, 360}, {100, 100}}</string>
|
||||
<reference key="NSSuperview" ref="1009068048"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="69034748"/>
|
||||
<reference key="NSNextKeyView" ref="972197710"/>
|
||||
<reference key="IBUIBackgroundColor" ref="95762599"/>
|
||||
<int key="IBUIContentMode">1</int>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBUIActivityIndicatorView" id="69034748">
|
||||
|
|
@ -91,7 +92,7 @@
|
|||
<string key="NSFrame">{{141, 212}, {37, 37}}</string>
|
||||
<reference key="NSSuperview" ref="1009068048"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="972197710"/>
|
||||
<reference key="NSNextKeyView" ref="673568144"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:1030</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
|
|
@ -399,6 +400,7 @@
|
|||
<string>-2.IBPluginDependency</string>
|
||||
<string>106.IBPluginDependency</string>
|
||||
<string>126.IBPluginDependency</string>
|
||||
<string>127.CustomClassName</string>
|
||||
<string>127.IBPluginDependency</string>
|
||||
<string>132.IBPluginDependency</string>
|
||||
<string>144.IBPluginDependency</string>
|
||||
|
|
@ -418,6 +420,7 @@
|
|||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>UIPreviewView</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
|
|
@ -556,6 +559,14 @@
|
|||
<string key="minorKey">./Classes/UICamSwitch.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIPreviewView</string>
|
||||
<string key="superclassName">UIView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/UIPreviewView.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@
|
|||
|
||||
- (void)changeView:(UICompositeViewDescription *)description;
|
||||
- (void)setFullScreen:(BOOL) enabled;
|
||||
- (void)setStateBarHidden:(BOOL) hidden;
|
||||
- (void)setToolBarHidden:(BOOL) hidden;
|
||||
- (UIViewController *)getCurrentViewController;
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 9a0097a9748862b91448bb71c10c619e122e739a
|
||||
Subproject commit 78fae7acaf65bf083a8d35ae0c0bdddc87b649cc
|
||||
Loading…
Add table
Reference in a new issue