reskin: Create ThemeService.shared

This commit is contained in:
manuroe
2019-01-11 11:45:27 +01:00
parent d94284a100
commit bed6b151cb
112 changed files with 758 additions and 728 deletions
@@ -112,10 +112,10 @@
{
[super customizeViewRendering];
self.separatorView.backgroundColor = ThemeService.theme.headerBackgroundColor;
self.separatorView.backgroundColor = ThemeService.shared.theme.headerBackgroundColor;
if (self.messageLabel.textColor != kRiotColorPinkRed)
{
self.messageLabel.textColor = ThemeService.theme.textSecondaryColor;
self.messageLabel.textColor = ThemeService.shared.theme.textSecondaryColor;
}
}
@@ -260,12 +260,12 @@
// Display the string in white on pink red
NSRange wholeString = NSMakeRange(0, onGoingConferenceCallAttibutedString.length);
[onGoingConferenceCallAttibutedString addAttribute:NSForegroundColorAttributeName value:ThemeService.theme.backgroundColor range:wholeString];
[onGoingConferenceCallAttibutedString addAttribute:NSForegroundColorAttributeName value:ThemeService.shared.theme.backgroundColor range:wholeString];
[onGoingConferenceCallAttibutedString addAttribute:NSBackgroundColorAttributeName value:kRiotColorPinkRed range:wholeString];
[onGoingConferenceCallAttibutedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:15] range:wholeString];
self.messageTextView.attributedText = onGoingConferenceCallAttibutedString;
self.messageTextView.tintColor = ThemeService.theme.backgroundColor;
self.messageTextView.tintColor = ThemeService.shared.theme.backgroundColor;
self.messageTextView.hidden = NO;
self.backgroundColor = kRiotColorPinkRed;
@@ -356,7 +356,7 @@
[roomReplacementAttributedString appendAttributedString:roomLinkAttributedString];
NSRange wholeStringRange = NSMakeRange(0, roomReplacementAttributedString.length);
[roomReplacementAttributedString addAttribute:NSForegroundColorAttributeName value:ThemeService.theme.textPrimaryColor range:wholeStringRange];
[roomReplacementAttributedString addAttribute:NSForegroundColorAttributeName value:ThemeService.shared.theme.textPrimaryColor range:wholeStringRange];
self.messageTextView.attributedText = roomReplacementAttributedString;
}
@@ -365,7 +365,7 @@
self.messageTextView.text = NSLocalizedStringFromTable(@"room_replacement_information", @"Vector", nil);
}
self.messageTextView.tintColor = ThemeService.theme.textPrimaryColor;
self.messageTextView.tintColor = ThemeService.shared.theme.textPrimaryColor;
self.messageTextView.hidden = NO;
self.messageTextView.backgroundColor = [UIColor clearColor];
@@ -432,13 +432,13 @@
message2 = [[NSAttributedString alloc] initWithString:NSLocalizedStringFromTable(@"room_resource_usage_limit_reached_message_2", @"Vector", nil)
attributes:@{
NSFontAttributeName: [UIFont boldSystemFontOfSize:fontSize],
NSForegroundColorAttributeName: ThemeService.theme.backgroundColor
NSForegroundColorAttributeName: ThemeService.shared.theme.backgroundColor
}];
}
NSDictionary *attributes = @{
NSFontAttributeName: [UIFont systemFontOfSize:fontSize],
NSForegroundColorAttributeName: ThemeService.theme.backgroundColor
NSForegroundColorAttributeName: ThemeService.shared.theme.backgroundColor
};
NSDictionary *messageContact2LinkAttributes;
@@ -482,7 +482,7 @@
[attributedText appendAttributedString:messageContact3];
self.messageTextView.attributedText = attributedText;
self.messageTextView.tintColor = ThemeService.theme.backgroundColor;
self.messageTextView.tintColor = ThemeService.shared.theme.backgroundColor;
self.messageTextView.hidden = NO;
if (hardLimit)
@@ -535,7 +535,7 @@
[self.messageTextView resignFirstResponder];
self.messageTextView.hidden = YES;
self.messageLabel.textColor = ThemeService.theme.textSecondaryColor;
self.messageLabel.textColor = ThemeService.shared.theme.textSecondaryColor;
objc_removeAssociatedObjects(self.messageTextView);
}
@@ -26,8 +26,8 @@
{
[super customizeTableViewCellRendering];
self.userNameLabel.textColor = ThemeService.theme.textPrimaryColor;
self.messageTextView.tintColor = ThemeService.theme.tintColor;
self.userNameLabel.textColor = ThemeService.shared.theme.textPrimaryColor;
self.messageTextView.tintColor = ThemeService.shared.theme.tintColor;
}
@end
@@ -26,11 +26,11 @@
{
[super customizeTableViewCellRendering];
self.userNameLabel.textColor = ThemeService.theme.textPrimaryColor;
self.userNameLabel.textColor = ThemeService.shared.theme.textPrimaryColor;
self.paginationLabel.textColor = ThemeService.theme.tintColor;
self.paginationSeparatorView.backgroundColor = ThemeService.theme.tintColor;
self.messageTextView.tintColor = ThemeService.theme.tintColor;
self.paginationLabel.textColor = ThemeService.shared.theme.tintColor;
self.paginationSeparatorView.backgroundColor = ThemeService.shared.theme.tintColor;
self.messageTextView.tintColor = ThemeService.shared.theme.tintColor;
}
- (void)render:(MXKCellData *)cellData
@@ -26,7 +26,7 @@
{
[super customizeTableViewCellRendering];
self.messageTextView.tintColor = ThemeService.theme.tintColor;
self.messageTextView.tintColor = ThemeService.shared.theme.tintColor;
}
@end
@@ -26,8 +26,8 @@
{
[super customizeTableViewCellRendering];
self.userNameLabel.textColor = ThemeService.theme.textPrimaryColor;
self.messageTextView.tintColor = ThemeService.theme.tintColor;
self.userNameLabel.textColor = ThemeService.shared.theme.textPrimaryColor;
self.messageTextView.tintColor = ThemeService.shared.theme.tintColor;
}
@end
@@ -26,11 +26,11 @@
{
[super customizeTableViewCellRendering];
self.userNameLabel.textColor = ThemeService.theme.textPrimaryColor;
self.userNameLabel.textColor = ThemeService.shared.theme.textPrimaryColor;
self.paginationLabel.textColor = ThemeService.theme.tintColor;
self.paginationSeparatorView.backgroundColor = ThemeService.theme.tintColor;
self.messageTextView.tintColor = ThemeService.theme.tintColor;
self.paginationLabel.textColor = ThemeService.shared.theme.tintColor;
self.paginationSeparatorView.backgroundColor = ThemeService.shared.theme.tintColor;
self.messageTextView.tintColor = ThemeService.shared.theme.tintColor;
}
- (void)render:(MXKCellData *)cellData
@@ -26,7 +26,7 @@
{
[super customizeTableViewCellRendering];
self.messageTextView.tintColor = ThemeService.theme.tintColor;
self.messageTextView.tintColor = ThemeService.shared.theme.tintColor;
}
@end
@@ -26,7 +26,7 @@
{
[super customizeTableViewCellRendering];
self.messageTextView.tintColor = ThemeService.theme.tintColor;
self.messageTextView.tintColor = ThemeService.shared.theme.tintColor;
}
@end
@@ -26,7 +26,7 @@
{
[super customizeTableViewCellRendering];
self.messageTextView.tintColor = ThemeService.theme.tintColor;
self.messageTextView.tintColor = ThemeService.shared.theme.tintColor;
}
@end
@@ -41,7 +41,7 @@
{
[super customizeTableViewCellRendering];
self.messageTextView.tintColor = ThemeService.theme.tintColor;
self.messageTextView.tintColor = ThemeService.shared.theme.tintColor;
}
- (void)prepareForReuse
@@ -30,7 +30,7 @@
{
[super customizeTableViewCellRendering];
self.messageTextView.tintColor = ThemeService.theme.tintColor;
self.messageTextView.tintColor = ThemeService.shared.theme.tintColor;
}
- (void)layoutSubviews
@@ -27,8 +27,8 @@
{
[super customizeTableViewCellRendering];
self.paginationLabel.textColor = ThemeService.theme.tintColor;
self.paginationSeparatorView.backgroundColor = ThemeService.theme.tintColor;
self.paginationLabel.textColor = ThemeService.shared.theme.tintColor;
self.paginationSeparatorView.backgroundColor = ThemeService.shared.theme.tintColor;
}
- (void)render:(MXKCellData *)cellData
@@ -38,9 +38,9 @@ NSString *const kRoomMembershipExpandedBubbleCellTapOnCollapseButton = @"kRoomMe
{
[super customizeTableViewCellRendering];
self.separatorView.backgroundColor = ThemeService.theme.headerBackgroundColor;
self.separatorView.backgroundColor = ThemeService.shared.theme.headerBackgroundColor;
[self.collapseButton setTintColor:ThemeService.theme.tintColor];
[self.collapseButton setTintColor:ThemeService.shared.theme.tintColor];
self.collapseButton.titleLabel.font = [UIFont systemFontOfSize:14];
}
@@ -27,8 +27,8 @@
{
[super customizeTableViewCellRendering];
self.paginationLabel.textColor = ThemeService.theme.tintColor;
self.paginationSeparatorView.backgroundColor = ThemeService.theme.tintColor;
self.paginationLabel.textColor = ThemeService.shared.theme.tintColor;
self.paginationSeparatorView.backgroundColor = ThemeService.shared.theme.tintColor;
}
- (void)render:(MXKCellData *)cellData
@@ -27,8 +27,8 @@
{
[super customizeTableViewCellRendering];
self.paginationLabel.textColor = ThemeService.theme.tintColor;
self.paginationSeparatorView.backgroundColor = ThemeService.theme.tintColor;
self.paginationLabel.textColor = ThemeService.shared.theme.tintColor;
self.paginationSeparatorView.backgroundColor = ThemeService.shared.theme.tintColor;
}
- (void)render:(MXKCellData *)cellData
@@ -26,8 +26,8 @@
{
[super customizeTableViewCellRendering];
self.userNameLabel.textColor = ThemeService.theme.textPrimaryColor;
self.messageTextView.tintColor = ThemeService.theme.tintColor;
self.userNameLabel.textColor = ThemeService.shared.theme.textPrimaryColor;
self.messageTextView.tintColor = ThemeService.shared.theme.tintColor;
}
- (void)render:(MXKCellData *)cellData
@@ -26,11 +26,11 @@
{
[super customizeTableViewCellRendering];
self.userNameLabel.textColor = ThemeService.theme.textPrimaryColor;
self.userNameLabel.textColor = ThemeService.shared.theme.textPrimaryColor;
self.paginationLabel.textColor = ThemeService.theme.tintColor;
self.paginationSeparatorView.backgroundColor = ThemeService.theme.tintColor;
self.messageTextView.tintColor = ThemeService.theme.tintColor;
self.paginationLabel.textColor = ThemeService.shared.theme.tintColor;
self.paginationSeparatorView.backgroundColor = ThemeService.shared.theme.tintColor;
self.messageTextView.tintColor = ThemeService.shared.theme.tintColor;
}
- (void)render:(MXKCellData *)cellData
@@ -26,7 +26,7 @@
{
[super customizeTableViewCellRendering];
self.messageTextView.tintColor = ThemeService.theme.tintColor;
self.messageTextView.tintColor = ThemeService.shared.theme.tintColor;
}
- (void)render:(MXKCellData *)cellData
@@ -26,8 +26,8 @@
{
[super customizeTableViewCellRendering];
self.userNameLabel.textColor = ThemeService.theme.textPrimaryColor;
self.messageTextView.tintColor = ThemeService.theme.tintColor;
self.userNameLabel.textColor = ThemeService.shared.theme.textPrimaryColor;
self.messageTextView.tintColor = ThemeService.shared.theme.tintColor;
}
@end
@@ -26,8 +26,8 @@
{
[super customizeTableViewCellRendering];
self.paginationLabel.textColor = ThemeService.theme.tintColor;
self.paginationSeparatorView.backgroundColor = ThemeService.theme.tintColor;
self.paginationLabel.textColor = ThemeService.shared.theme.tintColor;
self.paginationSeparatorView.backgroundColor = ThemeService.shared.theme.tintColor;
}
- (void)render:(MXKCellData *)cellData
@@ -26,7 +26,7 @@
{
[super customizeTableViewCellRendering];
self.messageTextView.tintColor = ThemeService.theme.tintColor;
self.messageTextView.tintColor = ThemeService.shared.theme.tintColor;
}
@end
@@ -58,8 +58,8 @@ static CGFloat const kCustomBackgroundCornerRadius = 5.0;
{
[super customizeTableViewCellRendering];
self.messageTextView.tintColor = ThemeService.theme.textPrimaryColor;
self.customBackgroundView.backgroundColor = ThemeService.theme.headerBackgroundColor;
self.messageTextView.tintColor = ThemeService.shared.theme.textPrimaryColor;
self.customBackgroundView.backgroundColor = ThemeService.shared.theme.headerBackgroundColor;
}
@end
@@ -45,8 +45,8 @@
arrowMaskLayer.path = path.CGPath;
self.arrowView.layer.mask = arrowMaskLayer;
self.arrowView.backgroundColor = ThemeService.theme.headerBackgroundColor;
self.descriptionView.backgroundColor = ThemeService.theme.headerBackgroundColor;
self.arrowView.backgroundColor = ThemeService.shared.theme.headerBackgroundColor;
self.descriptionView.backgroundColor = ThemeService.shared.theme.headerBackgroundColor;
[self.descriptionView.layer setCornerRadius:10];
}
@@ -25,11 +25,11 @@
{
[super customizeViewRendering];
self.backgroundColor = ThemeService.theme.headerBackgroundColor;
self.textView.backgroundColor = ThemeService.theme.backgroundColor;
self.textView.textColor = ThemeService.theme.textPrimaryColor;
self.redactButton.tintColor = ThemeService.theme.tintColor;
self.closeButton.tintColor = ThemeService.theme.tintColor;
self.backgroundColor = ThemeService.shared.theme.headerBackgroundColor;
self.textView.backgroundColor = ThemeService.shared.theme.backgroundColor;
self.textView.textColor = ThemeService.shared.theme.textPrimaryColor;
self.redactButton.tintColor = ThemeService.shared.theme.tintColor;
self.closeButton.tintColor = ThemeService.shared.theme.tintColor;
}
@end
@@ -48,11 +48,11 @@
// Remove default toolbar background color
self.backgroundColor = [UIColor clearColor];
self.separatorView.backgroundColor = ThemeService.theme.headerTextSecondaryColor;
self.separatorView.backgroundColor = ThemeService.shared.theme.headerTextSecondaryColor;
self.disabledReasonTextView.font = [UIFont systemFontOfSize:15];
self.disabledReasonTextView.textColor = ThemeService.theme.textPrimaryColor;
self.disabledReasonTextView.tintColor = ThemeService.theme.tintColor;
self.disabledReasonTextView.textColor = ThemeService.shared.theme.textPrimaryColor;
self.disabledReasonTextView.tintColor = ThemeService.shared.theme.tintColor;
self.disabledReasonTextView.editable = NO;
self.disabledReasonTextView.scrollEnabled = NO;
}
@@ -72,8 +72,8 @@
self.rightInputToolbarButton.hidden = YES;
[self.rightInputToolbarButton setTitleColor:ThemeService.theme.tintColor forState:UIControlStateNormal];
[self.rightInputToolbarButton setTitleColor:ThemeService.theme.tintColor forState:UIControlStateHighlighted];
[self.rightInputToolbarButton setTitleColor:ThemeService.shared.theme.tintColor forState:UIControlStateNormal];
[self.rightInputToolbarButton setTitleColor:ThemeService.shared.theme.tintColor forState:UIControlStateHighlighted];
self.isEncryptionEnabled = _isEncryptionEnabled;
}
@@ -87,7 +87,7 @@
// Remove default toolbar background color
self.backgroundColor = [UIColor clearColor];
self.separatorView.backgroundColor = ThemeService.theme.headerTextSecondaryColor;
self.separatorView.backgroundColor = ThemeService.shared.theme.headerTextSecondaryColor;
// Custom the growingTextView display
growingTextView.layer.cornerRadius = 0;
@@ -95,10 +95,10 @@
growingTextView.backgroundColor = [UIColor clearColor];
growingTextView.font = [UIFont systemFontOfSize:15];
growingTextView.textColor = ThemeService.theme.textPrimaryColor;
growingTextView.tintColor = ThemeService.theme.tintColor;
growingTextView.textColor = ThemeService.shared.theme.textPrimaryColor;
growingTextView.tintColor = ThemeService.shared.theme.tintColor;
growingTextView.internalTextView.keyboardAppearance = ThemeService.theme.keyboardAppearance;
growingTextView.internalTextView.keyboardAppearance = ThemeService.shared.theme.keyboardAppearance;
}
#pragma mark -
@@ -40,19 +40,19 @@
[super layoutSubviews];
self.membersListIcon.image = [MXKTools paintImage:self.membersListIcon.image
withColor:ThemeService.theme.tintColor];
withColor:ThemeService.shared.theme.tintColor];
// TODO: paintImage does not work here because addParticipantIcon has 2 colors
// self.addParticipantIcon.image = [MXKTools paintImage:self.addParticipantIcon.image
// withColor:ThemeService.theme.accent];
// withColor:ThemeService.shared.theme.accent];
}
-(void)customizeViewRendering
{
[super customizeViewRendering];
self.roomTopic.textColor = ThemeService.theme.baseTextSecondaryColor;
self.roomMembers.textColor = ThemeService.theme.tintColor;
self.roomTopic.textColor = ThemeService.shared.theme.baseTextSecondaryColor;
self.roomMembers.textColor = ThemeService.shared.theme.tintColor;
}
- (void)refreshDisplay
@@ -131,7 +131,7 @@
self.roomAvatar.layer.cornerRadius = self.roomAvatar.frame.size.width / 2;
self.roomAvatar.clipsToBounds = YES;
self.roomAvatar.defaultBackgroundColor = ThemeService.theme.headerBackgroundColor;
self.roomAvatar.defaultBackgroundColor = ThemeService.shared.theme.headerBackgroundColor;
// Force the layout of subviews to update the position of 'bottomBorderView' which is used to define the actual height of the preview container.
[self layoutIfNeeded];
@@ -64,28 +64,28 @@
[super customizeViewRendering];
// Use same color as navigation bar
self.mainHeaderBackground.backgroundColor = ThemeService.theme.baseColor;
self.mainHeaderBackground.backgroundColor = ThemeService.shared.theme.baseColor;
self.roomTopic.textColor = ThemeService.theme.baseTextSecondaryColor;
self.roomTopic.textColor = ThemeService.shared.theme.baseTextSecondaryColor;
self.roomMembers.textColor = ThemeService.theme.tintColor;
self.roomMembers.textColor = ThemeService.shared.theme.tintColor;
self.previewLabel.textColor = ThemeService.theme.baseTextSecondaryColor;
self.previewLabel.textColor = ThemeService.shared.theme.baseTextSecondaryColor;
self.previewLabel.numberOfLines = 0;
self.subNoticeLabel.textColor = ThemeService.theme.textSecondaryColor;
self.subNoticeLabel.textColor = ThemeService.shared.theme.textSecondaryColor;
self.subNoticeLabel.numberOfLines = 0;
self.bottomBorderView.backgroundColor = ThemeService.theme.headerBackgroundColor;
self.bottomBorderView.backgroundColor = ThemeService.shared.theme.headerBackgroundColor;
[self.leftButton.layer setCornerRadius:5];
self.leftButton.clipsToBounds = YES;
self.leftButton.backgroundColor = ThemeService.theme.tintColor;
self.leftButton.backgroundColor = ThemeService.shared.theme.tintColor;
[self.rightButton.layer setCornerRadius:5];
self.rightButton.clipsToBounds = YES;
self.rightButton.backgroundColor = ThemeService.theme.tintColor;
self.rightButton.backgroundColor = ThemeService.shared.theme.tintColor;
}
- (void)refreshDisplay
@@ -103,7 +103,7 @@
toFitViewSize:self.roomAvatar.frame.size
withMethod:MXThumbnailingMethodCrop
previewImage:[MXKTools paintImage:[UIImage imageNamed:@"placeholder"]
withColor:ThemeService.theme.tintColor]
withColor:ThemeService.shared.theme.tintColor]
mediaManager:self.mxRoom.mxSession.mediaManager];
}
else
@@ -249,7 +249,7 @@
self.roomAvatar.layer.cornerRadius = self.roomAvatar.frame.size.width / 2;
self.roomAvatar.clipsToBounds = YES;
self.roomAvatar.defaultBackgroundColor = ThemeService.theme.headerBackgroundColor;
self.roomAvatar.defaultBackgroundColor = ThemeService.shared.theme.headerBackgroundColor;
// Force the layout of subviews to update the position of 'bottomBorderView' which is used to define the actual height of the preview container.
[self layoutIfNeeded];
@@ -73,7 +73,7 @@
[super layoutSubviews];
self.roomDetailsIconImageView.image = [MXKTools paintImage:self.roomDetailsIconImageView.image
withColor:ThemeService.theme.tintColor];
withColor:ThemeService.shared.theme.tintColor];
if (self.superview)
{
@@ -138,8 +138,8 @@
[super customizeViewRendering];
// Use same color as navigation bar
self.backgroundColor = ThemeService.theme.baseColor;
self.displayNameTextField.textColor = (self.mxRoom.summary.displayname.length ? ThemeService.theme.baseTextPrimaryColor : ThemeService.theme.textSecondaryColor);
self.backgroundColor = ThemeService.shared.theme.baseColor;
self.displayNameTextField.textColor = (self.mxRoom.summary.displayname.length ? ThemeService.shared.theme.baseTextPrimaryColor : ThemeService.shared.theme.textSecondaryColor);
}
- (void)setRoomPreviewData:(RoomPreviewData *)roomPreviewData
@@ -164,11 +164,11 @@
if (!self.displayNameTextField.text.length)
{
self.displayNameTextField.text = [NSBundle mxk_localizedStringForKey:@"room_displayname_empty_room"];
self.displayNameTextField.textColor = ThemeService.theme.textSecondaryColor;
self.displayNameTextField.textColor = ThemeService.shared.theme.textSecondaryColor;
}
else
{
self.displayNameTextField.textColor = ThemeService.theme.baseTextPrimaryColor;
self.displayNameTextField.textColor = ThemeService.shared.theme.baseTextPrimaryColor;
}
}
}