Skip to content

Commit

Permalink
Improve the people invite screens
Browse files Browse the repository at this point in the history
 #904.

Enable contacts section shrinking when the 2 sections are displayed.
  • Loading branch information
giomfo committed Jan 13, 2017
1 parent e50bb34 commit 1d667a5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Vector/ViewController/ContactsTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

#import "AppDelegate.h"

#define CONTACTS_TABLEVC_LOCALCONTACTS_BIT 0x01
#define CONTACTS_TABLEVC_KNOWNCONTACTS_BIT 0x02
#define CONTACTS_TABLEVC_LOCALCONTACTS_BITWISE 0x01
#define CONTACTS_TABLEVC_KNOWNCONTACTS_BITWISE 0x02

@interface ContactsTableViewController ()
{
Expand Down Expand Up @@ -508,11 +508,11 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
{
count = 1;
}
else if (section == filteredLocalContactsSection && !(shrinkedSectionsBitMask & CONTACTS_TABLEVC_LOCALCONTACTS_BIT))
else if (section == filteredLocalContactsSection && !(shrinkedSectionsBitMask & CONTACTS_TABLEVC_LOCALCONTACTS_BITWISE))
{
count = filteredLocalContacts.count;
}
else if (section == filteredMatrixContactsSection && !(shrinkedSectionsBitMask & CONTACTS_TABLEVC_KNOWNCONTACTS_BIT))
else if (section == filteredMatrixContactsSection && !(shrinkedSectionsBitMask & CONTACTS_TABLEVC_KNOWNCONTACTS_BITWISE))
{
count = filteredMatrixContacts.count;
}
Expand Down Expand Up @@ -622,7 +622,7 @@ - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger

if (section == filteredLocalContactsSection || section == filteredMatrixContactsSection)
{
NSInteger sectionBit = -1;
NSInteger sectionBitwise = -1;

sectionHeader = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 30)];
sectionHeader.backgroundColor = kVectorColorLightGrey;
Expand All @@ -640,12 +640,12 @@ - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger
if (section == filteredLocalContactsSection)
{
headerLabel.text = NSLocalizedStringFromTable(@"contacts_address_book_section", @"Vector", nil);
sectionBit = CONTACTS_TABLEVC_LOCALCONTACTS_BIT;
sectionBitwise = CONTACTS_TABLEVC_LOCALCONTACTS_BITWISE;
}
else //if (section == filteredMatrixContactsSection)
{
headerLabel.text = NSLocalizedStringFromTable(@"contacts_matrix_users_section", @"Vector", nil);
sectionBit = CONTACTS_TABLEVC_KNOWNCONTACTS_BIT;
sectionBitwise = CONTACTS_TABLEVC_KNOWNCONTACTS_BITWISE;
}

if (enableSectionShrinking)
Expand All @@ -657,13 +657,13 @@ - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger
shrinkButton.frame = frame;
shrinkButton.backgroundColor = [UIColor clearColor];
[shrinkButton addTarget:self action:@selector(onButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
shrinkButton.tag = sectionBit;
shrinkButton.tag = sectionBitwise;
[sectionHeader addSubview:shrinkButton];
sectionHeader.userInteractionEnabled = YES;

// Add shrink icon
UIImage *chevron;
if (shrinkedSectionsBitMask & sectionBit)
if (shrinkedSectionsBitMask & sectionBitwise)
{
chevron = [UIImage imageNamed:@"disclosure_icon"];
}
Expand Down

0 comments on commit 1d667a5

Please sign in to comment.