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

Commit

Permalink
Merge pull request #328 from matrix-org/riot_meta_22
Browse files Browse the repository at this point in the history
Prepare Dark Theme
  • Loading branch information
giomfo authored Jul 21, 2017
2 parents e0539bd + e78040a commit d103c19
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 8 deletions.
47 changes: 43 additions & 4 deletions MatrixKit/Controllers/MXKTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ - (void)viewDidLoad

activityIndicator.center = self.view.center;
[self.view addSubview:activityIndicator];

// Apply the navigation bar tint color.
self.defaultBarTintColor = defaultBarTintColor;
}

- (void)dealloc
Expand Down Expand Up @@ -181,6 +184,38 @@ - (void)setEnableBarTintColorStatusChange:(BOOL)enable
}
}

- (void)setDefaultBarTintColor:(UIColor *)barTintColor
{
defaultBarTintColor = barTintColor;

// Retrieve the main navigation controller if the current view controller is embedded inside a split view controller.
UINavigationController *mainNavigationController = nil;
if (self.splitViewController)
{
mainNavigationController = self.navigationController;
UIViewController *parentViewController = self.parentViewController;
while (parentViewController)
{
if (parentViewController.navigationController)
{
mainNavigationController = parentViewController.navigationController;
parentViewController = parentViewController.parentViewController;
}
else
{
break;
}
}
}

// Set default tintColor
self.navigationController.navigationBar.barTintColor = defaultBarTintColor;
if (mainNavigationController)
{
mainNavigationController.navigationBar.barTintColor = defaultBarTintColor;
}
}

- (void)setView:(UIView *)view
{
[super setView:view];
Expand Down Expand Up @@ -433,11 +468,15 @@ - (void)onMatrixSessionChange
// Hide potential activity indicator
[self stopActivityIndicator];

// Restore default tintColor
self.navigationController.navigationBar.barTintColor = defaultBarTintColor;
if (mainNavigationController)
// Check whether the navigation bar color depends on homeserver reachability.
if (enableBarTintColorStatusChange)
{
mainNavigationController.navigationBar.barTintColor = defaultBarTintColor;
// Restore default tintColor
self.navigationController.navigationBar.barTintColor = defaultBarTintColor;
if (mainNavigationController)
{
mainNavigationController.navigationBar.barTintColor = defaultBarTintColor;
}
}
}
}
Expand Down
48 changes: 44 additions & 4 deletions MatrixKit/Controllers/MXKViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ - (void)viewDidLoad

activityIndicator.center = self.view.center;
[self.view addSubview:activityIndicator];

// Apply the navigation bar tint color.
self.defaultBarTintColor = defaultBarTintColor;
}

- (void)dealloc
Expand Down Expand Up @@ -192,6 +195,38 @@ - (void)setEnableBarTintColorStatusChange:(BOOL)enable
}
}

- (void)setDefaultBarTintColor:(UIColor *)barTintColor
{
defaultBarTintColor = barTintColor;

// Retrieve the main navigation controller if the current view controller is embedded inside a split view controller.
UINavigationController *mainNavigationController = nil;
if (self.splitViewController)
{
mainNavigationController = self.navigationController;
UIViewController *parentViewController = self.parentViewController;
while (parentViewController)
{
if (parentViewController.navigationController)
{
mainNavigationController = parentViewController.navigationController;
parentViewController = parentViewController.parentViewController;
}
else
{
break;
}
}
}

// Set default tintColor
self.navigationController.navigationBar.barTintColor = defaultBarTintColor;
if (mainNavigationController)
{
mainNavigationController.navigationBar.barTintColor = defaultBarTintColor;
}
}

- (void)setView:(UIView *)view
{
[super setView:view];
Expand Down Expand Up @@ -449,11 +484,16 @@ - (void)onMatrixSessionChange
// Hide potential activity indicator
[self stopActivityIndicator];

// Restore default tintColor
self.navigationController.navigationBar.barTintColor = defaultBarTintColor;
if (mainNavigationController)
// Check whether the navigation bar color depends on homeserver reachability.
if (enableBarTintColorStatusChange)
{
mainNavigationController.navigationBar.barTintColor = defaultBarTintColor;
// Restore default tintColor
self.navigationController.navigationBar.barTintColor = defaultBarTintColor;
if (mainNavigationController)
{
mainNavigationController.navigationBar.barTintColor = defaultBarTintColor;
}

}
}
}
Expand Down

0 comments on commit d103c19

Please sign in to comment.