Add 'busy' indicator when pressing add/remove video button

This commit is contained in:
Pierre-Eric Pelloux-Prayer 2012-03-23 15:08:04 +01:00
parent 6bdb1428cf
commit 7a63d313ef
7 changed files with 111 additions and 41 deletions

View file

@ -22,6 +22,7 @@
#import "ConferenceCallDetailView.h"
#import <AddressBookUI/ABPeoplePickerNavigationController.h>
#include "UILinphone.h"
#import "UIToggleVideoButton.h"
@class VideoViewController;
@ -36,7 +37,7 @@
UIButton* pause;
UISpeakerButton* speaker;
UIButton* contacts;
UIButton* addVideo;
UIToggleVideoButton* addVideo;
UITableView* callTableView;
UIButton* addCall, *mergeCalls;
@ -63,6 +64,7 @@
UIView* videoPreview;
UIImageView* videoCallQuality;
UICamSwitch* videoCameraSwitch;
UIActivityIndicatorView* videoUpdateIndicator;
bool dismissed;
@ -108,7 +110,7 @@
@property (nonatomic, retain) IBOutlet UIButton* pause;
@property (nonatomic, retain) IBOutlet UIButton* speaker;
@property (nonatomic, retain) IBOutlet UIButton* contacts;
@property (nonatomic, retain) IBOutlet UIButton* addVideo;
@property (nonatomic, retain) IBOutlet UIToggleVideoButton* addVideo;
@property (nonatomic, retain) IBOutlet UITableView* callTableView;
@property (nonatomic, retain) IBOutlet UIButton* addCall;
@property (nonatomic, retain) IBOutlet UIButton* mergeCalls;
@ -133,4 +135,5 @@
@property (nonatomic, retain) IBOutlet UIView* videoPreview;
@property (nonatomic, retain) IBOutlet UIImageView* videoCallQuality;
@property (nonatomic, retain) IBOutlet UICamSwitch* videoCameraSwitch;
@property (nonatomic, retain) IBOutlet UIActivityIndicatorView* videoUpdateIndicator;
@end

View file

@ -72,6 +72,7 @@ const NSInteger SECURE_BUTTON_TAG=5;
@synthesize videoPreview;
@synthesize videoCallQuality;
@synthesize videoCameraSwitch;
@synthesize videoUpdateIndicator;
@synthesize addVideo;
@ -261,7 +262,7 @@ void addAnimationFadeTransition(UIView* view, float duration) {
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
}
-(void) updateUIFromLinphoneState:(UIViewController *)viewCtrl {
-(void) updateUIFromLinphoneState:(BOOL) fullUpdate {
activeCallCell = nil;
[mute reset];
@ -291,17 +292,21 @@ void addAnimationFadeTransition(UIView* view, float duration) {
[LinphoneManager set:pause hidden:YES withName:"PAUSE button" andReason:AT];
}
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];
[IncallViewController updateIndicator: videoCallQuality withCallQuality:linphone_call_get_average_quality(selectedCall)];
if (fullUpdate) {
videoUpdateIndicator.hidden = YES;
LinphoneCallState state = linphone_call_get_state(selectedCall);
if (state == LinphoneCallStreamsRunning || state == LinphoneCallUpdated || state == LinphoneCallUpdatedByRemote) {
if (linphone_call_params_video_enabled(linphone_call_get_current_params(selectedCall))) {
[addVideo setTitle:NSLocalizedString(@"-video", nil) forState:UIControlStateNormal];
[IncallViewController updateIndicator: videoCallQuality withCallQuality:linphone_call_get_average_quality(selectedCall)];
} else {
[addVideo setTitle:NSLocalizedString(@"+video", nil) forState:UIControlStateNormal];
}
[addVideo setEnabled:YES];
} else {
[addVideo setTitle:NSLocalizedString(@"+video", nil) forState:UIControlStateNormal];
[addVideo setEnabled:NO];
[videoCallQuality setImage:nil];
}
[addVideo setEnabled:YES];
} else {
[addVideo setEnabled:NO];
[videoCallQuality setImage:nil];
}
} else {
if (callsCount == 1) {
@ -388,6 +393,7 @@ void addAnimationFadeTransition(UIView* view, float duration) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil];
[videoCameraSwitch setPreview:videoPreview];
addVideo.videoUpdateIndicator = videoUpdateIndicator;
}
-(void) addCallPressed {
@ -433,7 +439,7 @@ void addAnimationFadeTransition(UIView* view, float duration) {
-(void)updateCallsDurations {
[self updateUIFromLinphoneState: nil];
[self updateUIFromLinphoneState: NO];
}
-(void) awakeFromNib
@ -523,7 +529,7 @@ void addAnimationFadeTransition(UIView* view, float duration) {
device.proximityMonitoringEnabled = YES;
if ([speaker isOn])
[speaker toggle];
[self updateUIFromLinphoneState: nil];
[self updateUIFromLinphoneState: YES];
}
-(void) displayIncomingCall:(LinphoneCall *)call NotificationFromUI:(UIViewController *)viewCtrl forUser:(NSString *)username withDisplayName:(NSString *)displayName {
@ -537,7 +543,7 @@ void addAnimationFadeTransition(UIView* view, float duration) {
if (call !=nil && linphone_call_get_dir(call)==LinphoneCallIncoming) {
if ([speaker isOn]) [speaker toggle];
}
[self updateUIFromLinphoneState: nil];
[self updateUIFromLinphoneState: YES];
[self disableVideoDisplay];
}
@ -560,11 +566,12 @@ void addAnimationFadeTransition(UIView* view, float duration) {
[self dismissModalViewControllerAnimated:FALSE]; //disable animation to avoid blanc bar just below status bar*/
dismissed = true;
[self updateUIFromLinphoneState: nil];
[self updateUIFromLinphoneState: YES];
}
-(void) displayVideoCall:(LinphoneCall*) call FromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName {
[self enableVideoDisplay];
[self updateUIFromLinphoneState: YES];
return;
if (mIncallViewIsReady) {
@ -1017,7 +1024,7 @@ void addAnimationFadeTransition(UIView* view, float duration) {
linphone_core_resume_call([LinphoneManager getLc], selectedCall);
}
[self updateUIFromLinphoneState: nil];
[self updateUIFromLinphoneState: YES];
}

View file

@ -12,12 +12,13 @@
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>IBUITableView</string>
<string>IBUIViewController</string>
<string>IBUIImageView</string>
<string>IBUIView</string>
<string>IBUIButton</string>
<string>IBUIImageView</string>
<string>IBUIViewController</string>
<string>IBProxyObject</string>
<string>IBUIActivityIndicatorView</string>
<string>IBUITableView</string>
<string>IBUIView</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@ -172,6 +173,7 @@
<string key="NSFrame">{{0, 1}, {320, 66}}</string>
<reference key="NSSuperview" ref="30856702"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MSAwIDAuMDgyMzIwMjU5MDQgMC4xOAA</bytes>
@ -344,7 +346,7 @@
<string key="NSFrame">{{213, 70}, {107, 66}}</string>
<reference key="NSSuperview" ref="585669622"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="30856702"/>
<reference key="NSNextKeyView" ref="285340834"/>
<reference key="IBUIBackgroundColor" ref="95762599"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
@ -371,6 +373,19 @@
<reference key="IBUIFontDescription" ref="974614377"/>
<reference key="IBUIFont" ref="773313654"/>
</object>
<object class="IBUIActivityIndicatorView" id="285340834">
<reference key="NSNextResponder" ref="585669622"/>
<int key="NSvFlags">-2147483356</int>
<string key="NSFrame">{{247.5, 84.5}, {37, 37}}</string>
<reference key="NSSuperview" ref="585669622"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="30856702"/>
<string key="NSReuseIdentifierKey">_NS:1030</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIHidesWhenStopped">NO</bool>
<int key="IBUIStyle">0</int>
</object>
<object class="IBUIButton" id="752456321">
<reference key="NSNextResponder" ref="585669622"/>
<int key="NSvFlags">292</int>
@ -1061,6 +1076,14 @@
</object>
<int key="connectionID">141</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">videoUpdateIndicator</string>
<reference key="source" ref="841351856"/>
<reference key="destination" ref="285340834"/>
</object>
<int key="connectionID">143</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">doAction:</string>
@ -1193,6 +1216,7 @@
<reference ref="861550739"/>
<reference ref="1031005817"/>
<reference ref="484501311"/>
<reference ref="285340834"/>
</object>
<reference key="parent" ref="858247959"/>
<string key="objectName">controls</string>
@ -1372,6 +1396,12 @@
<reference key="parent" ref="858247959"/>
<string key="objectName">camswitch</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">142</int>
<reference key="object" ref="285340834"/>
<reference key="parent" ref="585669622"/>
<string key="objectName">video_update_indicator</string>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@ -1402,6 +1432,7 @@
<string>137.IBPluginDependency</string>
<string>140.CustomClassName</string>
<string>140.IBPluginDependency</string>
<string>142.IBPluginDependency</string>
<string>15.IBPluginDependency</string>
<string>16.CustomClassName</string>
<string>16.IBPluginDependency</string>
@ -1467,6 +1498,7 @@
<string>UICamSwitch</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>UIMuteButton</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<real value="2"/>
@ -1517,7 +1549,7 @@
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">141</int>
<int key="maxID">143</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@ -1570,6 +1602,7 @@
<string>videoCameraSwitch</string>
<string>videoGroup</string>
<string>videoPreview</string>
<string>videoUpdateIndicator</string>
<string>videoView</string>
<string>videoViewController</string>
<string>zero</string>
@ -1577,7 +1610,7 @@
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UIButton</string>
<string>UIButton</string>
<string>UIToggleVideoButton</string>
<string>UITableView</string>
<string>UIButton</string>
<string>UIViewController</string>
@ -1606,6 +1639,7 @@
<string>UICamSwitch</string>
<string>UIView</string>
<string>UIView</string>
<string>UIActivityIndicatorView</string>
<string>UIView</string>
<string>VideoViewController</string>
<string>UIButton</string>
@ -1645,6 +1679,7 @@
<string>videoCameraSwitch</string>
<string>videoGroup</string>
<string>videoPreview</string>
<string>videoUpdateIndicator</string>
<string>videoView</string>
<string>videoViewController</string>
<string>zero</string>
@ -1657,7 +1692,7 @@
</object>
<object class="IBToOneOutletInfo">
<string key="name">addVideo</string>
<string key="candidateClassName">UIButton</string>
<string key="candidateClassName">UIToggleVideoButton</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">callTableView</string>
@ -1771,6 +1806,10 @@
<string key="name">videoPreview</string>
<string key="candidateClassName">UIView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">videoUpdateIndicator</string>
<string key="candidateClassName">UIActivityIndicatorView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">videoView</string>
<string key="candidateClassName">UIView</string>
@ -1852,6 +1891,17 @@
<object class="IBPartialClassDescription">
<string key="className">UIToggleVideoButton</string>
<string key="superclassName">UIButton</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">videoUpdateIndicator</string>
<string key="NS.object.0">UIActivityIndicatorView</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">videoUpdateIndicator</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">videoUpdateIndicator</string>
<string key="candidateClassName">UIActivityIndicatorView</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/UIToggleVideoButton.h</string>

View file

@ -162,19 +162,7 @@ extern void libmsbcg729_init();
bool canHideInCallView = (linphone_core_get_calls([LinphoneManager getLc]) == NULL);
switch (new_state) {
case LinphoneCallStreamsRunning:
//check video
if (linphone_call_params_video_enabled(linphone_call_get_current_params(call))) {
[callDelegate displayVideoCall:call FromUI:mCurrentViewController
forUser:lUserName
withDisplayName:lDisplayName];
} else {
[callDelegate displayInCall:call FromUI:mCurrentViewController forUser:lUserName withDisplayName:lDisplayName];
}
break;
switch (new_state) {
case LinphoneCallIncomingReceived:
[callDelegate displayIncomingCall:call
NotificationFromUI:mCurrentViewController
@ -276,8 +264,18 @@ extern void libmsbcg729_init();
withDisplayName:lDisplayName];
}
break;
default:
case LinphoneCallStreamsRunning:
//check video
if (linphone_call_params_video_enabled(linphone_call_get_current_params(call))) {
[callDelegate displayVideoCall:call FromUI:mCurrentViewController
forUser:lUserName
withDisplayName:lDisplayName];
} else {
[callDelegate displayInCall:call FromUI:mCurrentViewController forUser:lUserName withDisplayName:lDisplayName];
}
break;
default:
break;
}
}

View file

@ -19,6 +19,12 @@
#import <UIKit/UIKit.h>
@interface UIToggleVideoButton : UIButton
@interface UIToggleVideoButton : UIButton {
UIActivityIndicatorView* videoUpdateIndicator;
}
- (id)initWithCoder:(NSCoder *)decoder;
@property (nonatomic, retain) IBOutlet UIActivityIndicatorView* videoUpdateIndicator;
@end

View file

@ -22,12 +22,18 @@
@implementation UIToggleVideoButton
@synthesize videoUpdateIndicator;
-(void) touchUp:(id) sender {
LinphoneCore* lc = [LinphoneManager getLc];
if (!linphone_core_video_enabled(lc))
return;
[videoUpdateIndicator startAnimating];
videoUpdateIndicator.hidden = NO;
self.enabled = NO;
LinphoneCall* call = linphone_core_get_current_call([LinphoneManager getLc]);
if (call) {
LinphoneCallParams* call_params = linphone_call_params_copy(linphone_call_get_current_params(call));

@ -1 +1 @@
Subproject commit 058d6b2972138f8d2b3eb945fca19980544a1f12
Subproject commit a43d75d8a36099f14638eaf14606535fe559df7b