From f6d7d8f74f7b1fe1263450503f110fe11cb9a5e6 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 9 Aug 2012 17:06:35 +0200 Subject: [PATCH] Remove pad view hiding when InCall view appear --- Classes/LinphoneUI/UICallBar.m | 190 ++++++++++++++++++--------------- 1 file changed, 102 insertions(+), 88 deletions(-) diff --git a/Classes/LinphoneUI/UICallBar.m b/Classes/LinphoneUI/UICallBar.m index 2a7ae4deb..f71969973 100644 --- a/Classes/LinphoneUI/UICallBar.m +++ b/Classes/LinphoneUI/UICallBar.m @@ -197,8 +197,6 @@ setImage:[UIImage imageNamed:@"dialer_alt_back_over_landscape.png"] forState:(UIControlStateHighlighted | UIControlStateSelected)]; - [optionsView setHidden:TRUE]; - [padView setHidden:TRUE]; [super viewDidLoad]; } @@ -213,8 +211,8 @@ LinphoneCall* call = linphone_core_get_current_call([LinphoneManager getLc]); LinphoneCallState state = (call != NULL)?linphone_call_get_state(call): 0; [self callUpdate:call state:state]; - [self hideOptions]; - [self hidePad]; + [self hideOptions:FALSE]; + [self hidePad:FALSE]; } - (void)viewWillDisappear:(BOOL)animated { @@ -275,8 +273,8 @@ LinphoneCallError: LinphoneCallIncoming: LinphoneCallOutgoing: - [self hidePad]; - [self hideOptions]; + [self hidePad:TRUE]; + [self hideOptions:TRUE]; default: break; } @@ -285,105 +283,121 @@ #pragma mark - -- (void)showPad{ +- (void)showPad:(BOOL)animated { [dialerButton setOn]; if([padView isHidden]) { - CGRect frame = [padView frame]; - int original_y = frame.origin.y; - frame.origin.y = [[self view] frame].size.height; - [padView setFrame:frame]; - [padView setHidden:FALSE]; - CPAnimationSequence* move = [[CPAnimationSequence sequenceWithSteps: - [[CPAnimationStep after:0.0 - for:0.5 - options:UIViewAnimationOptionCurveEaseOut - animate:^{ + if(animated) { CGRect frame = [padView frame]; - frame.origin.y = original_y; - [padView setFrame:frame]; - }] autorelease], - nil - ] autorelease]; - [move run]; + int original_y = frame.origin.y; + frame.origin.y = [[self view] frame].size.height; + [padView setFrame:frame]; + [padView setHidden:FALSE]; + CPAnimationSequence* move = [[CPAnimationSequence sequenceWithSteps: + [[CPAnimationStep after:0.0 + for:0.5 + options:UIViewAnimationOptionCurveEaseOut + animate:^{ + CGRect frame = [padView frame]; + frame.origin.y = original_y; + [padView setFrame:frame]; + }] autorelease], + nil + ] autorelease]; + [move run]; + } else { + [padView setHidden:FALSE]; + } } } -- (void)hidePad{ +- (void)hidePad:(BOOL)animated { [dialerButton setOff]; if(![padView isHidden]) { - CGRect frame = [padView frame]; - int original_y = frame.origin.y; - - CPAnimationSequence* move = [[CPAnimationSequence sequenceWithSteps: - [[CPAnimationStep after:0.0 - for:0.5 - options:UIViewAnimationOptionCurveEaseIn - animate:^{ + if(animated) { CGRect frame = [padView frame]; - frame.origin.y = [[self view] frame].size.height; - [padView setFrame:frame]; - }] autorelease], - [[CPAnimationStep after:0.0 - animate:^{ - CGRect frame = [padView frame]; - frame.origin.y = original_y; + int original_y = frame.origin.y; + + CPAnimationSequence* move = [[CPAnimationSequence sequenceWithSteps: + [[CPAnimationStep after:0.0 + for:0.5 + options:UIViewAnimationOptionCurveEaseIn + animate:^{ + CGRect frame = [padView frame]; + frame.origin.y = [[self view] frame].size.height; + [padView setFrame:frame]; + }] autorelease], + [[CPAnimationStep after:0.0 + animate:^{ + CGRect frame = [padView frame]; + frame.origin.y = original_y; + [padView setHidden:TRUE]; + [padView setFrame:frame]; + }] autorelease], + nil + ] autorelease]; + [move run]; + } else { [padView setHidden:TRUE]; - [padView setFrame:frame]; - }] autorelease], - nil - ] autorelease]; - [move run]; + } } } -- (void)showOptions{ +- (void)showOptions:(BOOL)animated { [optionsButton setOn]; if([optionsView isHidden]) { - CGRect frame = [optionsView frame]; - int original_y = frame.origin.y; - frame.origin.y = [[self view] frame].size.height; - [optionsView setFrame:frame]; - [optionsView setHidden:FALSE]; - CPAnimationSequence* move = [[CPAnimationSequence sequenceWithSteps: - [[CPAnimationStep after:0.0 - for:0.5 - options:UIViewAnimationOptionCurveEaseOut - animate:^{ + if(animated) { CGRect frame = [optionsView frame]; - frame.origin.y = original_y; - [optionsView setFrame:frame]; - }] autorelease], - nil - ] autorelease]; - [move run]; + int original_y = frame.origin.y; + frame.origin.y = [[self view] frame].size.height; + [optionsView setFrame:frame]; + [optionsView setHidden:FALSE]; + CPAnimationSequence* move = [[CPAnimationSequence sequenceWithSteps: + [[CPAnimationStep after:0.0 + for:0.5 + options:UIViewAnimationOptionCurveEaseOut + animate:^{ + CGRect frame = [optionsView frame]; + frame.origin.y = original_y; + [optionsView setFrame:frame]; + }] autorelease], + nil + ] autorelease]; + [move run]; + } else { + [optionsView setHidden:FALSE]; + } } } -- (void)hideOptions{ +- (void)hideOptions:(BOOL)animated { [optionsButton setOff]; if(![optionsView isHidden]) { - CGRect frame = [optionsView frame]; - int original_y = frame.origin.y; - - CPAnimationSequence* move = [[CPAnimationSequence sequenceWithSteps: - [[CPAnimationStep after:0.0 - for:0.5 - options:UIViewAnimationOptionCurveEaseIn - animate:^{ + if(animated) { CGRect frame = [optionsView frame]; - frame.origin.y = [[self view] frame].size.height; - [optionsView setFrame:frame]; - }] autorelease], - [[CPAnimationStep after:0.0 - animate:^{ - CGRect frame = [optionsView frame]; - frame.origin.y = original_y; + int original_y = frame.origin.y; + + CPAnimationSequence* move = [[CPAnimationSequence sequenceWithSteps: + [[CPAnimationStep after:0.0 + for:0.5 + options:UIViewAnimationOptionCurveEaseIn + animate:^{ + CGRect frame = [optionsView frame]; + frame.origin.y = [[self view] frame].size.height; + [optionsView setFrame:frame]; + }] autorelease], + [[CPAnimationStep after:0.0 + animate:^{ + CGRect frame = [optionsView frame]; + frame.origin.y = original_y; + [optionsView setHidden:TRUE]; + [optionsView setFrame:frame]; + }] autorelease], + nil + ] autorelease]; + [move run]; + } else { [optionsView setHidden:TRUE]; - [optionsView setFrame:frame]; - }] autorelease], - nil - ] autorelease]; - [move run]; + } } } @@ -392,14 +406,14 @@ - (IBAction)onPadClick:(id)sender { if([padView isHidden]) { - [self showPad]; + [self showPad:TRUE]; } else { - [self hidePad]; + [self hidePad:TRUE]; } } - (IBAction)onOptionsTransferClick:(id)sender { - [self hideOptions]; + [self hideOptions:TRUE]; // Go to dialer view DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[DialerViewController compositeViewDescription]], DialerViewController); if(controller != nil) { @@ -409,7 +423,7 @@ } - (IBAction)onOptionsAddClick:(id)sender { - [self hideOptions]; + [self hideOptions:TRUE]; // Go to dialer view DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[DialerViewController compositeViewDescription]], DialerViewController); if(controller != nil) { @@ -420,9 +434,9 @@ - (IBAction)onOptionsClick:(id)sender { if([optionsView isHidden]) { - [self showOptions]; + [self showOptions:TRUE]; } else { - [self hideOptions]; + [self hideOptions:TRUE]; } }