Browse Source

dark mode

marinofaggiana 5 years ago
parent
commit
bfba2736da

+ 20 - 20
iOSClient/Main/Create cloud/NCCreateFormUploadFileText.swift

@@ -45,11 +45,29 @@ class NCCreateFormUploadFileText: XLFormViewController, NCSelectDelegate {
         self.fileName = fileName
         self.serverUrl = serverUrl
         self.text = text
+    }
+    
+    // MARK: - View Life Cycle
+    
+    override func viewDidLoad() {
+        
+        super.viewDidLoad()
         
-        initializeForm()
+        let saveButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(save))
+        self.navigationItem.rightBarButtonItem = saveButton
+        self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
+        
+        // Theming view
+        NotificationCenter.default.addObserver(self, selector: #selector(self.changeTheming), name: NSNotification.Name(rawValue: "changeTheming"), object: nil)
+        changeTheming()
+    }
+    
+    @objc func changeTheming() {
+           appDelegate.changeTheming(self, tableView: tableView, collectionView: nil, form: true)
+           initializeForm()
     }
     
-    //MARK: XLFormDescriptorDelegate
+    //MARK: XLForm
     
     func initializeForm() {
         
@@ -128,24 +146,6 @@ class NCCreateFormUploadFileText: XLFormViewController, NCSelectDelegate {
         }
     }
     
-    // MARK: - View Life Cycle
-    
-    override func viewDidLoad() {
-        
-        super.viewDidLoad()
-        
-        let saveButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(save))
-        self.navigationItem.rightBarButtonItem = saveButton
-        
-        self.navigationController?.navigationBar.isTranslucent = false
-        self.navigationController?.navigationBar.barTintColor = NCBrandColor.sharedInstance.brand
-        self.navigationController?.navigationBar.tintColor = NCBrandColor.sharedInstance.brandText
-        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: NCBrandColor.sharedInstance.brandText]
-        
-        self.tableView.backgroundColor = NCBrandColor.sharedInstance.backgroundForm
-        self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
-    }
-    
     // MARK: - Action
     
     func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String) {

+ 6 - 6
iOSClient/Main/Create cloud/NCCreateFormUploadRichdocuments.swift

@@ -79,6 +79,11 @@ class NCCreateFormUploadRichdocuments: XLFormViewController, NCSelectDelegate, U
         getTemplate()
     }
     
+    @objc func changeTheming() {
+        appDelegate.changeTheming(self, tableView: tableView, collectionView: collectionView, form: false)
+        initializeForm()
+    }
+    
     // MARK: - Tableview (XLForm)
 
     func initializeForm() {
@@ -129,15 +134,10 @@ class NCCreateFormUploadRichdocuments: XLFormViewController, NCSelectDelegate, U
         self.form = form
     }
 
-    @objc func changeTheming() {
-        appDelegate.changeTheming(self, tableView: tableView, collectionView: collectionView, form: false)
-        initializeForm()
-    }
-    
     override func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
         let header: UITableViewHeaderFooterView = view as! UITableViewHeaderFooterView
         header.textLabel?.font = UIFont.systemFont(ofSize: 13.0)
-        header.textLabel?.textColor = NCBrandColor.sharedInstance.textView
+        header.textLabel?.textColor = .gray
         header.tintColor = NCBrandColor.sharedInstance.backgroundForm
     }
 

+ 33 - 32
iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift

@@ -63,11 +63,43 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate {
         
         self.serverUrl = serverUrl
         self.arrayImages = arrayImages
+    }
+    
+    // MARK: - View Life Cycle
+    
+    override func viewDidLoad() {
+        
+        super.viewDidLoad()
         
+        let saveButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(save))
+        self.navigationItem.rightBarButtonItem = saveButton
+        
+        self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
+
+        //        self.tableView.sectionHeaderHeight = 10
+        //        self.tableView.sectionFooterHeight = 10
+        //        self.tableView.backgroundColor = NCBrandColor.sharedInstance.backgroundView
+        
+        
+        //        let row : XLFormRowDescriptor  = self.form.formRow(withTag: "fileName")!
+        //        let rowCell = row.cell(forForm: self)
+        //        rowCell.becomeFirstResponder()
+        
+        #if GOOGLEMOBILEVISION
+        textDetector = GMVDetector(ofType: GMVDetectorTypeText, options: nil)
+        #endif
+        
+        // Theming view
+        NotificationCenter.default.addObserver(self, selector: #selector(self.changeTheming), name: NSNotification.Name(rawValue: "changeTheming"), object: nil)
+        changeTheming()
+    }
+    
+    @objc func changeTheming() {
+        appDelegate.changeTheming(self, tableView: tableView, collectionView: nil, form: true)
         initializeForm()
     }
     
