mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
display table view
This commit is contained in:
parent
53493a4e99
commit
04da4d4afa
3 changed files with 49 additions and 48 deletions
|
|
@ -19,19 +19,14 @@
|
|||
@property(nonatomic) bctbx_list_t *displayedList;
|
||||
@property(nonatomic) bctbx_list_t *receivedList;
|
||||
@property(nonatomic) bctbx_list_t *notReceivedList;
|
||||
@property(nonatomic) CGFloat height;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIView *whiteView;
|
||||
@property (weak, nonatomic) IBOutlet UIView *msgView;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *msgBackgroundColorImage;
|
||||
@property (weak, nonatomic) IBOutlet UIRoundedImageView *msgAvatarImage;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *msgBottomBar;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *msgDateLabel;
|
||||
@property (weak, nonatomic) IBOutlet UITextViewNoDefine *msgText;
|
||||
@property (weak, nonatomic) IBOutlet UIView *readHeader;
|
||||
@property (weak, nonatomic) IBOutlet UIView *deliveredHeader;
|
||||
@property (weak, nonatomic) IBOutlet UIView *undeliveredHeader;
|
||||
@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
|
||||
@property (weak, nonatomic) IBOutlet UITableView *tableView;
|
||||
|
||||
- (IBAction)onBackClick:(id)sender;
|
||||
|
||||
|
|
|
|||
|
|
@ -39,15 +39,6 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
_msg = NULL;
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
for (UIView *view in _scrollView.subviews) {
|
||||
if (view == _readHeader || view == _deliveredHeader || view == _undeliveredHeader)
|
||||
continue;
|
||||
|
||||
[view removeFromSuperview];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
const LinphoneAddress *addr = linphone_chat_message_get_from_address(_msg);
|
||||
|
|
@ -66,25 +57,14 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
_msgView.frame.size.width,
|
||||
[UIChatBubbleTextCell ViewHeightForMessage:_msg withWidth:self.view.frame.size.width].height)];
|
||||
|
||||
[_whiteView setFrame:CGRectMake(self.view.frame.origin.x,
|
||||
self.view.frame.origin.y,
|
||||
self.view.frame.size.width,
|
||||
_msgView.frame.size.height + _msgView.frame.origin.y)];
|
||||
|
||||
_scrollView.scrollEnabled = TRUE;
|
||||
_scrollView.userInteractionEnabled = TRUE;
|
||||
_scrollView.showsVerticalScrollIndicator = TRUE;
|
||||
[_tableView setFrame:CGRectMake(_tableView.frame.origin.x,
|
||||
_msgView.frame.origin.y + _msgView.frame.size.height,
|
||||
_tableView.frame.size.width,
|
||||
self.view.frame.size.height - (_msgView.frame.origin.y + _msgView.frame.size.height))];
|
||||
|
||||
_displayedList = linphone_chat_message_get_participants_that_have_displayed(_msg);
|
||||
_receivedList = linphone_chat_message_get_participants_that_have_received(_msg);
|
||||
_notReceivedList = linphone_chat_message_get_participants_that_have_not_received(_msg);
|
||||
|
||||
if (_displayedList) {
|
||||
}
|
||||
if (_receivedList) {
|
||||
}
|
||||
if (_notReceivedList) {
|
||||
}
|
||||
_displayedList = linphone_chat_message_get_participants_by_imdn_state(_msg, LinphoneChatMessageStateDisplayed);
|
||||
_receivedList = linphone_chat_message_get_participants_by_imdn_state(_msg, LinphoneChatMessageStateDeliveredToUser);
|
||||
_notReceivedList = linphone_chat_message_get_participants_by_imdn_state(_msg, LinphoneChatMessageStateDelivered);
|
||||
}
|
||||
|
||||
#pragma mark - TableView
|
||||
|
|
@ -101,7 +81,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
return 23.0;
|
||||
}
|
||||
|
||||
- (UITableViewHeaderFooterView *)headerViewForSection:(NSInteger)section {
|
||||
- (UITableViewHeaderFooterView *)tableView:(UITableView *)tableView headerViewForSection:(NSInteger)section {
|
||||
NSString *kHeaderId = NSStringFromClass(ChatConversationImdnTableViewHeader.class);
|
||||
ChatConversationImdnTableViewHeader *header = [tableView dequeueReusableHeaderFooterViewWithIdentifier:kHeaderId];
|
||||
if (!header)
|
||||
|
|
@ -109,19 +89,29 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
|
||||
if (section == 1) {
|
||||
if (_displayedList) {
|
||||
header.
|
||||
header.label.text = NSLocalizedString(@"Read", nil);
|
||||
header.icon.imageView.image = [UIImage imageNamed:@"chat_read"];
|
||||
} else if (_receivedList) {
|
||||
|
||||
} else {
|
||||
|
||||
header.label.text = NSLocalizedString(@"Delivered", nil);
|
||||
header.icon.imageView.image = [UIImage imageNamed:@"chat_delivered"];
|
||||
} else if (_notReceivedList) {
|
||||
header.label.text = NSLocalizedString(@"Undelivered", nil);
|
||||
header.icon.imageView.image = [UIImage imageNamed:@"chat_error"];
|
||||
}
|
||||
} else if (section == 2) {
|
||||
if (_receivedList) {
|
||||
|
||||
} else {
|
||||
|
||||
header.label.text = NSLocalizedString(@"Delivered", nil);
|
||||
header.icon.imageView.image = [UIImage imageNamed:@"chat_delivered"];
|
||||
} else if (_notReceivedList) {
|
||||
header.label.text = NSLocalizedString(@"Undelivered", nil);
|
||||
header.icon.imageView.image = [UIImage imageNamed:@"chat_error"];
|
||||
}
|
||||
} else if (section == 3) {
|
||||
header.label.text = NSLocalizedString(@"Undelivered", nil);
|
||||
header.icon.imageView.image = [UIImage imageNamed:@"chat_error"];
|
||||
}
|
||||
|
||||
return header;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
|
|
@ -130,15 +120,17 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
return bctbx_list_size(_displayedList);
|
||||
else if (_receivedList)
|
||||
return bctbx_list_size(_receivedList);
|
||||
else
|
||||
else if (_notReceivedList)
|
||||
return bctbx_list_size(_notReceivedList);
|
||||
} else if (section == 2) {
|
||||
if (_receivedList)
|
||||
return bctbx_list_size(_receivedList);
|
||||
else
|
||||
else if (_notReceivedList)
|
||||
return bctbx_list_size(_notReceivedList);
|
||||
}
|
||||
return bctbx_list_size(_notReceivedList);
|
||||
} else if (section == 3)
|
||||
return bctbx_list_size(_notReceivedList);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
|
|
@ -148,16 +140,19 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
list = _displayedList;
|
||||
else if (_receivedList)
|
||||
list = _receivedList;
|
||||
else
|
||||
else if (_notReceivedList)
|
||||
list = _notReceivedList;
|
||||
} else if (indexPath.section == 2) {
|
||||
if (_receivedList)
|
||||
list = _receivedList;
|
||||
else
|
||||
else if (_notReceivedList)
|
||||
list = _notReceivedList;
|
||||
} else
|
||||
} else if (indexPath.section == 3)
|
||||
list = _notReceivedList;
|
||||
|
||||
if (!list)
|
||||
return nil;
|
||||
|
||||
NSString *kCellId = NSStringFromClass(UIChatConversationImdnTableViewCell.class);
|
||||
UIChatConversationImdnTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId];
|
||||
if (cell == nil) {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
<outlet property="msgDateLabel" destination="jaE-4d-bbo" id="W3u-tE-pGo"/>
|
||||
<outlet property="msgText" destination="V21-2s-obu" id="iTL-AZ-o7h"/>
|
||||
<outlet property="msgView" destination="VK8-0e-Hsa" id="sWi-sR-kan"/>
|
||||
<outlet property="tableView" destination="HjO-C8-Itr" id="cuC-QY-xbT"/>
|
||||
<outlet property="view" destination="1g1-pp-Uhi" id="Km4-Mj-txf"/>
|
||||
</connections>
|
||||
</placeholder>
|
||||
|
|
@ -102,6 +103,16 @@
|
|||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</view>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" style="plain" separatorStyle="default" allowsSelectionDuringEditing="YES" allowsMultipleSelectionDuringEditing="YES" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="HjO-C8-Itr">
|
||||
<rect key="frame" x="8" y="171" width="359" height="496"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color key="separatorColor" red="0.67030966280000004" green="0.71867996450000005" blue="0.75078284740000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="-1" id="fYu-DD-p1k"/>
|
||||
<outlet property="delegate" destination="-1" id="VsB-GE-lPS"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</view>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue