Prepare UX rework:

- Fix sections handling in unified search screen.
- Prepare sticky headers in RecentsViewController.
This commit is contained in:
Giom Foret
2017-04-11 17:58:59 +02:00
parent f25b2e7a51
commit 076ca21993
14 changed files with 432 additions and 244 deletions
@@ -67,6 +67,22 @@
@implementation RecentsViewController
#pragma mark - Class methods
+ (UINib *)nib
{
return [UINib nibWithNibName:NSStringFromClass([RecentsViewController class])
bundle:[NSBundle bundleForClass:[RecentsViewController class]]];
}
+ (instancetype)recentListViewController
{
return [[[self class] alloc] initWithNibName:NSStringFromClass([RecentsViewController class])
bundle:[NSBundle bundleForClass:[RecentsViewController class]]];
}
#pragma mark -
- (void)awakeFromNib
{
[super awakeFromNib];
@@ -89,6 +105,8 @@
// Set default screen name
_screenName = @"RecentsScreen";
_enableStickyHeaders = NO;
// Set itself as delegate by default.
self.delegate = self;
}
@@ -98,6 +116,17 @@
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// Adjust Bottom constraint to take into account tabBar.
[NSLayoutConstraint deactivateConstraints:@[_stickyHeadersBottomContainerBottomConstraint]];
_stickyHeadersBottomContainerBottomConstraint = [NSLayoutConstraint constraintWithItem:self.bottomLayoutGuide
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:self.stickyHeadersBottomContainer
attribute:NSLayoutAttributeBottom
multiplier:1.0f
constant:0.0f];
[NSLayoutConstraint activateConstraints:@[_stickyHeadersBottomContainerBottomConstraint]];
self.recentsTableView.accessibilityIdentifier = @"RecentsVCTableView";
// Register here the customized cell view class used to render recents
@@ -243,6 +272,25 @@
}
}
#pragma mark - Override MXKRecentListViewController
- (void)setKeyboardHeight:(CGFloat)keyboardHeight
{
// Deduce the bottom constraint for the table view (Don't forget the potential tabBar)
CGFloat tableViewBottomConst = keyboardHeight - self.bottomLayoutGuide.length;
// Check whether the keyboard is over the tabBar
if (tableViewBottomConst < 0)
{
tableViewBottomConst = 0;
}
// Update constraints
_stickyHeadersBottomContainerBottomConstraint.constant = tableViewBottomConst;
// Force layout immediately to take into account new constraint
[self.view layoutIfNeeded];
}
#pragma mark -
- (void)refreshCurrentSelectedCell:(BOOL)forceVisible