Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

Commit

Permalink
Prepare Dark theme - Move the customization in `customizeViewRenderin…
Browse files Browse the repository at this point in the history
  • Loading branch information
giomfo committed Aug 7, 2017
1 parent 1fb2a74 commit 7a91913
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 38 deletions.
23 changes: 16 additions & 7 deletions MatrixKit/Views/DeviceView/MXKDeviceView.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,6 @@ - (void)awakeFromNib
[tap setDelegate:self];
[self.bgView addGestureRecognizer:tap];

_defaultTextColor = [UIColor blackColor];

// Add shadow on added view
_containerView.layer.cornerRadius = 5;
_containerView.layer.shadowOffset = CGSizeMake(0, 1);
_containerView.layer.shadowOpacity = 0.5f;

// Localize string
[_cancelButton setTitle:[NSBundle mxk_localizedStringForKey:@"ok"] forState:UIControlStateNormal];
[_cancelButton setTitle:[NSBundle mxk_localizedStringForKey:@"ok"] forState:UIControlStateHighlighted];
Expand All @@ -86,6 +79,22 @@ - (void)layoutSubviews
self.textView.contentOffset = CGPointZero;
}

#pragma mark - Override MXKView

-(void)customizeViewRendering
{
[super customizeViewRendering];

_defaultTextColor = [UIColor blackColor];

// Add shadow on added view
_containerView.layer.cornerRadius = 5;
_containerView.layer.shadowOffset = CGSizeMake(0, 1);
_containerView.layer.shadowOpacity = 0.5f;
}

#pragma mark -

- (void)removeFromSuperviewDidUpdate:(BOOL)isUpdated
{
if (currentAlert)
Expand Down
13 changes: 11 additions & 2 deletions MatrixKit/Views/EncryptionInfoView/MXKEncryptionInfoView.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ - (void)awakeFromNib
{
[super awakeFromNib];

_defaultTextColor = [UIColor blackColor];

// Localize string
[_cancelButton setTitle:[NSBundle mxk_localizedStringForKey:@"ok"] forState:UIControlStateNormal];
[_cancelButton setTitle:[NSBundle mxk_localizedStringForKey:@"ok"] forState:UIControlStateHighlighted];
Expand Down Expand Up @@ -83,6 +81,17 @@ - (void)removeFromSuperview
[super removeFromSuperview];
}

#pragma mark - Override MXKView

-(void)customizeViewRendering
{
[super customizeViewRendering];

_defaultTextColor = [UIColor blackColor];
}

#pragma mark -

- (instancetype)initWithEvent:(MXEvent*)event andMatrixSession:(MXSession*)session
{
NSArray *nibViews = [[NSBundle bundleForClass:[MXKEncryptionInfoView class]] loadNibNamed:NSStringFromClass([MXKEncryptionInfoView class])
Expand Down
37 changes: 15 additions & 22 deletions MatrixKit/Views/MXKImageView.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
Copyright 2015 OpenMarket Ltd
Copyright 2017 Vector Creations Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -58,28 +59,6 @@ @implementation MXKImageView

#define CUSTOM_IMAGE_VIEW_BUTTON_WIDTH 100

- (void)awakeFromNib
{
[super awakeFromNib];

self.backgroundColor = [UIColor blackColor];
self.contentMode = UIViewContentModeScaleAspectFit;
self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin;
}

- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self)
{
self.backgroundColor = [UIColor blackColor];
self.contentMode = UIViewContentModeScaleAspectFit;
self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin;
}

return self;
}

- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
Expand All @@ -101,6 +80,20 @@ - (void)dealloc
pieChartView = nil;
}

#pragma mark - Override MXKView

-(void)customizeViewRendering
{
[super customizeViewRendering];

self.backgroundColor = [UIColor blackColor];

self.contentMode = UIViewContentModeScaleAspectFit;
self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin;
}

#pragma mark -

- (void)startActivityIndicator
{
// create the views if they don't exist
Expand Down
21 changes: 15 additions & 6 deletions MatrixKit/Views/RoomInputToolbar/MXKRoomInputToolbarView.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,6 @@ - (void)awakeFromNib
// Finalize setup
[self setTranslatesAutoresizingMaskIntoConstraints: NO];

// Reset default container background color
messageComposerContainer.backgroundColor = [UIColor clearColor];

// Set default toolbar background color
self.backgroundColor = [UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1.0];

// Disable send button
self.rightInputToolbarButton.enabled = NO;

Expand All @@ -116,6 +110,21 @@ - (void)dealloc
[self destroy];
}

#pragma mark - Override MXKView

-(void)customizeViewRendering
{
[super customizeViewRendering];

// Reset default container background color
messageComposerContainer.backgroundColor = [UIColor clearColor];

// Set default toolbar background color
self.backgroundColor = [UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1.0];
}

#pragma mark -

- (IBAction)onTouchUpInside:(UIButton*)button
{
if (button == self.leftInputToolbarButton)
Expand Down
12 changes: 11 additions & 1 deletion MatrixKit/Views/RoomTitle/MXKRoomTitleView.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ - (void)awakeFromNib
[super awakeFromNib];

[self setTranslatesAutoresizingMaskIntoConstraints: NO];
self.autoresizingMask = UIViewAutoresizingFlexibleWidth;

// Add an accessory view to the text view in order to retrieve keyboard view.
inputAccessoryView = [[UIView alloc] initWithFrame:CGRectZero];
Expand All @@ -62,6 +61,17 @@ - (void)dealloc
inputAccessoryView = nil;
}

#pragma mark - Override MXKView

-(void)customizeViewRendering
{
[super customizeViewRendering];

self.autoresizingMask = UIViewAutoresizingFlexibleWidth;
}

#pragma mark -

- (void)refreshDisplay
{
if (_mxRoom)
Expand Down

0 comments on commit 7a91913

Please sign in to comment.