Skip to content

Commit

Permalink
Prepare Dark Theme - Customize Riot view by using `customizeViewRende…
Browse files Browse the repository at this point in the history
…ring` method.

element-hq/riot-meta#22
  • Loading branch information
giomfo committed Aug 8, 2017
1 parent 23a76e0 commit eee878b
Show file tree
Hide file tree
Showing 11 changed files with 117 additions and 57 deletions.
28 changes: 17 additions & 11 deletions Riot/Views/Authentication/AuthInputsView.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,9 @@ - (void)awakeFromNib
{
[super awakeFromNib];

_repeatPasswordTextField.placeholder = NSLocalizedStringFromTable(@"auth_repeat_password_placeholder", @"Vector", nil);
_repeatPasswordTextField.textColor = kRiotTextColorBlack;

self.repeatPasswordTextField.placeholder = NSLocalizedStringFromTable(@"auth_repeat_password_placeholder", @"Vector", nil);
self.userLoginTextField.placeholder = NSLocalizedStringFromTable(@"auth_user_id_placeholder", @"Vector", nil);
self.userLoginTextField.textColor = kRiotTextColorBlack;

self.passWordTextField.placeholder = NSLocalizedStringFromTable(@"auth_password_placeholder", @"Vector", nil);
self.passWordTextField.textColor = kRiotTextColorBlack;

self.emailTextField.textColor = kRiotTextColorBlack;
self.phoneTextField.textColor = kRiotTextColorBlack;

self.messageLabel.numberOfLines = 0;

_thirdPartyIdentifiersHidden = YES;
_isThirdPartyIdentifierPending = NO;
Expand All @@ -99,6 +89,22 @@ -(void)layoutSubviews
}
}

#pragma mark - Override MXKView

-(void)customizeViewRendering
{
[super customizeViewRendering];

self.repeatPasswordTextField.textColor = kRiotTextColorBlack;
self.userLoginTextField.textColor = kRiotTextColorBlack;
self.passWordTextField.textColor = kRiotTextColorBlack;

self.emailTextField.textColor = kRiotTextColorBlack;
self.phoneTextField.textColor = kRiotTextColorBlack;

self.messageLabel.numberOfLines = 0;
}

#pragma mark -

- (BOOL)setAuthSession:(MXAuthenticationSession *)authSession withAuthType:(MXKAuthenticationType)authType;
Expand Down
27 changes: 17 additions & 10 deletions Riot/Views/Authentication/ForgotPasswordInputsView.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,9 @@ - (void)awakeFromNib
[super awakeFromNib];

self.emailTextField.placeholder = NSLocalizedStringFromTable(@"auth_email_placeholder", @"Vector", nil);
self.emailTextField.textColor = kRiotTextColorBlack;

self.passWordTextField.placeholder = NSLocalizedStringFromTable(@"auth_new_password_placeholder", @"Vector", nil);
self.passWordTextField.textColor = kRiotTextColorBlack;

self.repeatPasswordTextField.placeholder = NSLocalizedStringFromTable(@"auth_repeat_new_password_placeholder", @"Vector", nil);
self.repeatPasswordTextField.textColor = kRiotTextColorBlack;

self.messageLabel.numberOfLines = 0;

[self.nextStepButton.layer setCornerRadius:5];
self.nextStepButton.clipsToBounds = YES;
self.nextStepButton.backgroundColor = kRiotColorGreen;
[self.nextStepButton setTitle:[NSBundle mxk_localizedStringForKey:@"auth_reset_password_next_step_button"] forState:UIControlStateNormal];
[self.nextStepButton setTitle:[NSBundle mxk_localizedStringForKey:@"auth_reset_password_next_step_button"] forState:UIControlStateHighlighted];
self.nextStepButton.enabled = YES;
Expand Down Expand Up @@ -102,6 +92,23 @@ -(void)layoutSubviews
self.viewHeightConstraint.constant = lastItemFrame.origin.y + lastItemFrame.size.height;
}

#pragma mark - Override MXKView

-(void)customizeViewRendering
{
[super customizeViewRendering];

self.emailTextField.textColor = kRiotTextColorBlack;
self.passWordTextField.textColor = kRiotTextColorBlack;
self.repeatPasswordTextField.textColor = kRiotTextColorBlack;

self.messageLabel.numberOfLines = 0;

[self.nextStepButton.layer setCornerRadius:5];
self.nextStepButton.clipsToBounds = YES;
self.nextStepButton.backgroundColor = kRiotColorGreen;
}

#pragma mark -

