Contacts detail now working!!!

This commit is contained in:
Gautier Pelloux-Prayer 2015-10-22 10:16:11 +02:00
parent d23d65a15f
commit d95028089b
12 changed files with 305 additions and 257 deletions

View file

@ -93,14 +93,14 @@
</view>
<imageView contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="avatar.png" id="B6X-C9-2vm" userLabel="avatarImage" customClass="UIRoundedImageView">
<rect key="frame" x="142" y="42" width="90" height="90"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<connections>
<outletCollection property="gestureRecognizers" destination="8bV-f4-pLL" appends="YES" id="4V5-Px-aHT"/>
</connections>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="moZ-Bg-zcv" userLabel="nameLabel">
<rect key="frame" x="0.0" y="140" width="375" height="58"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<attributedString key="attributedText">
<fragment content="John">
<attributes>
@ -126,7 +126,7 @@
</attributedString>
<nil key="highlightedColor"/>
</label>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="none" allowsSelectionDuringEditing="YES" rowHeight="44" sectionHeaderHeight="1" sectionFooterHeight="1" id="19" userLabel="tableView">
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="none" allowsSelection="NO" allowsSelectionDuringEditing="YES" rowHeight="44" sectionHeaderHeight="1" sectionFooterHeight="1" id="19" userLabel="tableView">
<rect key="frame" x="0.0" y="206" width="375" height="353"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>

View file

