Update filter placeholder and icon (#5520)

* Update filter placeholder and icon

* Use SwiftGen asset helper & add filter_on icon

Co-authored-by: Arnaud Ringenbach <arnaud.ringenbach@niji.fr>
This commit is contained in:
aringenbach
2022-02-14 10:25:21 +01:00
committed by GitHub
parent d37c0d7296
commit e788dc1b0b
13 changed files with 74 additions and 3 deletions
@@ -121,7 +121,11 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro
tableSearchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 600, 44)];
tableSearchBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
tableSearchBar.showsCancelButton = NO;
tableSearchBar.placeholder = [VectorL10n searchDefaultPlaceholder];
tableSearchBar.placeholder = [VectorL10n searchFilterPlaceholder];
[tableSearchBar setImage:AssetImages.filterOff.image
forSearchBarIcon:UISearchBarIconSearch
state:UIControlStateNormal];
tableSearchBar.delegate = self;
displayedSectionHeaders = [NSMutableArray array];
@@ -169,8 +173,11 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro
}];
self.recentsSearchBar.autocapitalizationType = UITextAutocapitalizationTypeNone;
self.recentsSearchBar.placeholder = [VectorL10n searchDefaultPlaceholder];
self.recentsSearchBar.placeholder = [VectorL10n searchFilterPlaceholder];
[self.recentsSearchBar setImage:AssetImages.filterOff.image
forSearchBarIcon:UISearchBarIconSearch
state:UIControlStateNormal];
// Observe user interface theme change.
kThemeServiceDidChangeThemeNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kThemeServiceDidChangeThemeNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) {
@@ -2193,6 +2200,16 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro
[self.recentsSearchBar setShowsCancelButton:NO animated:NO];
}
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{
[super searchBar:searchBar textDidChange:searchText];
UIImage *filterIcon = searchText.length > 0 ? AssetImages.filterOn.image : AssetImages.filterOff.image;
[self.recentsSearchBar setImage:filterIcon
forSearchBarIcon:UISearchBarIconSearch
state:UIControlStateNormal];
}
#pragma mark - CreateRoomCoordinatorBridgePresenterDelegate
- (void)createRoomCoordinatorBridgePresenterDelegate:(CreateRoomCoordinatorBridgePresenter *)coordinatorBridgePresenter didCreateNewRoom:(MXRoom *)room