-    //MARK: XLFormDescriptorDelegate
+    //MARK: XLForm
     
     func initializeForm() {
         
@@ -334,37 +366,6 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate {
         return newFileName
     }
     
-    // MARK: - View Life Cycle
-    
-    override func viewDidLoad() {
-        
-        super.viewDidLoad()
-        
-        let saveButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(save))
-        self.navigationItem.rightBarButtonItem = saveButton
-        
-        self.navigationController?.navigationBar.isTranslucent = false
-        self.navigationController?.navigationBar.barTintColor = NCBrandColor.sharedInstance.brand
-        self.navigationController?.navigationBar.tintColor = NCBrandColor.sharedInstance.brandText
-        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: NCBrandColor.sharedInstance.brandText]
-        
-        self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
-        self.tableView.backgroundColor = NCBrandColor.sharedInstance.backgroundForm
-
-        //        self.tableView.sectionHeaderHeight = 10
-        //        self.tableView.sectionFooterHeight = 10
-        //        self.tableView.backgroundColor = NCBrandColor.sharedInstance.backgroundView
-        
-        
-        //        let row : XLFormRowDescriptor  = self.form.formRow(withTag: "fileName")!
-        //        let rowCell = row.cell(forForm: self)
-        //        rowCell.becomeFirstResponder()
-        
-        #if GOOGLEMOBILEVISION
-        textDetector = GMVDetector(ofType: GMVDetectorTypeText, options: nil)
-        #endif
-    }
-    
     // MARK: - Action
     
     func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String) {

+ 22 - 22
iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.swift

@@ -65,27 +65,16 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud
         }
     }
     
+    // MARK: - View Life Cycle
+
     override func viewDidLoad() {
         super.viewDidLoad()
         
-        let cancelButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(cancel))
-        let saveButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(save))
-        
-        self.navigationItem.leftBarButtonItem = cancelButton
-        self.navigationItem.rightBarButtonItem = saveButton
-        
-        self.navigationController?.navigationBar.isTranslucent = false
-        self.navigationController?.navigationBar.barTintColor = NCBrandColor.sharedInstance.brand
-        self.navigationController?.navigationBar.tintColor = NCBrandColor.sharedInstance.brandText
-        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: NCBrandColor.sharedInstance.brandText]
+        self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(cancel))
+        self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(save))
         
         self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
-        self.tableView.backgroundColor = NCBrandColor.sharedInstance.backgroundForm
         
-        self.view.backgroundColor = NCBrandColor.sharedInstance.backgroundForm
-        labelTimer.textColor = NCBrandColor.sharedInstance.textView
-        labelDuration.textColor = NCBrandColor.sharedInstance.textView
-
         // title
         self.title = NSLocalizedString("_voice_memo_title_", comment: "")
         
@@ -93,12 +82,13 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud
         buttonPlayStop.setImage(CCGraphics.changeThemingColorImage(UIImage(named: "audioPlay")!, width: 200, height: 200, color: NCBrandColor.sharedInstance.icon), for: .normal)
         
         // Progress view
+        progressView.progress = 0
         progressView.progressTintColor = .green
         progressView.trackTintColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0)
-        progressView.progress = 0
         
-        // form
-        initializeForm()
+        // Theming view
+        NotificationCenter.default.addObserver(self, selector: #selector(self.changeTheming), name: NSNotification.Name(rawValue: "changeTheming"), object: nil)
+        changeTheming()
     }
     
     override func viewWillAppear(_ animated: Bool) {
@@ -107,6 +97,17 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud
         updateTimerUI()
     }
     
+    @objc func changeTheming() {
+        appDelegate.changeTheming(self, tableView: tableView, collectionView: nil, form: true)
+        
+        labelTimer.textColor = NCBrandColor.sharedInstance.textView
+        labelDuration.textColor = NCBrandColor.sharedInstance.textView
+        
+        initializeForm()
+    }
+    
+    //MARK: XLForm
+
     func initializeForm() {
         
         let form : XLFormDescriptor = XLFormDescriptor() as XLFormDescriptor
@@ -152,9 +153,7 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud
 
         self.form = form
     }
-    
-    //MARK: XLFormDescriptorDelegate
-    
+        
     override func formRowDescriptorValueHasChanged(_ formRow: XLFormRowDescriptor!, oldValue: Any!, newValue: Any!) {
         
         super.formRowDescriptorValueHasChanged(formRow, oldValue: oldValue, newValue: newValue)
@@ -189,7 +188,8 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud
     override func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
         let header: UITableViewHeaderFooterView = view as! UITableViewHeaderFooterView
         header.textLabel?.font = UIFont.systemFont(ofSize: 13.0)
-        header.textLabel?.textColor = .lightGray
+        header.textLabel?.textColor = .gray
+        header.tintColor = NCBrandColor.sharedInstance.backgroundForm
     }
     
     // MARK: - Action