UX Rework: Add home page

- Improve filter handling
- Fix empty people section

https://github.com/vector-im/riot-meta/issues/75
This commit is contained in:
Giom Foret 2017-05-12 17:39:05 +02:00
parent b16e77e551
commit 5d3d74fd51
3 changed files with 17 additions and 42 deletions

View file

@ -244,7 +244,7 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
favoritesSection = sectionsCount++;
}
if (peopleCellDataArray.count > 0)
if (_recentsDataSourceMode == RecentsDataSourceModeHome)
{
peopleSection = sectionsCount++;
}
@ -789,7 +789,8 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
{
return self.droppingCellBackGroundView.frame.size.height;
}
if (indexPath.section == conversationSection && !conversationCellDataArray.count)
if ((indexPath.section == conversationSection && !conversationCellDataArray.count)
|| (indexPath.section == peopleSection && !peopleCellDataArray.count))
{
return 50.0;
}

View file

@ -192,28 +192,10 @@
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == recentsDataSource.conversationSection && !recentsDataSource.conversationCellDataArray.count)
if ((indexPath.section == recentsDataSource.conversationSection && !recentsDataSource.conversationCellDataArray.count)
|| (indexPath.section == recentsDataSource.peopleSection && !recentsDataSource.peopleCellDataArray.count))
{
MXKTableViewCell *tableViewCell = [tableView dequeueReusableCellWithIdentifier:[MXKTableViewCell defaultReuseIdentifier]];
if (!tableViewCell)
{
tableViewCell = [[MXKTableViewCell alloc] init];
tableViewCell.textLabel.textColor = kRiotTextColorGray;
tableViewCell.textLabel.font = [UIFont systemFontOfSize:15.0];
tableViewCell.selectionStyle = UITableViewCellSelectionStyleNone;
}
// Check whether a search session is in progress
if (recentsDataSource.searchPatternsList)
{
tableViewCell.textLabel.text = NSLocalizedStringFromTable(@"search_no_result", @"Vector", nil);
}
else
{
tableViewCell.textLabel.text = NSLocalizedStringFromTable(@"room_recents_no_conversation", @"Vector", nil);
}
return tableViewCell;
return [recentsDataSource tableView:tableView cellForRowAtIndexPath:indexPath];
}
TableViewCellWithCollectionView *tableViewCell = [tableView dequeueReusableCellWithIdentifier:TableViewCellWithCollectionView.defaultReuseIdentifier forIndexPath:indexPath];
@ -235,9 +217,10 @@
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == recentsDataSource.conversationSection && !recentsDataSource.conversationCellDataArray.count)
if ((indexPath.section == recentsDataSource.conversationSection && !recentsDataSource.conversationCellDataArray.count)
|| (indexPath.section == recentsDataSource.peopleSection && !recentsDataSource.peopleCellDataArray.count))
{
return 50.0;
return [recentsDataSource cellHeightAtIndexPath:indexPath];
}
// Return the fixed height of the collection view cell used to display a room.

View file

@ -132,10 +132,6 @@
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// Add the search bar by hidding it by default.
self.recentsTableView.tableHeaderView = tableSearchBar;
self.recentsTableView.contentOffset = CGPointMake(0, tableSearchBar.frame.size.height);
// Adjust Bottom constraint to take into account tabBar.
[NSLayoutConstraint deactivateConstraints:@[_stickyHeadersBottomContainerBottomConstraint]];
_stickyHeadersBottomContainerBottomConstraint = [NSLayoutConstraint constraintWithItem:self.bottomLayoutGuide
@ -324,19 +320,20 @@
isRefreshPending = NO;
CGPoint contentOffset = self.recentsTableView.contentOffset;
[self.recentsTableView reloadData];
if (!_enableStickyHeaders && self.recentsTableView.tableHeaderView != tableSearchBar)
{
// Add the search bar by hiding it by default.
self.recentsTableView.tableHeaderView = tableSearchBar;
self.recentsTableView.contentOffset = CGPointMake(0, self.recentsTableView.contentOffset.y + tableSearchBar.frame.size.height);
}
if (_shouldScrollToTopOnRefresh)
{
[self scrollToTop:NO];
_shouldScrollToTopOnRefresh = NO;
}
else
{
self.recentsTableView.contentOffset = contentOffset;
}
[self updateStickyHeaders];
@ -375,12 +372,6 @@
self.recentsTableView.tableHeaderView = nil;
self.recentsTableView.contentInset = UIEdgeInsetsZero;
}
else if (!_enableStickyHeaders && self.recentsTableView.tableHeaderView != tableSearchBar)
{
// Add the search bar by hidding it by default.
self.recentsTableView.tableHeaderView = tableSearchBar;
self.recentsTableView.contentOffset = CGPointMake(0, tableSearchBar.frame.size.height);
}
}
#pragma mark -
@ -583,7 +574,7 @@
if (self.recentsSearchBar.hidden && self.recentsTableView.tableHeaderView != tableSearchBar)
{
// Add the search bar by hidding it by default.
// Add the search bar by hiding it by default.
self.recentsTableView.tableHeaderView = tableSearchBar;
self.recentsTableView.contentInset = UIEdgeInsetsZero;
self.recentsTableView.contentOffset = CGPointMake(0, tableSearchBar.frame.size.height);