mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-20 00:24:43 +02:00
reskin: Create ThemeService.shared
This commit is contained in:
@@ -157,21 +157,21 @@
|
||||
|
||||
- (void)userInterfaceThemeDidChange
|
||||
{
|
||||
[ThemeService.theme applyStyleOnNavigationBar:self.navigationController.navigationBar];
|
||||
[ThemeService.shared.theme applyStyleOnNavigationBar:self.navigationController.navigationBar];
|
||||
|
||||
self.activityIndicator.backgroundColor = ThemeService.theme.overlayBackgroundColor;
|
||||
self.activityIndicator.backgroundColor = ThemeService.shared.theme.overlayBackgroundColor;
|
||||
|
||||
[self refreshSearchBarItemsColor:_searchBarView];
|
||||
|
||||
_searchBarHeaderBorder.backgroundColor = ThemeService.theme.headerBorderColor;
|
||||
_searchBarHeaderBorder.backgroundColor = ThemeService.shared.theme.headerBorderColor;
|
||||
|
||||
// Check the table view style to select its bg color.
|
||||
self.tableView.backgroundColor = ((self.tableView.style == UITableViewStylePlain) ? ThemeService.theme.backgroundColor : ThemeService.theme.headerBackgroundColor);
|
||||
self.tableView.backgroundColor = ((self.tableView.style == UITableViewStylePlain) ? ThemeService.shared.theme.backgroundColor : ThemeService.shared.theme.headerBackgroundColor);
|
||||
self.view.backgroundColor = self.tableView.backgroundColor;
|
||||
|
||||
// Update the gradient view above the screen
|
||||
CGFloat white = 1.0;
|
||||
[ThemeService.theme.backgroundColor getWhite:&white alpha:nil];
|
||||
[ThemeService.shared.theme.backgroundColor getWhite:&white alpha:nil];
|
||||
CGColorRef opaqueWhiteColor = [UIColor colorWithWhite:white alpha:1.0].CGColor;
|
||||
CGColorRef transparentWhiteColor = [UIColor colorWithWhite:white alpha:0].CGColor;
|
||||
tableViewMaskLayer.colors = @[(__bridge id) transparentWhiteColor, (__bridge id) transparentWhiteColor, (__bridge id) opaqueWhiteColor];
|
||||
@@ -184,7 +184,7 @@
|
||||
|
||||
- (UIStatusBarStyle)preferredStatusBarStyle
|
||||
{
|
||||
return ThemeService.theme.statusBarStyle;
|
||||
return ThemeService.shared.theme.statusBarStyle;
|
||||
}
|
||||
|
||||
// This method is called when the viewcontroller is added or removed from a container view controller.
|
||||
@@ -575,9 +575,9 @@
|
||||
// Add blur mask programmatically
|
||||
tableViewMaskLayer = [CAGradientLayer layer];
|
||||
|
||||
// Consider the grayscale components of the ThemeService.theme.backgroundColor.
|
||||
// Consider the grayscale components of the ThemeService.shared.theme.backgroundColor.
|
||||
CGFloat white = 1.0;
|
||||
[ThemeService.theme.backgroundColor getWhite:&white alpha:nil];
|
||||
[ThemeService.shared.theme.backgroundColor getWhite:&white alpha:nil];
|
||||
|
||||
CGColorRef opaqueWhiteColor = [UIColor colorWithWhite:white alpha:1.0].CGColor;
|
||||
CGColorRef transparentWhiteColor = [UIColor colorWithWhite:white alpha:0].CGColor;
|
||||
@@ -1175,13 +1175,13 @@
|
||||
|
||||
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;
|
||||
{
|
||||
cell.backgroundColor = ThemeService.theme.backgroundColor;
|
||||
cell.backgroundColor = ThemeService.shared.theme.backgroundColor;
|
||||
|
||||
// Update the selected background view
|
||||
if (ThemeService.theme.selectedBackgroundColor)
|
||||
if (ThemeService.shared.theme.selectedBackgroundColor)
|
||||
{
|
||||
cell.selectedBackgroundView = [[UIView alloc] init];
|
||||
cell.selectedBackgroundView.backgroundColor = ThemeService.theme.selectedBackgroundColor;
|
||||
cell.selectedBackgroundView.backgroundColor = ThemeService.shared.theme.selectedBackgroundColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1215,7 +1215,7 @@
|
||||
if (section == invitedSection)
|
||||
{
|
||||
sectionHeader = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 30)];
|
||||
sectionHeader.backgroundColor = ThemeService.theme.headerBackgroundColor;
|
||||
sectionHeader.backgroundColor = ThemeService.shared.theme.headerBackgroundColor;
|
||||
|
||||
CGRect frame = sectionHeader.frame;
|
||||
frame.origin.x = 20;
|
||||
@@ -1223,7 +1223,7 @@
|
||||
frame.size.width = sectionHeader.frame.size.width - 10;
|
||||
frame.size.height -= 10;
|
||||
UILabel *headerLabel = [[UILabel alloc] initWithFrame:frame];
|
||||
headerLabel.textColor = ThemeService.theme.textPrimaryColor;
|
||||
headerLabel.textColor = ThemeService.shared.theme.textPrimaryColor;
|
||||
headerLabel.font = [UIFont boldSystemFontOfSize:15.0];
|
||||
headerLabel.backgroundColor = [UIColor clearColor];
|
||||
|
||||
@@ -1327,7 +1327,7 @@
|
||||
|
||||
}];
|
||||
|
||||
leaveAction.backgroundColor = [MXKTools convertImageToPatternColor:@"remove_icon" backgroundColor:ThemeService.theme.headerBackgroundColor patternSize:CGSizeMake(74, 74) resourceSize:CGSizeMake(24, 24)];
|
||||
leaveAction.backgroundColor = [MXKTools convertImageToPatternColor:@"remove_icon" backgroundColor:ThemeService.shared.theme.headerBackgroundColor patternSize:CGSizeMake(74, 74) resourceSize:CGSizeMake(24, 24)];
|
||||
[actions insertObject:leaveAction atIndex:0];
|
||||
}
|
||||
|
||||
@@ -1684,19 +1684,19 @@
|
||||
- (void)refreshSearchBarItemsColor:(UISearchBar *)searchBar
|
||||
{
|
||||
// bar tint color
|
||||
searchBar.barTintColor = searchBar.tintColor = ThemeService.theme.tintColor;
|
||||
searchBar.tintColor = ThemeService.theme.tintColor;
|
||||
searchBar.barTintColor = searchBar.tintColor = ThemeService.shared.theme.tintColor;
|
||||
searchBar.tintColor = ThemeService.shared.theme.tintColor;
|
||||
|
||||
// FIXME: this all seems incredibly fragile and tied to gutwrenching the current UISearchBar internals.
|
||||
|
||||
// text color
|
||||
UITextField *searchBarTextField = [searchBar valueForKey:@"_searchField"];
|
||||
searchBarTextField.textColor = ThemeService.theme.textSecondaryColor;
|
||||
searchBarTextField.textColor = ThemeService.shared.theme.textSecondaryColor;
|
||||
|
||||
// Magnifying glass icon.
|
||||
UIImageView *leftImageView = (UIImageView *)searchBarTextField.leftView;
|
||||
leftImageView.image = [leftImageView.image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
|
||||
leftImageView.tintColor = ThemeService.theme.tintColor;
|
||||
leftImageView.tintColor = ThemeService.shared.theme.tintColor;
|
||||
|
||||
// remove the gray background color
|
||||
UIView *effectBackgroundTop = [searchBarTextField valueForKey:@"_effectBackgroundTop"];
|
||||
@@ -1707,8 +1707,8 @@
|
||||
// place holder
|
||||
searchBarTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:searchBarTextField.placeholder
|
||||
attributes:@{NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle),
|
||||
NSUnderlineColorAttributeName: ThemeService.theme.tintColor,
|
||||
NSForegroundColorAttributeName: ThemeService.theme.tintColor}];
|
||||
NSUnderlineColorAttributeName: ThemeService.shared.theme.tintColor,
|
||||
NSForegroundColorAttributeName: ThemeService.shared.theme.tintColor}];
|
||||
}
|
||||
|
||||
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
|
||||
|
||||
Reference in New Issue
Block a user