Prepare UX rework:

- Display informative cell in empty sections
This commit is contained in:
Giom Foret
2017-04-26 11:10:44 +02:00
parent 76bbc1e5e2
commit 0be386e14c
8 changed files with 135 additions and 19 deletions
+26 -2
View File
@@ -425,13 +425,15 @@
}
else if (section == filteredLocalContactsSection && !(shrinkedSectionsBitMask & CONTACTSDATASOURCE_LOCALCONTACTS_BITWISE))
{
count = filteredLocalContacts.count;
// Display a default cell when no local contacts is available.
count = filteredLocalContacts.count ? filteredLocalContacts.count : 1;
}
else if (section == filteredMatrixContactsSection && !(shrinkedSectionsBitMask & CONTACTSDATASOURCE_KNOWNCONTACTS_BITWISE))
{
if (currentSearchText.length)
{
count = filteredMatrixContacts.count;
// Display a default cell when no contacts is available.
count = filteredMatrixContacts.count ? filteredMatrixContacts.count : 1;
}
else
{
@@ -536,6 +538,28 @@
return contactCell;
}
else
{
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 (currentSearchText.length)
{
tableViewCell.textLabel.text = NSLocalizedStringFromTable(@"search_no_result", @"Vector", nil);
}
else if (indexPath.section == filteredLocalContactsSection)
{
tableViewCell.textLabel.text = NSLocalizedStringFromTable(@"contacts_address_book_no_contact", @"Vector", nil);
}
return tableViewCell;
}
return nil;
}