- (BOOL)setAuthSession:(MXAuthenticationSession *)authSession withAuthType:(MXKAuthenticationType)authType;
Expand Down
6 changes: 4 additions & 2 deletions Riot/Views/Device/DeviceView.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@

@implementation DeviceView

- (void)awakeFromNib
#pragma mark - Override MXKView

-(void)customizeViewRendering
{
[super awakeFromNib];
[super customizeViewRendering];

self.defaultTextColor = kRiotTextColorBlack;
}
Expand Down
6 changes: 4 additions & 2 deletions Riot/Views/EncryptionInfoView/EncryptionInfoView.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@

@implementation EncryptionInfoView

- (void)awakeFromNib
#pragma mark - Override MXKView

-(void)customizeViewRendering
{
[super awakeFromNib];
[super customizeViewRendering];

self.defaultTextColor = kRiotTextColorBlack;
}
Expand Down
15 changes: 12 additions & 3 deletions Riot/Views/RoomActivitiesView/RoomActivitiesView.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ - (void)awakeFromNib
{
[super awakeFromNib];

self.separatorView.backgroundColor = kRiotColorLightGrey;
self.messageLabel.textColor = kRiotTextColorGray;

// Adjust text view
// Remove the container inset: this operation impacts only the vertical margin.
// Reset textContainer.lineFragmentPadding to remove horizontal margin.
Expand All @@ -108,6 +105,18 @@ - (void)awakeFromNib
xibMainHeightConstraint = self.mainHeightConstraint.constant;
}

#pragma mark - Override MXKView

-(void)customizeViewRendering
{
[super customizeViewRendering];

self.separatorView.backgroundColor = kRiotColorLightGrey;
self.messageLabel.textColor = kRiotTextColorGray;
}

#pragma mark -

