Merge branch 'charlesmchen/themeSearchBars'

This commit is contained in:
Matthew Chen 2018-08-09 14:02:36 -04:00
commit e2dfe00124
7 changed files with 32 additions and 7 deletions

View File

@ -117,8 +117,10 @@ public class ContactsPicker: OWSViewController, UITableViewDelegate, UITableView
self.view.backgroundColor = Theme.backgroundColor
self.tableView.backgroundColor = Theme.backgroundColor
self.searchBar.backgroundColor = Theme.backgroundColor
self.searchBar.backgroundColor = Theme.searchBarBackgroundColor
self.searchBar.barStyle = Theme.barStyle
self.searchBar.searchBarStyle = Theme.searchBarStyle
self.searchBar.barTintColor = Theme.backgroundColor
searchBar.placeholder = NSLocalizedString("INVITE_FRIENDS_PICKER_SEARCHBAR_PLACEHOLDER", comment: "Search")
// Auto size cells for dynamic type

View File

@ -164,8 +164,10 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect
searchBar.delegate = self
searchBar.placeholder = NSLocalizedString("GIF_VIEW_SEARCH_PLACEHOLDER_TEXT",
comment: "Placeholder text for the search field in GIF view")
searchBar.backgroundColor = Theme.backgroundColor
searchBar.backgroundColor = Theme.searchBarBackgroundColor
searchBar.barStyle = Theme.barStyle
searchBar.searchBarStyle = Theme.searchBarStyle
searchBar.barTintColor = Theme.backgroundColor
self.view.addSubview(searchBar)
searchBar.autoPinWidthToSuperview()

View File

@ -257,8 +257,10 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
self.view.backgroundColor = Theme.backgroundColor;
self.tableView.backgroundColor = Theme.backgroundColor;
self.searchBar.backgroundColor = Theme.backgroundColor;
self.searchBar.backgroundColor = Theme.searchBarBackgroundColor;
self.searchBar.barTintColor = Theme.backgroundColor;
self.searchBar.barStyle = Theme.barStyle;
self.searchBar.searchBarStyle = Theme.searchBarStyle;
}
#pragma mark - View Life Cycle
@ -401,7 +403,6 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
UISearchBar *searchBar = [UISearchBar new];
_searchBar = searchBar;
searchBar.searchBarStyle = UISearchBarStyleMinimal;
searchBar.placeholder = NSLocalizedString(@"HOME_VIEW_CONVERSATION_SEARCHBAR_PLACEHOLDER",
@"Placeholder text for search bar which filters conversations.");
searchBar.delegate = self;

View File

@ -101,8 +101,10 @@ NS_ASSUME_NONNULL_BEGIN
searchBar.searchBarStyle = UISearchBarStyleMinimal;
searchBar.delegate = self;
searchBar.placeholder = NSLocalizedString(@"SEARCH_BYNAMEORNUMBER_PLACEHOLDER_TEXT", @"");
searchBar.backgroundColor = [Theme backgroundColor];
searchBar.backgroundColor = Theme.searchBarBackgroundColor;
searchBar.barStyle = Theme.barStyle;
searchBar.searchBarStyle = Theme.searchBarStyle;
searchBar.barTintColor = Theme.backgroundColor;
[searchBar sizeToFit];
_tableViewController = [OWSTableViewController new];

View File

@ -91,8 +91,10 @@ NS_ASSUME_NONNULL_BEGIN
searchBar.searchBarStyle = UISearchBarStyleMinimal;
searchBar.delegate = self;
searchBar.placeholder = NSLocalizedString(@"SEARCH_BYNAMEORNUMBER_PLACEHOLDER_TEXT", @"");
searchBar.backgroundColor = [Theme backgroundColor];
searchBar.backgroundColor = Theme.searchBarBackgroundColor;
searchBar.barStyle = Theme.barStyle;
searchBar.searchBarStyle = Theme.searchBarStyle;
searchBar.barTintColor = Theme.backgroundColor;
[searchBar sizeToFit];
UIView *header = [self.selectThreadViewDelegate createHeaderWithSearchBar:searchBar];

View File

@ -44,6 +44,8 @@ extern NSString *const ThemeDidChangeNotification;
#pragma mark -
@property (class, readonly, nonatomic) UIBarStyle barStyle;
@property (class, readonly, nonatomic) UISearchBarStyle searchBarStyle;
@property (class, readonly, nonatomic) UIColor *searchBarBackgroundColor;
@end

View File

@ -123,12 +123,26 @@ NSString *const ThemeKeyThemeEnabled = @"ThemeKeyThemeEnabled";
+ (UIBarStyle)barStyle
{
if (Theme.isDarkThemeEnabled) {
return UIBarStyleBlack;
return UIBarStyleDefault;
} else {
return UIBarStyleDefault;
}
}
+ (UISearchBarStyle)searchBarStyle
{
if (Theme.isDarkThemeEnabled) {
return UISearchBarStyleProminent;
} else {
return UISearchBarStyleMinimal;
}
}
+ (UIColor *)searchBarBackgroundColor
{
return Theme.backgroundColor;
}
@end
NS_ASSUME_NONNULL_END