diff --git a/Riot/ViewController/GroupHomeViewController.m b/Riot/ViewController/GroupHomeViewController.m
index a504d1e39..bac5e13b3 100644
--- a/Riot/ViewController/GroupHomeViewController.m
+++ b/Riot/ViewController/GroupHomeViewController.m
@@ -119,6 +119,7 @@
self.separatorView.backgroundColor = kRiotSecondaryBgColor;
_groupLongDescription.textColor = kRiotSecondaryTextColor;
+ _groupLongDescription.tintColor = kRiotColorBlue;
[self.leftButton.layer setCornerRadius:5];
self.leftButton.clipsToBounds = YES;
diff --git a/Riot/ViewController/GroupHomeViewController.xib b/Riot/ViewController/GroupHomeViewController.xib
index 1049f1367..ccceda926 100644
--- a/Riot/ViewController/GroupHomeViewController.xib
+++ b/Riot/ViewController/GroupHomeViewController.xib
@@ -246,12 +246,13 @@
-
+
Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.
+
diff --git a/Riot/ViewController/GroupParticipantsViewController.m b/Riot/ViewController/GroupParticipantsViewController.m
index b2561b2ed..cf62e1e61 100644
--- a/Riot/ViewController/GroupParticipantsViewController.m
+++ b/Riot/ViewController/GroupParticipantsViewController.m
@@ -119,10 +119,17 @@
// Search bar header is hidden when no group is provided
_searchBarHeader.hidden = (self.group == nil);
+ // Enable self-sizing cells and section headers.
+ self.tableView.rowHeight = UITableViewAutomaticDimension;
+ self.tableView.estimatedRowHeight = 74;
+ self.tableView.sectionHeaderHeight = UITableViewAutomaticDimension;
+ self.tableView.estimatedSectionHeaderHeight = 30;
+
// Hide line separators of empty cells
self.tableView.tableFooterView = [[UIView alloc] init];
[self.tableView registerClass:ContactTableViewCell.class forCellReuseIdentifier:@"ParticipantTableViewCellId"];
+ [self.tableView registerNib:MXKTableViewHeaderFooterWithLabel.nib forHeaderFooterViewReuseIdentifier:MXKTableViewHeaderFooterWithLabel.defaultReuseIdentifier];
// @TODO: Add programmatically the button to add participant.
//[self addAddParticipantButton];
@@ -805,7 +812,22 @@
#pragma mark - UITableView delegate
-- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;
+- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ return tableView.estimatedRowHeight;
+}
+
+- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForHeaderInSection:(NSInteger)section
+{
+ if (section == invitedSection)
+ {
+ return tableView.estimatedSectionHeaderHeight;
+ }
+
+ return 0;
+}
+
+- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
cell.backgroundColor = kRiotPrimaryBgColor;
@@ -826,52 +848,34 @@
cell.selectedBackgroundView.backgroundColor = nil;
}
}
+
+ // Refresh here the estimated row height
+ tableView.estimatedRowHeight = cell.frame.size.height;
}
-- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
+- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(nonnull UIView *)view forSection:(NSInteger)section
{
- CGFloat height = 0.0;
+ // Refresh here the estimated header height
+ tableView.estimatedSectionHeaderHeight = view.frame.size.height;
+}
+
+- (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
+{
+ MXKTableViewHeaderFooterWithLabel *sectionHeader;
if (section == invitedSection)
{
- height = 30.0;
- }
-
- return height;
-}
-
-- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
-{
- UIView* sectionHeader;
-
- if (section == invitedSection)
- {
- sectionHeader = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 30)];
- sectionHeader.backgroundColor = kRiotSecondaryBgColor;
+ sectionHeader = [tableView dequeueReusableHeaderFooterViewWithIdentifier:MXKTableViewHeaderFooterWithLabel.defaultReuseIdentifier];
+ sectionHeader.mxkContentView.backgroundColor = kRiotSecondaryBgColor;
+ sectionHeader.mxkLabel.textColor = kRiotPrimaryTextColor;
+ sectionHeader.mxkLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline];
- CGRect frame = sectionHeader.frame;
- frame.origin.x = 20;
- frame.origin.y = 5;
- frame.size.width = sectionHeader.frame.size.width - 10;
- frame.size.height -= 10;
- UILabel *headerLabel = [[UILabel alloc] initWithFrame:frame];
- headerLabel.textColor = kRiotPrimaryTextColor;
- headerLabel.font = [UIFont boldSystemFontOfSize:15.0];
- headerLabel.backgroundColor = [UIColor clearColor];
-
- headerLabel.text = NSLocalizedStringFromTable(@"group_participants_invited_section", @"Vector", nil);
-
- [sectionHeader addSubview:headerLabel];
+ sectionHeader.mxkLabel.text = NSLocalizedStringFromTable(@"group_participants_invited_section", @"Vector", nil);
}
return sectionHeader;
}
-- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
-{
- return 74.0;
-}
-
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
diff --git a/Riot/ViewController/GroupsViewController.m b/Riot/ViewController/GroupsViewController.m
index 199c818c0..ace2e8f1d 100644
--- a/Riot/ViewController/GroupsViewController.m
+++ b/Riot/ViewController/GroupsViewController.m
@@ -88,6 +88,7 @@
self.groupsTableView.estimatedRowHeight = 74;
self.groupsTableView.sectionHeaderHeight = UITableViewAutomaticDimension;
self.groupsTableView.estimatedSectionHeaderHeight = 30;
+ self.groupsTableView.estimatedSectionFooterHeight = 0;
// Observe UIApplicationDidEnterBackgroundNotification to refresh bubbles when app leaves the foreground state.
UIApplicationDidEnterBackgroundNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidEnterBackgroundNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) {
@@ -428,6 +429,8 @@
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;
{
+ [super tableView:tableView willDisplayCell:cell forRowAtIndexPath:indexPath];
+
cell.backgroundColor = kRiotPrimaryBgColor;
// Update the selected background view
diff --git a/Riot/Views/Contact/ContactTableViewCell.m b/Riot/Views/Contact/ContactTableViewCell.m
index 42dd51732..1259162ed 100644
--- a/Riot/Views/Contact/ContactTableViewCell.m
+++ b/Riot/Views/Contact/ContactTableViewCell.m
@@ -298,6 +298,19 @@
subLabelText = phoneNumber.textNumber;
}
}
+
+ if (subLabelText.length)
+ {
+ self.contactInformationLabel.hidden = NO;
+ }
+ else
+ {
+ // Hide and fill the label with a fake string to harmonize the height of all the cells.
+ // This is a drawback of the self-sizing cell.
+ self.contactInformationLabel.hidden = YES;
+ subLabelText = @"No method";
+ }
+
self.contactInformationLabel.text = subLabelText;
}
@@ -327,6 +340,18 @@
{
presenceText = NSLocalizedStringFromTable(@"room_participants_offline", @"Vector", nil);
}
+
+ if (presenceText.length)
+ {
+ self.contactInformationLabel.hidden = NO;
+ }
+ else
+ {
+ // Hide and fill the label with a fake string to harmonize the height of all the cells.
+ // This is a drawback of the self-sizing cell.
+ self.contactInformationLabel.hidden = YES;
+ presenceText = @"No presence";
+ }
self.contactInformationLabel.text = presenceText;
}
diff --git a/Riot/Views/Contact/ContactTableViewCell.xib b/Riot/Views/Contact/ContactTableViewCell.xib
index d08cf9111..2209926d9 100644
--- a/Riot/Views/Contact/ContactTableViewCell.xib
+++ b/Riot/Views/Contact/ContactTableViewCell.xib
@@ -1,11 +1,11 @@
-
-
+
+
-
+
@@ -15,7 +15,7 @@
-
+
@@ -35,23 +35,17 @@
-
+
+
diff --git a/Riot/Views/Group/GroupTableViewCell.xib b/Riot/Views/Group/GroupTableViewCell.xib
index 27dc5ff66..1433c1fc8 100644
--- a/Riot/Views/Group/GroupTableViewCell.xib
+++ b/Riot/Views/Group/GroupTableViewCell.xib
@@ -18,7 +18,7 @@
-
+