Commit 016561ca authored by Carola Nitz's avatar Carola Nitz

TabBarController: adopt the MoreViewcontroller for the theme

parent 5fb9dad5
......@@ -79,6 +79,7 @@ public class PresentationTheme : NSObject {
{
didSet {
NotificationCenter.default.post(name: VLCThemeDidChangeNotification, object: self)
AppearanceManager.setupAppearance(theme: self.current)
}
}
}
......
//
// MoreTabBarDataSource.swift
// VLC-iOS
//
// Created by Carola Nitz on 1/31/18.
// Copyright © 2018 VideoLAN. All rights reserved.
//
import Foundation
......@@ -101,7 +101,7 @@ NSString *const VLCDropboxSessionWasAuthorized = @"VLCDropboxSessionWasAuthorize
// Configure Dropbox
[DBClientsManager setupWithAppKey:kVLCDropboxAppKey];
[self setupAppearence];
[VLCApperanceManager setupAppearanceWithTheme:PresentationTheme.current];
// Init the HTTP Server and clean its cache
[[VLCHTTPUploaderController sharedInstance] cleanCache];
......@@ -194,31 +194,6 @@ NSString *const VLCDropboxSessionWasAuthorized = @"VLCDropboxSessionWasAuthorize
return YES;
}
- (void)setupAppearence
{
UIColor *vlcOrange = [UIColor VLCOrangeTintColor];
// Change the keyboard for UISearchBar
[[UITextField appearance] setKeyboardAppearance:UIKeyboardAppearanceDark];
// For the cursor
[[UITextField appearance] setTintColor:vlcOrange];
// Don't override the 'Cancel' button color in the search bar with the previous UITextField call. Use the default blue color
[[UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[UISearchBar class]]] setTitleTextAttributes:@{[UIColor whiteColor] : NSForegroundColorAttributeName} forState:UIControlStateNormal];
[[UINavigationBar appearance] setBarTintColor:vlcOrange];
[[UINavigationBar appearanceWhenContainedInInstancesOfClasses:@[[VLCPlaybackNavigationController class]]] setBarTintColor: nil];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
[[UINavigationBar appearance] setTitleTextAttributes: @{ NSForegroundColorAttributeName : [UIColor whiteColor] }];
if (@available(iOS 11.0, *)) {
[[UINavigationBar appearance] setPrefersLargeTitles:@YES];
[[UINavigationBar appearanceWhenContainedInInstancesOfClasses:@[[VLCPlaybackNavigationController class]]] setPrefersLargeTitles: @NO];
}
// For the edit selection indicators
[[UITableView appearance] setTintColor:vlcOrange];
[[UISegmentedControl appearance] setTintColor:vlcOrange];
[[UISwitch appearance] setOnTintColor:vlcOrange];
[[UISearchBar appearance] setBarTintColor:[UIColor whiteColor]];
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
......
......@@ -21,7 +21,6 @@
{
VLCProgressView *_progressView;
UIRefreshControl *_refreshControl;
UIBarButtonItem *_progressBarButtonItem;
UIBarButtonItem *_logoutButton;
}
......@@ -86,6 +85,7 @@
self.view.backgroundColor = PresentationTheme.current.colors.background;
_refreshControl.backgroundColor = PresentationTheme.current.colors.background;
_activityIndicator.activityIndicatorViewStyle = PresentationTheme.current == PresentationTheme.whiteTheme ? UIActivityIndicatorViewStyleGray : UIActivityIndicatorViewStyleWhiteLarge;
self.loginToCloudStorageView.backgroundColor = PresentationTheme.current.colors.background;
}
- (void)viewWillAppear:(BOOL)animated
......
......@@ -12,7 +12,7 @@
import Foundation
class VLCTabbarCooordinator: NSObject, VLCMediaViewControllerDelegate {
class VLCTabbarCooordinator: NSObject, VLCMediaViewControllerDelegate, UITabBarControllerDelegate {
private var childCoordinators: [NSObject] = []
private var tabBarController:UITabBarController
......@@ -22,21 +22,31 @@ class VLCTabbarCooordinator: NSObject, VLCMediaViewControllerDelegate {
self.tabBarController = tabBarController
self.services = services
super.init()
self.tabBarController.delegate = self
NotificationCenter.default.addObserver(self, selector: #selector(updateTheme), name: VLCThemeDidChangeNotification, object: nil)
}
@objc public func start() {
setupViewControllers()
setupAppearance()
updateTheme()
}
@objc func updateTheme() {
tabBarController.tabBar.barTintColor = PresentationTheme.current.colors.tabBarColor
customizeMoreViewController()
}
func setupAppearance() {
tabBarController.tabBar.tintColor = PresentationTheme.current.colors.orangeUI
tabBarController.tabBar.barTintColor = PresentationTheme.current.colors.tabBarColor
func customizeMoreViewController() {
if let UITabBarCustomizeViewClass = NSClassFromString("UITabBarCustomizeView") {
for subview in tabBarController.view.subviews where subview.isKind(of: UITabBarCustomizeViewClass) {
subview.backgroundColor = PresentationTheme.current.colors.background
subview.tintColor = PresentationTheme.current.colors.orangeUI
}
}
}
func tabBarController(_ tabBarController: UITabBarController, willBeginCustomizing viewControllers: [UIViewController]) {
customizeMoreViewController()
}
func setupViewControllers() {
......
......@@ -11,6 +11,7 @@
#import "VLCConstants.h"
#import "VLCPlayerDisplayController.h"
#import "VLCPlaybackController+MediaLibrary.h"
#import "VLCPlaybackNavigationController.h"
#import "VLCLibrarySearchDisplayDataSource.h"
#import "VLCServerListViewController.h"
#import "VLCSettingsController.h"
......
......@@ -22,6 +22,7 @@
41273A3D1A955C4100A2EF77 /* VLCMigrationViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 41273A3B1A955C4100A2EF77 /* VLCMigrationViewController.xib */; };
413EC987201A329D00BF412F /* SortOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 413EC986201A329D00BF412F /* SortOption.swift */; };
413EC98B201B4F2C00BF412F /* PresentationTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 413EC98A201B4F2B00BF412F /* PresentationTheme.swift */; };
414396C22023316C005E3FAF /* AppearanceManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 414396C12023316C005E3FAF /* AppearanceManager.swift */; };
4144C4661A0ED6C700918C89 /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D3784E6183A99E1009EE944 /* Reachability.m */; };
4152F1621FEF19BD00F1908B /* KeychainCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4152F1611FEF19BD00F1908B /* KeychainCoordinator.swift */; };
4152F1631FEF19BD00F1908B /* KeychainCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4152F1611FEF19BD00F1908B /* KeychainCoordinator.swift */; };
......@@ -747,6 +748,7 @@
41273A3B1A955C4100A2EF77 /* VLCMigrationViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = VLCMigrationViewController.xib; path = Sources/VLCMigrationViewController.xib; sourceTree = SOURCE_ROOT; };
413EC986201A329D00BF412F /* SortOption.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SortOption.swift; path = SharedSources/Coordinators/SortOption.swift; sourceTree = SOURCE_ROOT; };
413EC98A201B4F2B00BF412F /* PresentationTheme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PresentationTheme.swift; sourceTree = "<group>"; };
414396C12023316C005E3FAF /* AppearanceManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AppearanceManager.swift; path = Sources/AppearanceManager.swift; sourceTree = SOURCE_ROOT; };
4152F1611FEF19BD00F1908B /* KeychainCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = KeychainCoordinator.swift; path = Sources/KeychainCoordinator.swift; sourceTree = "<group>"; };
4171D34E18A2C19000A16EF9 /* VLCFolderCollectionViewFlowLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCFolderCollectionViewFlowLayout.h; path = Sources/VLCFolderCollectionViewFlowLayout.h; sourceTree = SOURCE_ROOT; };
4171D34F18A2C19000A16EF9 /* VLCFolderCollectionViewFlowLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCFolderCollectionViewFlowLayout.m; path = Sources/VLCFolderCollectionViewFlowLayout.m; sourceTree = SOURCE_ROOT; };
......@@ -1606,6 +1608,7 @@
41251ECE1FD0CF7900099110 /* AppCoordinator.swift */,
418B144C20179C74000447AA /* VLCTabBarCoordinator.swift */,
413EC986201A329D00BF412F /* SortOption.swift */,
414396C12023316C005E3FAF /* AppearanceManager.swift */,
);
path = Coordinators;
sourceTree = "<group>";
......@@ -3882,6 +3885,7 @@
DD3EFF591BDEBCE500B68579 /* VLCLocalNetworkServiceUPnP.m in Sources */,
7D30F3D7183AB2F100FFC021 /* VLCNetworkListCell.m in Sources */,
7D1052EE1A4DCD1E00295F08 /* VLCOneDriveController.m in Sources */,
414396C22023316C005E3FAF /* AppearanceManager.swift in Sources */,
7DAE0C371B2EF85B00C53996 /* VLCSidebarController.m in Sources */,
7D30F3DC183AB2F900FFC021 /* VLCNetworkLoginViewController.m in Sources */,
419A2C661F37A4B70069D224 /* VLCStringsForLocalization.m in Sources */,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment