Call bar: disable pause and options buttons until call is ready for them

This commit is contained in:
Gautier Pelloux-Prayer 2015-07-16 12:00:19 +02:00
parent 298dec5948
commit 009bb78e7c
4 changed files with 28 additions and 37 deletions

View file

@ -36,7 +36,7 @@
@property (nonatomic, strong) IBOutlet UIMicroButton* microButton;
@property (nonatomic, strong) IBOutlet UISpeakerButton* speakerButton;
@property (nonatomic, strong) IBOutlet UIToggleButton* routesButton;
@property (nonatomic, strong) IBOutlet UIToggleButton* optionsButton;
@property(nonatomic, strong) IBOutlet UIToggleButton *optionsButton;
@property (nonatomic, strong) IBOutlet UIHangUpButton* hangupButton;
@property (nonatomic, strong) IBOutlet UIView* padView;
@property (nonatomic, strong) IBOutlet UIView* routesView;

View file

@ -177,12 +177,17 @@
{
UIButton *optionsButtonLandscape = (UIButton *)[landscapeView viewWithTag:[optionsButton tag]];
// Set selected+disabled background: IB lack !
[optionsButton setBackgroundImage:[UIImage imageNamed:@"options_disabled.png"]
forState:(UIControlStateDisabled | UIControlStateSelected)];
[optionsButtonLandscape setBackgroundImage:[UIImage imageNamed:@"options_disabled_landscape.png"]
forState:(UIControlStateDisabled | UIControlStateSelected)];
// Set selected+over background: IB lack !
[optionsButton setBackgroundImage:[UIImage imageNamed:@"options_over.png"]
forState:(UIControlStateHighlighted | UIControlStateSelected)];
[optionsButtonLandscape setBackgroundImage:[UIImage imageNamed:@"options_over_landscape.png"]
forState:(UIControlStateHighlighted | UIControlStateSelected)];
[LinphoneUtils buttonFixStates:optionsButton];
[LinphoneUtils buttonFixStates:optionsButtonLandscape];
}
@ -269,6 +274,9 @@
[videoButton update];
[hangupButton update];
optionsButton.enabled =
(state == LinphoneCallPaused || state == LinphoneCallPausing || state == LinphoneCallStreamsRunning);
// Show Pause/Conference button following call count
if (linphone_core_get_calls_nb(lc) > 1) {
if (![pauseButton isHidden]) {

View file

@ -152,47 +152,30 @@
- (bool)onUpdate {
bool ret = false;
// TODO: disable pause on not running call
LinphoneCore *lc = [LinphoneManager getLc];
LinphoneCall *c = call;
switch (type) {
case UIPauseButtonType_Call: {
if (call != nil) {
LinphoneCallState state = linphone_call_get_state(call);
if (state == LinphoneCallPaused || state == LinphoneCallPausing) {
ret = true;
case UIPauseButtonType_Conference: {
self.enabled = (linphone_core_get_conference_size(lc) > 0);
if (self.enabled) {
ret = (!linphone_core_is_in_conference(lc));
}
[self setEnabled:TRUE];
} else {
[self setEnabled:FALSE];
break;
}
break;
}
case UIPauseButtonType_Conference: {
if (linphone_core_get_conference_size(lc) > 0) {
if (!linphone_core_is_in_conference(lc)) {
ret = true;
case UIPauseButtonType_CurrentCall:
c = [UIPauseButton getCall];
case UIPauseButtonType_Call: {
if (c != nil) {
LinphoneCallState state = linphone_call_get_state(c);
ret = (state == LinphoneCallPaused || state == LinphoneCallPausing);
self.enabled = (state == LinphoneCallPaused || state == LinphoneCallPausing ||
state == LinphoneCallStreamsRunning);
} else {
self.enabled = FALSE;
}
[self setEnabled:TRUE];
} else {
[self setEnabled:FALSE];
break;
}
break;
}
case UIPauseButtonType_CurrentCall: {
LinphoneCall *currentCall = [UIPauseButton getCall];
if (currentCall != nil) {
LinphoneCallState state = linphone_call_get_state(currentCall);
if (state == LinphoneCallPaused || state == LinphoneCallPausing) {
ret = true;
}
[self setEnabled:TRUE];
} else {
[self setEnabled:FALSE];
}
break;
}
}
return ret;
}

@ -1 +1 @@
Subproject commit 3312e8be0bc8336aecf6feffc4cdae9b1cc6904a
Subproject commit 04c43a9f64db5152e2859528c40dbd79008ccf5b