diff --git a/Classes/Base.lproj/ChatConversationCreateView.xib b/Classes/Base.lproj/ChatConversationCreateView.xib index a3a8d83cd..bbf38c238 100644 --- a/Classes/Base.lproj/ChatConversationCreateView.xib +++ b/Classes/Base.lproj/ChatConversationCreateView.xib @@ -1,9 +1,9 @@ - + - + @@ -175,13 +175,13 @@ - + - + diff --git a/Classes/ChatConversationCreateView.m b/Classes/ChatConversationCreateView.m index af346de40..2f9bb36d7 100644 --- a/Classes/ChatConversationCreateView.m +++ b/Classes/ChatConversationCreateView.m @@ -69,7 +69,7 @@ static UICompositeViewDescription *compositeDescription = nil; [self.view addGestureRecognizer:tap]; UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; - layout.itemSize = CGSizeMake(100.0 , 50.0); + layout.estimatedItemSize = UICollectionViewFlowLayoutAutomaticSize; _collectionController.collectionView = _collectionView; _collectionController = (ChatConversationCreateCollectionViewController *)[[UICollectionViewController alloc] initWithCollectionViewLayout:layout]; _collectionView.dataSource = self; @@ -286,7 +286,7 @@ typedef enum { ContactsAll, ContactsLinphone, ContactsMAX } ContactsCategory; return NO; } -#pragma mark - UICollectionViewDataSource +#pragma mark - UICollectionViewDataSource & Delegate - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return _tableController.contactsGroup.count; } @@ -308,9 +308,10 @@ typedef enum { ContactsAll, ContactsLinphone, ContactsMAX } ContactsCategory; ms_free(phone); } else addr = linphone_address_new(uri.UTF8String); - cell = [cell initWithName:[FastAddressBook displayNameForAddress:addr]]; + [cell.nameLabel setText:[FastAddressBook displayNameForAddress:addr]]; linphone_address_unref(addr); return cell; } + @end diff --git a/Classes/LinphoneUI/Base.lproj/UIChatCreateCollectionViewCell.xib b/Classes/LinphoneUI/Base.lproj/UIChatCreateCollectionViewCell.xib deleted file mode 100644 index cc1ea47a9..000000000 --- a/Classes/LinphoneUI/Base.lproj/UIChatCreateCollectionViewCell.xib +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Classes/LinphoneUI/UIChatCreateCollectionViewCell.h b/Classes/LinphoneUI/UIChatCreateCollectionViewCell.h index e52fa8187..a3e2c565e 100644 --- a/Classes/LinphoneUI/UIChatCreateCollectionViewCell.h +++ b/Classes/LinphoneUI/UIChatCreateCollectionViewCell.h @@ -21,9 +21,8 @@ #import "ChatConversationCreateView.h" @interface UIChatCreateCollectionViewCell : UICollectionViewCell -@property (weak, nonatomic) IBOutlet UILabel *nameLabel; +@property UILabel *nameLabel; @property (strong, nonatomic) ChatConversationCreateView *controller; @property (strong, nonatomic) NSString *uri; -- (id)initWithName:(NSString *)identifier; - (void)onDelete; @end diff --git a/Classes/LinphoneUI/UIChatCreateCollectionViewCell.m b/Classes/LinphoneUI/UIChatCreateCollectionViewCell.m index a9b6b2f5d..1ae4bf5d9 100644 --- a/Classes/LinphoneUI/UIChatCreateCollectionViewCell.m +++ b/Classes/LinphoneUI/UIChatCreateCollectionViewCell.m @@ -18,27 +18,31 @@ */ #import "UIChatCreateCollectionViewCell.h" +#import "linphoneapp-Swift.h" @implementation UIChatCreateCollectionViewCell -- (void)awakeFromNib { - [super awakeFromNib]; -} - -- (id)initWithName:(NSString *)identifier { - if (self != nil) { - NSArray *arrayOfViews = - [[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self.class) owner:self options:nil]; - if ([arrayOfViews count] >= 1) { - UIChatCreateCollectionViewCell *sub = ((UIChatCreateCollectionViewCell *)[arrayOfViews objectAtIndex:0]); - [self addSubview:sub]; - _nameLabel = sub.nameLabel; - } - } - [_nameLabel setText:identifier]; +- (id)initWithFrame:(CGRect)frame { + self = [super initWithFrame:frame]; + self.contentView.translatesAutoresizingMaskIntoConstraints = false; + [SnapkitBridge matchParentDimensionsWithView:self.contentView topInset:10]; + + self.nameLabel = [[UILabel alloc] initWithFrame:CGRectZero]; + self.nameLabel.numberOfLines = 1; + [self.contentView addSubview:self.nameLabel]; + [SnapkitBridge matchParentDimensionsWithView:self.nameLabel leftInset:20]; + [SnapkitBridge heightWithView:self heiht:50]; + + UIImageView *image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"conference_delete"]]; + image.contentMode = UIViewContentModeScaleAspectFit; + [self.contentView addSubview:image]; + [SnapkitBridge squareWithView:image size:15]; + [SnapkitBridge alignParentLeftWithView:image]; + [SnapkitBridge centerYWithView:image]; UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onDelete)]; tap.numberOfTouchesRequired = 1; - [self addGestureRecognizer:tap]; + [image addGestureRecognizer:tap]; + image.userInteractionEnabled = true; return self; } @@ -60,4 +64,6 @@ [_controller.tableController.tableView reloadData]; _controller.nextButton.enabled = (_controller.tableController.contactsGroup.count > 0) || _controller.isForEditing; } + + @end diff --git a/Classes/LinphoneUI/fr.lproj/UIChatCreateCollectionViewCell.strings b/Classes/LinphoneUI/fr.lproj/UIChatCreateCollectionViewCell.strings deleted file mode 100644 index c4186dcaa..000000000 Binary files a/Classes/LinphoneUI/fr.lproj/UIChatCreateCollectionViewCell.strings and /dev/null differ diff --git a/Classes/LinphoneUI/hu.lproj/UIChatCreateCollectionViewCell.strings b/Classes/LinphoneUI/hu.lproj/UIChatCreateCollectionViewCell.strings deleted file mode 100644 index 448396a28..000000000 Binary files a/Classes/LinphoneUI/hu.lproj/UIChatCreateCollectionViewCell.strings and /dev/null differ diff --git a/Classes/Swift/Extensions/IOS/SnapkitBridge.swift b/Classes/Swift/Extensions/IOS/SnapkitBridge.swift new file mode 100644 index 000000000..1fd174b67 --- /dev/null +++ b/Classes/Swift/Extensions/IOS/SnapkitBridge.swift @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2010-2020 Belledonne Communications SARL. + * + * This file is part of linphone-iphone + * + * 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 3 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, see . + */ + +import UIKit +import Photos +import linphonesw + + +@objc class SnapkitBridge: NSObject { + @objc static func matchParentDimensions(view:UIView) { + view.matchParentDimmensions().done() + } + + @objc static func matchParentDimensions(view:UIView,leftInset:CGFloat) { + view.matchParentDimmensions(insetedBy: UIEdgeInsets(top: 0, left: leftInset, bottom: 0, right: 0)).done() + } + + @objc static func matchParentDimensions(view:UIView,topInset:CGFloat) { + view.matchParentDimmensions(insetedBy: UIEdgeInsets(top: topInset, left: 0, bottom: 0, right: 0)).done() + } + + @objc static func height(view:UIView,heiht:Int) { + view.height(heiht).done() + } + @objc static func square(view:UIView,size:Int) { + view.square(size).done() + } + + @objc static func alignParentLeft(view:UIView) { + view.alignParentLeft().done() + } + + @objc static func centerY(view:UIView) { + view.centerY().done() + } + +} +