- (void)displayUnsentMessagesNotification:(NSString*)notification withResendLink:(void (^)(void))onResendLinkPressed andCancelLink:(void (^)(void))onCancelLinkPressed andIconTapGesture:(void (^)(void))onIconTapGesture
{
[self reset];
Expand Down
19 changes: 14 additions & 5 deletions Riot/Views/RoomInputToolbar/RoomInputToolbarView.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,25 @@ - (void)awakeFromNib
{
[super awakeFromNib];

// Remove default toolbar background color
self.backgroundColor = [UIColor clearColor];

_supportCallOption = YES;

self.rightInputToolbarButton.hidden = YES;

[self.rightInputToolbarButton setTitleColor:kRiotColorGreen forState:UIControlStateNormal];
[self.rightInputToolbarButton setTitleColor:kRiotColorGreen forState:UIControlStateHighlighted];

self.isEncryptionEnabled = _isEncryptionEnabled;
}

#pragma mark - Override MXKView

-(void)customizeViewRendering
{
[super customizeViewRendering];

// Remove default toolbar background color
self.backgroundColor = [UIColor clearColor];

self.separatorView.backgroundColor = kRiotColorSilver;

// Custom the growingTextView display
Expand All @@ -83,10 +92,10 @@ - (void)awakeFromNib
growingTextView.font = [UIFont systemFontOfSize:15];
growingTextView.textColor = kRiotTextColorBlack;
growingTextView.tintColor = kRiotColorGreen;

self.isEncryptionEnabled = _isEncryptionEnabled;
}

#pragma mark -

- (void)setSupportCallOption:(BOOL)supportCallOption
{
if (_supportCallOption != supportCallOption)
Expand Down
4 changes: 2 additions & 2 deletions Riot/Views/RoomMember/RoomMemberTitleView.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#import <MatrixKit/MatrixKit.h>

@interface RoomMemberTitleView : UIView
@interface RoomMemberTitleView : MXKView

/**
* Returns the `UINib` object initialized for the room member title view.
Expand All @@ -38,4 +38,4 @@
@property (weak, nonatomic) IBOutlet UIImageView *memberBadge;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *memberAvatarCenterXConstraint;

@end
@end
5 changes: 5 additions & 0 deletions Riot/Views/RoomTitle/ExpandedRoomTitleView.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ + (UINib *)nib
- (void)awakeFromNib
{
[super awakeFromNib];
}

-(void)customizeViewRendering
{
[super customizeViewRendering];

self.displayNameTextField.textColor = kRiotTextColorBlack;
self.roomTopic.textColor = kRiotTextColorDarkGray;
Expand Down
46 changes: 28 additions & 18 deletions Riot/Views/RoomTitle/PreviewRoomTitleView.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,34 @@ - (void)awakeFromNib
{
[super awakeFromNib];

self.previewLabel.text = nil;
self.subNoticeLabel.text = nil;

[self.leftButton setTitle:NSLocalizedStringFromTable(@"decline", @"Vector", nil) forState:UIControlStateNormal];
[self.leftButton setTitle:NSLocalizedStringFromTable(@"decline", @"Vector", nil) forState:UIControlStateHighlighted];

UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(reportTapGesture:)];
[tap setNumberOfTouchesRequired:1];
[tap setNumberOfTapsRequired:1];
[tap setDelegate:self];
[self.leftButton addGestureRecognizer:tap];
self.leftButton.userInteractionEnabled = YES;

[self.rightButton setTitle:NSLocalizedStringFromTable(@"join", @"Vector", nil) forState:UIControlStateNormal];
[self.rightButton setTitle:NSLocalizedStringFromTable(@"join", @"Vector", nil) forState:UIControlStateHighlighted];

tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(reportTapGesture:)];
[tap setNumberOfTouchesRequired:1];
[tap setNumberOfTapsRequired:1];
[tap setDelegate:self];
[self.rightButton addGestureRecognizer:tap];
self.rightButton.userInteractionEnabled = YES;
}

-(void)customizeViewRendering
{
[super customizeViewRendering];

self.mainHeaderBackground.backgroundColor = kRiotColorLightGrey;

self.displayNameTextField.textColor = kRiotTextColorBlack;
Expand All @@ -44,37 +72,19 @@ - (void)awakeFromNib

self.previewLabel.textColor = kRiotTextColorDarkGray;
self.previewLabel.numberOfLines = 0;
self.previewLabel.text = nil;

self.subNoticeLabel.textColor = kRiotTextColorGray;
self.subNoticeLabel.numberOfLines = 0;
self.subNoticeLabel.text = nil;

self.bottomBorderView.backgroundColor = kRiotColorLightGrey;

[self.leftButton.layer setCornerRadius:5];
self.leftButton.clipsToBounds = YES;
self.leftButton.backgroundColor = kRiotColorGreen;
[self.leftButton setTitle:NSLocalizedStringFromTable(@"decline", @"Vector", nil) forState:UIControlStateNormal];
[self.leftButton setTitle:NSLocalizedStringFromTable(@"decline", @"Vector", nil) forState:UIControlStateHighlighted];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(reportTapGesture:)];
[tap setNumberOfTouchesRequired:1];
[tap setNumberOfTapsRequired:1];
[tap setDelegate:self];
[self.leftButton addGestureRecognizer:tap];
self.leftButton.userInteractionEnabled = YES;

[self.rightButton.layer setCornerRadius:5];
self.rightButton.clipsToBounds = YES;
self.rightButton.backgroundColor = kRiotColorGreen;
[self.rightButton setTitle:NSLocalizedStringFromTable(@"join", @"Vector", nil) forState:UIControlStateNormal];
[self.rightButton setTitle:NSLocalizedStringFromTable(@"join", @"Vector", nil) forState:UIControlStateHighlighted];
tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(reportTapGesture:)];
[tap setNumberOfTouchesRequired:1];
[tap setNumberOfTapsRequired:1];
[tap setDelegate:self];
[self.rightButton addGestureRecognizer:tap];
self.rightButton.userInteractionEnabled = YES;
}

- (void)refreshDisplay
Expand Down
9 changes: 7 additions & 2 deletions Riot/Views/RoomTitle/RoomTitleView.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ - (void)awakeFromNib
{
[super awakeFromNib];

self.displayNameTextField.textColor = kRiotTextColorBlack;

if (_titleMask)
{
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(reportTapGesture:)];
Expand Down Expand Up @@ -109,6 +107,13 @@ - (void)layoutSubviews
}
}

-(void)customizeViewRendering
{
[super customizeViewRendering];

self.displayNameTextField.textColor = kRiotTextColorBlack;
}

- (void)setRoomPreviewData:(RoomPreviewData *)roomPreviewData
{
_roomPreviewData = roomPreviewData;
Expand Down
9 changes: 7 additions & 2 deletions Riot/Views/RoomTitle/SimpleRoomTitleView.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ + (UINib *)nib
- (void)awakeFromNib
{
[super awakeFromNib];

self.displayNameTextField.textColor = kRiotTextColorBlack;
}

- (void)layoutSubviews
Expand Down Expand Up @@ -68,6 +66,13 @@ - (void)layoutSubviews
}
}

-(void)customizeViewRendering
{
[super customizeViewRendering];

self.displayNameTextField.textColor = kRiotTextColorBlack;
}

- (void)refreshDisplay
{
[super refreshDisplay];
Expand Down

0 comments on commit eee878b

Please sign in to comment.