@ -19,7 +19,7 @@
#import "ContactDetailsTableView.h"
#import "PhoneMainView.h"
#import "UIEditableTableViewCell.h"
#import "UIContactDetailsCell.h"
#import "UACellBackgroundView.h"
#import "Utils.h"
#import "OrderedDictionary.h"
@ -496,13 +496,11 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *kCellId = @"ContactDetailsCell";
UIEditableTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId];
static NSString *kCellId = @"UIContactDetailsCell";
UIContactDetailsCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId];
if (cell == nil) {
cell = [[UIEditableTableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:kCellId];
[cell.detailTextField setDelegate:self];
[cell.detailTextField setAutocapitalizationType:UITextAutocapitalizationTypeNone];
[cell.detailTextField setAutocorrectionType:UITextAutocorrectionTypeNo];
cell = [[UIContactDetailsCell alloc] initWithIdentifier:kCellId];
[cell.editTextfield setDelegate:self];
}
NSMutableArray *sectionDict = [self getSectionData:[indexPath section]];
@ -516,10 +514,12 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {
value =
(__bridge NSString *)(ABRecordCopyValue(contact, [self propertyIDForSection:ContactSections_First_Name]));
label = nil;
[cell hideDeleteButton];
} else if (contactSections[indexPath.section] == ContactSections_Last_Name) {
value =
(__bridge NSString *)(ABRecordCopyValue(contact, [self propertyIDForSection:ContactSections_Last_Name]));
label = nil;
[cell hideDeleteButton];
} else if (contactSections[[indexPath section]] == ContactSections_Number) {
ABMultiValueRef lMap = ABRecordCopyValue(contact, kABPersonPhoneProperty);
NSInteger index = ABMultiValueGetIndexForIdentifier(lMap, [entry identifier]);
@ -569,18 +569,17 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {
}
CFRelease(lMap);
}
[cell.textLabel setText:label];
[cell.detailTextLabel setText:value];
[cell.detailTextField setText:value];
[cell.editTextfield setText:value];
cell.addressLabel.text = value;
if (contactSections[[indexPath section]] == ContactSections_Number) {
[cell.detailTextField setKeyboardType:UIKeyboardTypePhonePad];
[cell.detailTextField setPlaceholder:NSLocalizedString(@"Phone number", nil)];
[cell.editTextfield setKeyboardType:UIKeyboardTypePhonePad];
[cell.editTextfield setPlaceholder:NSLocalizedString(@"Phone number", nil)];
} else if (contactSections[[indexPath section]] == ContactSections_Sip) {
[cell.detailTextField setKeyboardType:UIKeyboardTypeASCIICapable];
[cell.detailTextField setPlaceholder:NSLocalizedString(@"SIP address", nil)];
[cell.editTextfield setKeyboardType:UIKeyboardTypeASCIICapable];
[cell.editTextfield setPlaceholder:NSLocalizedString(@"SIP address", nil)];
} else if (contactSections[[indexPath section]] == ContactSections_Email) {
[cell.detailTextField setKeyboardType:UIKeyboardTypeASCIICapable];
[cell.detailTextField setPlaceholder:NSLocalizedString(@"Email address", nil)];
[cell.editTextfield setKeyboardType:UIKeyboardTypeASCIICapable];
[cell.editTextfield setPlaceholder:NSLocalizedString(@"Email address", nil)];
}
return cell;
}
@ -589,46 +588,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {
[tableView deselectRowAtIndexPath:indexPath animated:NO];
NSMutableArray *sectionDict = [self getSectionData:[indexPath section]];
Entry *entry = [sectionDict objectAtIndex:[indexPath row]];
if (![self isEditing]) {
NSString *dest = NULL;
;
if (contactSections[[indexPath section]] == ContactSections_Number) {
ABMultiValueRef lMap = ABRecordCopyValue(contact, kABPersonPhoneProperty);
NSInteger index = ABMultiValueGetIndexForIdentifier(lMap, [entry identifier]);
NSString *valueRef = CFBridgingRelease(ABMultiValueCopyValueAtIndex(lMap, index));
if (valueRef != NULL) {
char normalizedPhoneNumber[256];
linphone_proxy_config_normalize_number(linphone_core_get_default_proxy_config([LinphoneManager getLc]),
[valueRef UTF8String], normalizedPhoneNumber,
sizeof(normalizedPhoneNumber));
dest = [NSString stringWithUTF8String:normalizedPhoneNumber];
}
CFRelease(lMap);
} else if (contactSections[[indexPath section]] == ContactSections_Sip) {
ABMultiValueRef lMap = ABRecordCopyValue(contact, kABPersonInstantMessageProperty);
NSInteger index = ABMultiValueGetIndexForIdentifier(lMap, [entry identifier]);
CFDictionaryRef lDict = ABMultiValueCopyValueAtIndex(lMap, index);
NSString *valueRef = (__bridge NSString *)(CFDictionaryGetValue(lDict, kABPersonInstantMessageUsernameKey));
dest = [FastAddressBook normalizeSipURI:(NSString *)valueRef];
CFRelease(lDict);
CFRelease(lMap);
} else if (contactSections[[indexPath section]] == ContactSections_Email) {
ABMultiValueRef lMap = ABRecordCopyValue(contact, kABPersonEmailProperty);
NSInteger index = ABMultiValueGetIndexForIdentifier(lMap, [entry identifier]);
NSString *valueRef = CFBridgingRelease(ABMultiValueCopyValueAtIndex(lMap, index));
if (valueRef != NULL) {
dest = [FastAddressBook normalizeSipURI:(NSString *)(valueRef)];
}
CFRelease(lMap);
}
if (dest != nil) {
NSString *displayName = [FastAddressBook getContactDisplayName:contact];
// Go to dialer view
DialerView *view = VIEW(DialerView);
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
[view call:dest displayName:displayName];
}
} else {
if ([self isEditing]) {
NSString *key = nil;
ABPropertyID property = [self propertyIDForSection:contactSections[indexPath.section]];
@ -677,22 +637,18 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView
editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == ContactSections_First_Name || indexPath.section == ContactSections_Last_Name) {
return UITableViewCellEditingStyleNone;
}
NSInteger last_index = [[self getSectionData:[indexPath section]] count] - 1;
if (indexPath.row == last_index) {
return UITableViewCellEditingStyleInsert;
}
return UITableViewCellEditingStyleDelete;
return UITableViewCellEditingStyleNone;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
NSString *text = nil;
BOOL canAddEntry = self.tableView.isEditing;
if (contactSections[section] == ContactSections_First_Name && self.tableView.isEditing) {
text = NSLocalizedString(@"First name", nil);
canAddEntry = NO;
} else if (contactSections[section] == ContactSections_Last_Name && self.tableView.isEditing) {
text = NSLocalizedString(@"Last name", nil);
canAddEntry = NO;
} else if ([self getSectionData:section].count > 0) {
if (contactSections[section] == ContactSections_Number) {
text = NSLocalizedString(@"Phone numbers", nil);
@ -707,10 +663,10 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {
return nil;
}
UIView *tempView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 20)];
UIView *tempView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 35)];
tempView.backgroundColor = [UIColor whiteColor];
UILabel *tempLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 5, 300, 10)];
UILabel *tempLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 5, 300, 35)];
tempLabel.backgroundColor = [UIColor clearColor];
tempLabel.textColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"color_E"]];
tempLabel.text = text.uppercaseString;
@ -718,9 +674,31 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {
tempLabel.font = [UIFont systemFontOfSize:12];
[tempView addSubview:tempLabel];
if (canAddEntry) {
CGRect frame = CGRectMake(255, 5, 30, 30);
frame.origin.x = tableView.frame.size.width - 35;
UIIconButton *tempAddButton = [[UIIconButton alloc] initWithFrame:frame];
[tempAddButton setImage:[UIImage imageNamed:@"add_field_default"] forState:UIControlStateNormal];
[tempAddButton setImage:[UIImage imageNamed:@"add_field_over"] forState:UIControlStateHighlighted];
[tempAddButton setImage:[UIImage imageNamed:@"add_field_over"] forState:UIControlStateSelected];
[tempAddButton addTarget:self action:@selector(onAddClick:) forControlEvents:UIControlEventTouchUpInside];
tempAddButton.tag = section;
[tempView addSubview:tempAddButton];
}
return tempView;
}
- (void)onAddClick:(id)sender {
NSInteger section = ((UIButton *)sender).tag;
UITableView *tableView = VIEW(ContactDetailsView).tableController.tableView;
NSInteger count = [self.tableView numberOfRowsInSection:section];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:count inSection:section];
[tableView.dataSource tableView:tableView
commitEditingStyle:UITableViewCellEditingStyleInsert
forRowAtIndexPath:indexPath];
}
#pragma mark - ContactDetailsLabelDelegate Functions
- (void)changeContactDetailsLabel:(NSString *)value {
@ -767,10 +745,10 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField {
UIView *view = [textField superview];
// Find TableViewCell
while (view != nil && ![view isKindOfClass:[UIEditableTableViewCell class]])
while (view != nil && ![view isKindOfClass:[UIContactDetailsCell class]])
view = [view superview];
if (view != nil) {
UIEditableTableViewCell *cell = (UIEditableTableViewCell *)view;
UIContactDetailsCell *cell = (UIContactDetailsCell *)view;
NSIndexPath *path = [self.tableView indexPathForCell:cell];
NSMutableArray *sectionDict = [self getSectionData:[path section]];
Entry *entry = [sectionDict objectAtIndex:[path row]];
@ -791,7 +769,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {
CFRelease(lMap);
}
[cell.detailTextLabel setText:value];
cell.editTextfield.text = value;
} else {
LOGE(@"Not valid UIEditableTableViewCell");
}
@ -804,6 +782,13 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {
return true;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (tableView.isEditing) {
return 44;
} else {
return 88;
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 1e-5;
}

View file

@ -223,7 +223,7 @@ static UICompositeViewDescription *compositeDescription = nil;
CGRect frame = _tableController.tableView.frame;
frame.origin.y = _nameLabel.frame.origin.y;
if (editing) {
if (!editing) {
frame.origin.y += _nameLabel.frame.size.height;
}
_tableController.tableView.frame = frame;

View file

@ -0,0 +1,38 @@
/* UIEditableTableViewCell.h
*
* Copyright (C) 2012 Belledonne Comunications, Grenoble, France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import <UIKit/UIKit.h>
#import "UIIconButton.h"
@interface UIContactDetailsCell : UITableViewCell
@property(weak, nonatomic) IBOutlet UIView *defaultView;
@property(weak, nonatomic) IBOutlet UILabel *addressLabel;
@property(weak, nonatomic) IBOutlet UITextField *editTextfield;
@property(weak, nonatomic) IBOutlet UIView *editView;
@property(weak, nonatomic) IBOutlet UIIconButton *deleteButton;
- (id)initWithIdentifier:(NSString *)identifier;
- (void)hideDeleteButton;
- (IBAction)onCallClick:(id)sender;
- (IBAction)onChatClick:(id)sender;
- (IBAction)onDeleteClick:(id)sender;
@end

View file

@ -0,0 +1,96 @@
/* UIEditableTableViewCell.m
*
* Copyright (C) 2012 Belledonne Comunications, Grenoble, France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import "UIContactDetailsCell.h"
#import "PhoneMainView.h"
@implementation UIContactDetailsCell
#pragma mark - Lifecycle Functions
- (id)initWithIdentifier:(NSString *)identifier {
if ((self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier]) != nil) {
NSArray *arrayOfViews =
[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self.class) owner:self options:nil];
// resize cell to match .nib size. It is needed when resized the cell to
// correctly adapt its height too
UIView *sub = ((UIView *)[arrayOfViews objectAtIndex:0]);
[self setFrame:CGRectMake(0, 0, sub.frame.size.width, sub.frame.size.height)];
[self addSubview:sub];
}
return self;
}
#pragma mark - UITableViewCell Functions
- (void)hideDeleteButton {
CGRect newFrame = _editTextfield.frame;
newFrame.size.width += _deleteButton.frame.size.width;
_editTextfield.frame = newFrame;
_deleteButton.hidden = YES;
}
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
[super setEditing:editing animated:animated];
_defaultView.hidden = editing;
_editView.hidden = !editing;
}
- (void)setEditing:(BOOL)editing {
[self setEditing:editing animated:FALSE];
}
- (IBAction)onCallClick:(id)event {
LinphoneAddress *addr = linphone_core_interpret_url([LinphoneManager getLc], _addressLabel.text.UTF8String);
char *lAddress = linphone_address_as_string_uri_only(addr);
if (lAddress == NULL)
return;
NSString *displayName = [FastAddressBook displayNameForAddress:addr];
DialerView *view = VIEW(DialerView);
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
[view call:[NSString stringWithUTF8String:lAddress] displayName:displayName];
ms_free(lAddress);
linphone_address_destroy(addr);
}
- (IBAction)onChatClick:(id)event {
LinphoneAddress *addr = linphone_core_interpret_url([LinphoneManager getLc], _addressLabel.text.UTF8String);
if (addr == NULL)
return;
[PhoneMainView.instance changeCurrentView:ChatsListView.compositeViewDescription];
ChatConversationView *view = VIEW(ChatConversationView);
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE];
LinphoneChatRoom *room = linphone_core_get_chat_room([LinphoneManager getLc], addr);
[view setChatRoom:room];
linphone_address_destroy(addr);
}
- (IBAction)onDeleteClick:(id)sender {
UITableView *tableView = VIEW(ContactDetailsView).tableController.tableView;
NSIndexPath *indexPath = [tableView indexPathForCell:self];
[tableView.dataSource tableView:tableView
commitEditingStyle:UITableViewCellEditingStyleDelete
forRowAtIndexPath:indexPath];
}
@end

View file

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="UIContactDetailsCell">
<connections>
<outlet property="addressLabel" destination="frB-ep-LWi" id="g8q-qs-S9y"/>
<outlet property="defaultView" destination="SR2-3m-6t5" id="ZvK-H1-inh"/>
<outlet property="editTextfield" destination="dTn-Hc-bGM" id="bkN-xg-S9D"/>
<outlet property="editView" destination="rAa-qu-PDc" id="cGz-D2-GiI"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="R4P-di-kSp">
<rect key="frame" x="0.0" y="0.0" width="375" height="88"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" id="rAa-qu-PDc" userLabel="editView">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" minimumFontSize="17" id="dTn-Hc-bGM" userLabel="editTextField">
<rect key="frame" x="8" y="7" width="326" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.90588235289999997" green="0.90588235289999997" blue="0.90588235289999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<button opaque="NO" contentMode="scaleAspectFit" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="C2f-aP-xjR" userLabel="deleteButton" customClass="UIIconButton">
<rect key="frame" x="340" y="6.9999999443689944" width="30" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES"/>
<state key="normal" title="Button" image="delete_field_default.png">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="selected" image="delete_field_over.png"/>
<state key="highlighted" image="delete_field_over.png"/>
<connections>
<action selector="onDeleteClick:" destination="-1" eventType="touchUpInside" id="HJ4-YQ-uh4"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<view contentMode="scaleToFill" id="SR2-3m-6t5" userLabel="defaultView">
<rect key="frame" x="0.0" y="0.0" width="375" height="88"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleAspectFit" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="ZbV-2Z-b4y" userLabel="callButton" customClass="UIIconButton">
<rect key="frame" x="135" y="40" width="44" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES"/>
<state key="normal" title="Button" image="call_start_body_default.png">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="onCallClick:" destination="-1" eventType="touchUpInside" id="nVk-zG-i8I"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleAspectFit" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="FDT-HY-OQZ" userLabel="chatButton" customClass="UIIconButton">
<rect key="frame" x="195" y="40.000000216744141" width="44" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES"/>
<state key="normal" title="Button" image="chat_start_body_default.png">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="onChatClick:" destination="-1" eventType="touchUpInside" id="tec-tH-uij"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="john.doe@sip.linphone.org" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="frB-ep-LWi" userLabel="addressLabel">
<rect key="frame" x="8" y="0.0" width="359" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="338.5" y="43"/>
</view>
</objects>
<resources>
<image name="call_start_body_default.png" width="51" height="51"/>
<image name="chat_start_body_default.png" width="51" height="51"/>
<image name="delete_field_default.png" width="27" height="27"/>
<image name="delete_field_over.png" width="27" height="27"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>

View file

@ -1,27 +0,0 @@
/* UIEditableTableViewCell.h
*
* Copyright (C) 2012 Belledonne Comunications, Grenoble, France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import <UIKit/UIKit.h>
@interface UIEditableTableViewCell : UITableViewCell
@property (nonatomic, strong) IBOutlet UIView *verticalSep;
@property (nonatomic, strong) IBOutlet UITextField *detailTextField;
@end

View file

@ -1,114 +0,0 @@
/* UIEditableTableViewCell.m
*
* Copyright (C) 2012 Belledonne Comunications, Grenoble, France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import "UIEditableTableViewCell.h"
@implementation UIEditableTableViewCell
@synthesize detailTextField;
@synthesize verticalSep;
#pragma mark - Lifecycle Functions
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
UITextField *tf = [[UITextField alloc] init];
tf.hidden = TRUE;
tf.clearButtonMode = UITextFieldViewModeWhileEditing;
tf.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
tf.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
self.detailTextField = tf;
UIFont *font = [UIFont fontWithName:@"Helvetica-Bold" size:[UIFont systemFontSize]];
[self.detailTextLabel setFont:font];
[self.detailTextField setFont:font];
self.detailTextLabel.backgroundColor = self.detailTextField.backgroundColor =
[UIColor colorWithPatternImage:[UIImage imageNamed:@"color_A"]];
[self.contentView addSubview:detailTextField];
// a vertical separator that will come between the text and detailed text
UIView *v = [[UIView alloc] initWithFrame:CGRectMake(80, 5, 1, 34)];
[v setBackgroundColor:[UIColor lightGrayColor]];
[v setHidden:TRUE];
self.verticalSep = v;
[self.contentView addSubview:verticalSep];
}
return self;
}
#pragma mark - View Functions
- (void)layoutSubviews {
[super layoutSubviews];
CGRect superframe = [[self.detailTextField superview] frame];
CGRect detailEditFrame;
detailEditFrame.origin.x = 15;
detailEditFrame.origin.y = 5;
detailEditFrame.size.height = superframe.size.height - 10;
#if 0
if ([[self.textLabel text] length] != 0) {
detailEditFrame.origin.x += [self.textLabel frame].size.width + 8;
// shrink left text width by 10px
CGRect leftLabelFrame = [self.textLabel frame];
leftLabelFrame.size.width -= 10;
[self.textLabel setFrame:leftLabelFrame];
// place separator between left text and detailed text
CGRect separatorFrame = [self.verticalSep frame];
separatorFrame.origin.x = leftLabelFrame.size.width + leftLabelFrame.origin.x + 5;
[self.verticalSep setFrame:separatorFrame];
[self.verticalSep setHidden:FALSE];
}
#endif
// put the detailed text edit view at the correct position
detailEditFrame.size.width = superframe.size.width - 10 - detailEditFrame.origin.x;
self.detailTextField.frame = detailEditFrame;
}
#pragma mark - UITableViewCell Functions
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
[super setEditing:editing animated:animated];
if (editing) {
[self.detailTextField setHidden:FALSE];
[self.detailTextLabel setHidden:TRUE];
} else {
[self.detailTextField setHidden:TRUE];
[self.detailTextLabel setHidden:FALSE];
}
}
- (void)setEditing:(BOOL)editing {
[self setEditing:editing animated:FALSE];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
}
@end

View file

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="R4P-di-kSp">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" minimumFontSize="17" id="dTn-Hc-bGM">
<rect key="frame" x="8" y="6" width="359" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.90588235289999997" green="0.90588235289999997" blue="0.90588235289999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="338.5" y="43"/>
</view>
</objects>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>

View file

@ -9,4 +9,5 @@
#import <UIKit/UIKit.h>
@interface UIIconButton : UIButton
@end

View file

@ -35,4 +35,8 @@
return [[super initWithFrame:frame] fixBackgroundImageForState];
}
- (void)setImage:(UIImage *)image forState:(UIControlState)state {
[super setImage:image forState:state];
[self fixBackgroundImageForState];
}
@end

View file

@ -107,7 +107,7 @@
636BC9971B5F921B00C754CE /* UIIconButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 636BC9961B5F921B00C754CE /* UIIconButton.m */; };
63701DD61BA31DA1006A9AE3 /* UIConfirmationDialog.xib in Resources */ = {isa = PBXBuildFile; fileRef = 63701DD51BA31DA1006A9AE3 /* UIConfirmationDialog.xib */; };
63701DDF1BA32039006A9AE3 /* UIConfirmationDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = 63701DDE1BA32039006A9AE3 /* UIConfirmationDialog.m */; };
637144571BD531CE007E7C06 /* UIEditableTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 637144561BD531CE007E7C06 /* UIEditableTableViewCell.xib */; };
637144571BD531CE007E7C06 /* UIContactDetailsCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 637144561BD531CE007E7C06 /* UIContactDetailsCell.xib */; };
637157A11B283FE200C91677 /* FileTransferDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 637157A01B283FE200C91677 /* FileTransferDelegate.m */; };
637527C91BBA8EF700FDEA6F /* add_field_default.png in Resources */ = {isa = PBXBuildFile; fileRef = 6375271A1BBA8EF700FDEA6F /* add_field_default.png */; };
637527CA1BBA8EF700FDEA6F /* add_field_over.png in Resources */ = {isa = PBXBuildFile; fileRef = 6375271B1BBA8EF700FDEA6F /* add_field_over.png */; };
@ -428,7 +428,7 @@
D381881915FE3FCA00C3EDCA /* CallView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D381881C15FE3FCA00C3EDCA /* CallView.xib */; };
D3A55FBC15877E5E003FD403 /* UIContactCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D3A55FBB15877E5E003FD403 /* UIContactCell.m */; };
D3A8BB7015A6C7D500F96BE5 /* UIChatBubbleTextCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D3A8BB6F15A6C7D500F96BE5 /* UIChatBubbleTextCell.m */; };
D3C6526715AC1A8F0092A874 /* UIEditableTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D3C6526615AC1A8F0092A874 /* UIEditableTableViewCell.m */; };
D3C6526715AC1A8F0092A874 /* UIContactDetailsCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D3C6526615AC1A8F0092A874 /* UIContactDetailsCell.m */; };
D3D5126C160B3A8E00946DF8 /* AssistantSubviews.xib in Resources */ = {isa = PBXBuildFile; fileRef = D3D5126A160B3A8E00946DF8 /* AssistantSubviews.xib */; };
D3EA53FD159850E80037DC6B /* LinphoneManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D3EA53FC159850E80037DC6B /* LinphoneManager.m */; };
D3EA540D1598528B0037DC6B /* ChatsListTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = D3EA540C1598528B0037DC6B /* ChatsListTableView.m */; };
@ -737,7 +737,7 @@
63701DD51BA31DA1006A9AE3 /* UIConfirmationDialog.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = UIConfirmationDialog.xib; sourceTree = "<group>"; };
63701DDD1BA32039006A9AE3 /* UIConfirmationDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIConfirmationDialog.h; sourceTree = "<group>"; };
63701DDE1BA32039006A9AE3 /* UIConfirmationDialog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIConfirmationDialog.m; sourceTree = "<group>"; };
637144561BD531CE007E7C06 /* UIEditableTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = UIEditableTableViewCell.xib; sourceTree = "<group>"; };
637144561BD531CE007E7C06 /* UIContactDetailsCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = UIContactDetailsCell.xib; sourceTree = "<group>"; };
6371579F1B283FE200C91677 /* FileTransferDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileTransferDelegate.h; path = Utils/FileTransferDelegate.h; sourceTree = "<group>"; };
637157A01B283FE200C91677 /* FileTransferDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FileTransferDelegate.m; path = Utils/FileTransferDelegate.m; sourceTree = "<group>"; };
6375271A1BBA8EF700FDEA6F /* add_field_default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = add_field_default.png; sourceTree = "<group>"; };
@ -1086,8 +1086,8 @@
D3A55FBB15877E5E003FD403 /* UIContactCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIContactCell.m; sourceTree = "<group>"; };
D3A8BB6E15A6C7D500F96BE5 /* UIChatBubbleTextCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIChatBubbleTextCell.h; sourceTree = "<group>"; };
D3A8BB6F15A6C7D500F96BE5 /* UIChatBubbleTextCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIChatBubbleTextCell.m; sourceTree = "<group>"; };
D3C6526515AC1A8F0092A874 /* UIEditableTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIEditableTableViewCell.h; sourceTree = "<group>"; };
D3C6526615AC1A8F0092A874 /* UIEditableTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIEditableTableViewCell.m; sourceTree = "<group>"; };
D3C6526515AC1A8F0092A874 /* UIContactDetailsCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIContactDetailsCell.h; sourceTree = "<group>"; };
D3C6526615AC1A8F0092A874 /* UIContactDetailsCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIContactDetailsCell.m; sourceTree = "<group>"; };
D3EA53FB159850E80037DC6B /* LinphoneManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LinphoneManager.h; sourceTree = "<group>"; };
D3EA53FC159850E80037DC6B /* LinphoneManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LinphoneManager.m; sourceTree = "<group>"; };
D3EA540B1598528B0037DC6B /* ChatsListTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChatsListTableView.h; sourceTree = "<group>"; };
@ -1510,9 +1510,9 @@
F088488D19FF8C41007FFCF3 /* UIContactCell.xib */,
2248E90C12F7E4CF00220D9C /* UIDigitButton.h */,
2248E90D12F7E4CF00220D9C /* UIDigitButton.m */,
D3C6526515AC1A8F0092A874 /* UIEditableTableViewCell.h */,
D3C6526615AC1A8F0092A874 /* UIEditableTableViewCell.m */,
637144561BD531CE007E7C06 /* UIEditableTableViewCell.xib */,
D3C6526515AC1A8F0092A874 /* UIContactDetailsCell.h */,
D3C6526615AC1A8F0092A874 /* UIContactDetailsCell.m */,
637144561BD531CE007E7C06 /* UIContactDetailsCell.xib */,
2214EB8712F84EBB002A5394 /* UIHangUpButton.h */,
2214EB8812F84EBB002A5394 /* UIHangUpButton.m */,
D31C9C96158A1CDE00756B45 /* UIHistoryCell.h */,
@ -2366,7 +2366,7 @@
639CEAFD1A1DF4D9004DE38F /* StatusBarView.xib in Resources */,
637527DD1BBA8EF700FDEA6F /* call_status_incoming.png in Resources */,
637528321BBA8EF700FDEA6F /* numpad_3_over.png in Resources */,
637144571BD531CE007E7C06 /* UIEditableTableViewCell.xib in Resources */,
637144571BD531CE007E7C06 /* UIContactDetailsCell.xib in Resources */,
F088488A19FF8C41007FFCF3 /* UIContactCell.xib in Resources */,
637527E51BBA8EF700FDEA6F /* camera_switch_disabled.png in Resources */,
6375280F1BBA8EF700FDEA6F /* delete_field_default.png in Resources */,
@ -2719,7 +2719,7 @@
D3128FE115AABC7E00A2147A /* ContactDetailsView.m in Sources */,
D37C639B15AADEF6009D0BAC /* ContactDetailsTableView.m in Sources */,
63E59A3F1ADE70D900646FB3 /* InAppProductsManager.m in Sources */,
D3C6526715AC1A8F0092A874 /* UIEditableTableViewCell.m in Sources */,
D3C6526715AC1A8F0092A874 /* UIContactDetailsCell.m in Sources */,
631348301B6F7B6600C6BDCB /* UIRoundBorderedButton.m in Sources */,
C90FAA7915AF54E6002091CB /* HistoryDetailsView.m in Sources */,
63FB30351A680E73008CA393 /* UIRoundedImageView.m in Sources */,