From 82cd9f8efd8cc8fd8e5bafbdaf39c94efda6a030 Mon Sep 17 00:00:00 2001 From: jan Iversen Date: Sun, 29 Oct 2017 10:45:46 +0100 Subject: iOS, document handle sidebar Change-Id: I4df15312f1174009d7d34b02241c129abc27c0b7 --- .../LibreOfficeLight/DocumentController.swift | 56 +++++++++++++++------- .../LibreOfficeLight/en.lproj/Main.storyboard | 4 +- 2 files changed, 41 insertions(+), 19 deletions(-) diff --git a/ios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift b/ios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift index 0190ad946666..39a49d2a01eb 100755 --- a/ios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift +++ b/ios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift @@ -15,14 +15,24 @@ import UIKit // It is a delegate class to recieve Menu events as well as file handling events class DocumentController: UIViewController, MenuDelegate, UIDocumentBrowserViewControllerDelegate { - // Show sidemenu (part of documentcontroller) + // handling of PropertiesController + // The PropertiesController is a left sidebar, that will scroll in when activated + // The Controller handles manipulation of properties in the document + + // Activate/Deactivate PropertiesController (from navigationController, see storyboard) @IBAction func doProperties(_ sender: UIBarButtonItem) { + // Check if deactivation if (sender.tag == 99) { + // Deactivate + + // Mark it as deactivated (it stays loaded) sender.tag = 0; + // get handle of PropertiesController let viewMenuBack : UIView = view.subviews.last! + // Blend out sidebar UIView.animate(withDuration: 0.3, animations: { () -> Void in var frameMenu : CGRect = viewMenuBack.frame frameMenu.origin.x = -1 * UIScreen.main.bounds.size.width @@ -32,27 +42,39 @@ class DocumentController: UIViewController, MenuDelegate, UIDocumentBrowserViewC }, completion: { (finished) -> Void in viewMenuBack.removeFromSuperview() }) - return } - - sender.isEnabled = false - sender.tag = 99 - - let properties : PropertiesController = self.storyboard!.instantiateViewController(withIdentifier: "PropertiesController") as! PropertiesController - view.addSubview(properties.view) - addChildViewController(properties) - properties.view.layoutIfNeeded() - - properties.view.frame=CGRect(x: 0 - UIScreen.main.bounds.size.width, y: 0, width: UIScreen.main.bounds.size.width, height: UIScreen.main.bounds.size.height); - - UIView.animate(withDuration: 0.3, animations: { () -> Void in - properties.view.frame=CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height: UIScreen.main.bounds.size.height); - sender.isEnabled = true - }, completion:nil) + else { + // Activate + + // Mark as activated + sender.isEnabled = false + sender.tag = 99 + + // make instance of PropertiesController + let prop : PropertiesController = self.storyboard!.instantiateViewController( + withIdentifier: "PropertiesController") as! PropertiesController + view.addSubview(prop.view) + addChildViewController(prop) + prop.view.layoutIfNeeded() + prop.view.frame=CGRect(x: 0 - UIScreen.main.bounds.size.width, + y: 0, + width: UIScreen.main.bounds.size.width, + height: UIScreen.main.bounds.size.height); + + // Blend in sidebar + UIView.animate(withDuration: 0.3, animations: { () -> Void in + prop.view.frame=CGRect(x: 0, + y: 0, + width: UIScreen.main.bounds.size.width, + height: UIScreen.main.bounds.size.height); + sender.isEnabled = true + }, completion:nil) + } } + // Handling of Background (hipernate) public func Hipernate() -> Void { } diff --git a/ios/LibreOfficeLight/LibreOfficeLight/en.lproj/Main.storyboard b/ios/LibreOfficeLight/LibreOfficeLight/en.lproj/Main.storyboard index 81a2b4b5376c..925ce28c9b27 100755 --- a/ios/LibreOfficeLight/LibreOfficeLight/en.lproj/Main.storyboard +++ b/ios/LibreOfficeLight/LibreOfficeLight/en.lproj/Main.storyboard @@ -117,10 +117,10 @@ - + - + -- cgit