diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 2931fba38..8c7551de6 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -363,7 +363,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); [tokenString appendFormat:@"%02X", (unsigned int)tokenBuffer[i]]; } // NSLocalizedString(@"IC_MSG", nil); // Fake - NSString *params = [NSString stringWithFormat:@"APN-TOK=%@;APN-MSG=IC_MSG;APN-SND=oldphone-mono-30s.caf", tokenString]; + NSString *params = [NSString stringWithFormat:@"APN-TOK=%@;APN-MSG=IM_MSG;APN-CAL=IC_MSG;APN-SND=oldphone-mono-30s.caf", tokenString]; linphone_proxy_config_set_contact_parameters(proxyCfg, [params UTF8String]); } diff --git a/Classes/LinphoneUI/UIChatCell.m b/Classes/LinphoneUI/UIChatCell.m index aadba1a95..acfecb71a 100644 --- a/Classes/LinphoneUI/UIChatCell.m +++ b/Classes/LinphoneUI/UIChatCell.m @@ -99,25 +99,33 @@ // Message [chatContentLabel setText:[chat message]]; - +} + +- (void)layoutSubviews { + [super layoutSubviews]; // // Adapt size // CGRect displayNameFrame = [addressLabel frame]; CGRect chatContentFrame = [chatContentLabel frame]; - chatContentFrame.origin.x -= displayNameFrame.size.width; - // Compute firstName size - CGSize contraints; - contraints.height = [addressLabel frame].size.height; - contraints.width = ([chatContentLabel frame].size.width + [chatContentLabel frame].origin.x) - [addressLabel frame].origin.x; - CGSize firstNameSize = [[addressLabel text] sizeWithFont:[addressLabel font] constrainedToSize: contraints]; - displayNameFrame.size.width = firstNameSize.width; + CGSize displayNameSize = [[addressLabel text] sizeWithFont:[addressLabel font]]; + CGSize chatContentSize = [[chatContentLabel text] sizeWithFont:[chatContentLabel font]]; + float sum = displayNameSize.width + 5 + chatContentSize.width; + float limit = self.bounds.size.width - 5 - displayNameFrame.origin.x; + if(sum >limit) { + displayNameSize.width *= limit/sum; + chatContentSize.width *= limit/sum; + } + + displayNameFrame.size.width = displayNameSize.width; + chatContentFrame.size.width = chatContentSize.width; // Compute lastName size & position - chatContentFrame.origin.x += displayNameFrame.size.width; - chatContentFrame.size.width = (contraints.width + [addressLabel frame].origin.x) - chatContentFrame.origin.x; + chatContentFrame.origin.x = displayNameFrame.origin.x + displayNameFrame.size.width; + if(displayNameFrame.size.width) + chatContentFrame.origin.x += 5; [addressLabel setFrame: displayNameFrame]; [chatContentLabel setFrame: chatContentFrame]; diff --git a/Classes/LinphoneUI/UIChatRoomCell.h b/Classes/LinphoneUI/UIChatRoomCell.h index cfc479c23..7bbb46af9 100644 --- a/Classes/LinphoneUI/UIChatRoomCell.h +++ b/Classes/LinphoneUI/UIChatRoomCell.h @@ -23,7 +23,7 @@ @interface UIChatRoomCell : UITableViewCell { UIImageView *backgroundImage; - UIView *contentView; + UIView *innerView; UIView *messageView; UILabel *messageLabel; UIButton *deleteButton; @@ -33,7 +33,7 @@ } @property (nonatomic, retain) ChatModel *chat; -@property (nonatomic, retain) IBOutlet UIView *contentView; +@property (nonatomic, retain) IBOutlet UIView *innerView; @property (nonatomic, retain) IBOutlet UIView *messageView; @property (nonatomic, retain) IBOutlet UIImageView* backgroundImage; @property (nonatomic, retain) IBOutlet UILabel *messageLabel; diff --git a/Classes/LinphoneUI/UIChatRoomCell.m b/Classes/LinphoneUI/UIChatRoomCell.m index 44b261a31..e9351809d 100644 --- a/Classes/LinphoneUI/UIChatRoomCell.m +++ b/Classes/LinphoneUI/UIChatRoomCell.m @@ -24,7 +24,7 @@ @implementation UIChatRoomCell -@synthesize contentView; +@synthesize innerView; @synthesize messageView; @synthesize backgroundImage; @synthesize messageLabel; @@ -47,14 +47,14 @@ static UIFont *CELL_FONT = nil; [[NSBundle mainBundle] loadNibNamed:@"UIChatRoomCell" owner:self options:nil]; - [self addSubview:contentView]; + [self addSubview:innerView]; } return self; } - (void)dealloc { [backgroundImage release]; - [contentView release]; + [innerView release]; [messageView release]; [messageLabel release]; [deleteButton release]; @@ -143,20 +143,20 @@ static UIFont *CELL_FONT = nil; - (void)layoutSubviews { [super layoutSubviews]; if(chat != nil) { - // Resize Content - CGRect contentFrame = [contentView frame]; - contentFrame.size = [UIChatRoomCell viewSize:[chat message] width:[self frame].size.width]; + // Resize inner + CGRect innerFrame; + innerFrame.size = [UIChatRoomCell viewSize:[chat message] width:[self frame].size.width]; if([[chat direction] intValue]) { // Inverted - contentFrame.origin.x = 0.0f; - contentFrame.origin.y = 0.0f; + innerFrame.origin.x = 0.0f; + innerFrame.origin.y = 0.0f; } else { - contentFrame.origin.x = [self frame].size.width - contentFrame.size.width; - contentFrame.origin.y = 0.0f; + innerFrame.origin.x = [self frame].size.width - innerFrame.size.width; + innerFrame.origin.y = 0.0f; } - [contentView setFrame:contentFrame]; + [innerView setFrame:innerFrame]; CGRect messageFrame = [messageView frame]; - messageFrame.origin.y = ([contentView frame].size.height - messageFrame.size.height)/2; + messageFrame.origin.y = ([innerView frame].size.height - messageFrame.size.height)/2; if([[chat direction] intValue]) { // Inverted [backgroundImage setImage:[TUNinePatchCache imageOfSize:[backgroundImage bounds].size forNinePatchNamed:@"chat_bubble_incoming"]]; diff --git a/Classes/LinphoneUI/UIChatRoomCell.xib b/Classes/LinphoneUI/UIChatRoomCell.xib index b5bdba778..3b9e82293 100644 --- a/Classes/LinphoneUI/UIChatRoomCell.xib +++ b/Classes/LinphoneUI/UIChatRoomCell.xib @@ -35,7 +35,7 @@ - 301 + 256 @@ -227,14 +227,6 @@ 13 - - - contentView - - - - 14 - messageLabel @@ -267,6 +259,14 @@ 24 + + + innerView + + + + 25 + onDeleteClick: @@ -304,7 +304,7 @@ - contentView + innerView 7 @@ -375,7 +375,7 @@ - 24 + 25 @@ -395,9 +395,9 @@ UIImageView - UIView UILabel UIButton + UIView UILabel UIView @@ -406,10 +406,6 @@ backgroundImage UIImageView - - contentView - UIView - dateLabel UILabel @@ -418,6 +414,10 @@ deleteButton UIButton + + innerView + UIView + messageLabel UILabel diff --git a/Classes/LinphoneUI/UICompositeViewController.m b/Classes/LinphoneUI/UICompositeViewController.m index a57ff28b9..7de22a1e4 100644 --- a/Classes/LinphoneUI/UICompositeViewController.m +++ b/Classes/LinphoneUI/UICompositeViewController.m @@ -251,7 +251,7 @@ // Update rotation UIInterfaceOrientation correctOrientation = [self getCorrectInterfaceOrientation:[[UIDevice currentDevice] orientation]]; if(currentOrientation != correctOrientation) { - [PhoneMainView forceOrientation:correctOrientation animated:currentOrientation!=UIDeviceOrientationUnknown]; + [PhoneMainView setOrientation:correctOrientation animated:currentOrientation!=UIDeviceOrientationUnknown]; } } @@ -439,7 +439,7 @@ // Update rotation UIInterfaceOrientation correctOrientation = [self getCorrectInterfaceOrientation:[[UIDevice currentDevice] orientation]]; if(currentOrientation != correctOrientation) { - [PhoneMainView forceOrientation:correctOrientation animated:currentOrientation!=UIDeviceOrientationUnknown]; + [PhoneMainView setOrientation:correctOrientation animated:currentOrientation!=UIDeviceOrientationUnknown]; } else { [self updateInterfaceOrientation:correctOrientation]; } diff --git a/Classes/LinphoneUI/UIContactCell.m b/Classes/LinphoneUI/UIContactCell.m index 8e087186a..bee9f1448 100644 --- a/Classes/LinphoneUI/UIContactCell.m +++ b/Classes/LinphoneUI/UIContactCell.m @@ -111,7 +111,7 @@ // Compute firstName size CGSize firstNameSize = [[firstNameLabel text] sizeWithFont:[firstNameLabel font]]; - CGSize lastNameSize = [[lastNameLabel text] sizeWithFont:[firstNameLabel font]]; + CGSize lastNameSize = [[lastNameLabel text] sizeWithFont:[lastNameLabel font]]; float sum = firstNameSize.width + 5 + lastNameSize.width; float limit = self.bounds.size.width - 5 - firstNameFrame.origin.x; if(sum >limit) { diff --git a/Classes/PhoneMainView.h b/Classes/PhoneMainView.h index 6514290d0..6217ae92d 100644 --- a/Classes/PhoneMainView.h +++ b/Classes/PhoneMainView.h @@ -62,7 +62,7 @@ - (void)fullScreen:(BOOL)enabled; - (void)startUp; -+ (void)forceOrientation:(UIInterfaceOrientation)orientation animated:(BOOL)animated; ++ (void)setOrientation:(UIInterfaceOrientation)orientation animated:(BOOL)animated; + (PhoneMainView*) instance; diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index 2f6667caa..346a19909 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -169,11 +169,27 @@ static PhoneMainView* phoneMainViewInstance=nil; return NO; } ++ (UIView*)findFirstResponder:(UIView*)view { + if (view.isFirstResponder) { + return view; + } + for (UIView *subView in view.subviews) { + UIView *ret = [PhoneMainView findFirstResponder:subView]; + if (ret != nil) + return ret; + } + return nil; +} + /* Will simulate a device rotation */ -+ (void)forceOrientation:(UIInterfaceOrientation)orientation animated:(BOOL)animated { ++ (void)setOrientation:(UIInterfaceOrientation)orientation animated:(BOOL)animated { + UIView *firstResponder = nil; for(UIWindow *window in [[UIApplication sharedApplication] windows]) { + if([NSStringFromClass(window.class) isEqualToString:@"UITextEffectsWindow"]) { + continue; + } UIView *view = window; UIViewController *controller = nil; CGRect frame = [view frame]; @@ -216,8 +232,15 @@ static PhoneMainView* phoneMainViewInstance=nil; [UIView commitAnimations]; } [controller didRotateFromInterfaceOrientation:oldOrientation]; + if(firstResponder == nil) { + firstResponder = [PhoneMainView findFirstResponder:view]; + } } [[UIApplication sharedApplication] setStatusBarOrientation:orientation animated:animated]; + if(firstResponder) { + [firstResponder resignFirstResponder]; + [firstResponder becomeFirstResponder]; + } } - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { @@ -246,8 +269,8 @@ static PhoneMainView* phoneMainViewInstance=nil; ChatModel *chat = [[notif userInfo] objectForKey:@"chat"]; if(chat != nil) { [self displayMessage:chat]; - [self updateApplicationBadgeNumber]; } + [self updateApplicationBadgeNumber]; } - (void)registrationUpdate:(NSNotification*)notif { diff --git a/Resources/en.lproj/Localizable.strings b/Resources/en.lproj/Localizable.strings index 02cb7259b..0f3dedb8c 100644 Binary files a/Resources/en.lproj/Localizable.strings and b/Resources/en.lproj/Localizable.strings differ