Animate transitions video <-> audio calls

This commit is contained in:
Pierre-Eric Pelloux-Prayer 2012-03-14 11:43:05 +01:00
parent 079b43b6be
commit a7ac89fd79
3 changed files with 45 additions and 30 deletions

View file

@ -183,21 +183,22 @@ void addAnimationFadeTransition(UIView* view, float duration) {
hideControlsTimer = nil;
}
// show controls
addAnimationFadeTransition(controlSubView, 0.2);
controlSubView.hidden = FALSE;
addAnimationFadeTransition(hangUpView, 0.2);
hangUpView.hidden = FALSE;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
[controlSubView setAlpha:1.0];
[hangUpView setAlpha:1.0];
[UIView commitAnimations];
// hide controls in 5 sec
hideControlsTimer = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(hideControls:) userInfo:nil repeats:NO];
}
-(void) hideControls:(id)sender {
addAnimationFadeTransition(controlSubView, 0.4);
controlSubView.hidden = TRUE;
addAnimationFadeTransition(hangUpView, 0.4);
hangUpView.hidden = TRUE;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
[controlSubView setAlpha:0.0];
[hangUpView setAlpha:0.0];
[UIView commitAnimations];
hideControlsTimer = nil;
}
@ -205,10 +206,13 @@ void addAnimationFadeTransition(UIView* view, float duration) {
-(void) enableVideoDisplay {
[self orientationChanged:nil];
[videoGroup setHidden:FALSE];
[controlSubView setHidden:TRUE];
[hangUpView setHidden:TRUE];
[callTableView setHidden:TRUE];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[videoGroup setAlpha:1.0];
[controlSubView setAlpha:0.0];
[hangUpView setAlpha:0.0];
[callTableView setAlpha:0.0];
[UIView commitAnimations];
linphone_core_set_native_video_window_id([LinphoneManager getLc],(unsigned long)videoView);
linphone_core_set_native_preview_window_id([LinphoneManager getLc],(unsigned long)videoPreview);
@ -226,10 +230,13 @@ void addAnimationFadeTransition(UIView* view, float duration) {
}
-(void) disableVideoDisplay {
[videoGroup setHidden:TRUE];
[controlSubView setHidden:FALSE];
[hangUpView setHidden:FALSE];
[callTableView setHidden:FALSE];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[videoGroup setAlpha:0.0];
[controlSubView setAlpha:1.0];
[hangUpView setAlpha:1.0];
[callTableView setAlpha:1.0];
[UIView commitAnimations];
if (hideControlsTimer != nil) {
[hideControlsTimer invalidate];
@ -278,10 +285,15 @@ void addAnimationFadeTransition(UIView* view, float duration) {
[LinphoneManager set:pause hidden:YES withName:"PAUSE button" andReason:AT];
}
if (linphone_call_params_video_enabled(linphone_call_get_current_params(selectedCall))) {
addVideo.titleLabel.text = NSLocalizedString(@"-video", nil);
if (linphone_call_get_state(selectedCall) == LinphoneCallStreamsRunning) {
if (linphone_call_params_video_enabled(linphone_call_get_current_params(selectedCall))) {
[addVideo setTitle:NSLocalizedString(@"-video", nil) forState:UIControlStateNormal];
} else {
[addVideo setTitle:NSLocalizedString(@"+video", nil) forState:UIControlStateNormal];
}
[addVideo setEnabled:YES];
} else {
addVideo.titleLabel.text = NSLocalizedString(@"+video", nil);
[addVideo setEnabled:NO];
}
} else {
if (callsCount == 1) {
@ -294,6 +306,7 @@ void addAnimationFadeTransition(UIView* view, float duration) {
} else {
[LinphoneManager set:pause hidden:YES withName:"PAUSE button" andReason:AT];
}
[addVideo setEnabled:NO];
}
[LinphoneManager set:mergeCalls hidden:!pause.hidden withName:"MERGE button" andReason:AT];
@ -450,8 +463,7 @@ void addAnimationFadeTransition(UIView* view, float duration) {
if ([device respondsToSelector:@selector(isMultitaskingSupported)]
&& [device isMultitaskingSupported]) {
bool enableVideo = [[NSUserDefaults standardUserDefaults] boolForKey:@"enable_video_preference"];
bool startVideo = [[NSUserDefaults standardUserDefaults] boolForKey:@"start_video_preference"];
[LinphoneManager set:contacts hidden:enableVideo withName:"CONTACT button" andReason:AT];
[LinphoneManager set:addVideo hidden:!contacts.hidden withName:"ADD_VIDEO button" andReason:AT];
}

View file

@ -81,7 +81,7 @@
<string key="NSFrameSize">{320, 460}</string>
<reference key="NSSuperview" ref="858247959"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<reference key="NSNextKeyView" ref="1017044170"/>
<string key="NSReuseIdentifierKey">_NS:196</string>
<reference key="IBUIBackgroundColor" ref="95762599"/>
<bool key="IBUIAutoresizesSubviews">NO</bool>
@ -316,8 +316,12 @@
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">video</string>
<string key="IBUIDisabledTitle">video</string>
<reference key="IBUIHighlightedTitleColor" ref="816037173"/>
<object class="NSColor" key="IBUIDisabledTitleColor" id="392721472">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MzE0IDAuMzA5ODAzOTIxNiAwLjUyMTU2ODYyNzUAA</bytes>
@ -464,10 +468,7 @@
<reference key="NSSuperview" ref="759087764"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="323385706"/>
<object class="NSColor" key="IBUIBackgroundColor" id="392721472">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
</object>
<reference key="IBUIBackgroundColor" ref="392721472"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@ -1324,6 +1325,7 @@
<string>120.IBPluginDependency</string>
<string>123.CustomClassName</string>
<string>123.IBPluginDependency</string>
<string>123.IBUIButtonInspectorSelectedStateConfigurationMetadataKey</string>
<string>126.IBPluginDependency</string>
<string>127.IBPluginDependency</string>
<string>13.CustomClassName</string>
@ -1384,6 +1386,7 @@
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>UIToggleVideoButton</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<real value="3"/>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>UISpeakerButton</string>
@ -1441,7 +1444,7 @@
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">134</int>
<int key="maxID">136</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">

View file

@ -188,7 +188,7 @@ extern void libmsbcg729_init();
forUser:lUserName
withDisplayName:lDisplayName];
break;
case LinphoneCallPausedByRemote:
case LinphoneCallConnected:
[callDelegate displayInCall: call
FromUI:mCurrentViewController