Commit c65fd68e by Daniel Dahan

prepare for release

parent f4c2a71a
...@@ -40,8 +40,14 @@ class AppMenuController: MenuController { ...@@ -40,8 +40,14 @@ class AppMenuController: MenuController {
/// MenuView diameter. /// MenuView diameter.
private let baseSize: CGSize = CGSizeMake(56, 56) private let baseSize: CGSize = CGSizeMake(56, 56)
/// MenuView inset. /// MenuView bottom inset.
private let menuViewInset: CGFloat = 16 private let menuViewBottomInset: CGFloat = 65
/// MenuView right inset.
private let menuViewRightInset: CGFloat = 16
/// Reference if the menuView is hidden.
public private(set) var isMenuViewHidden: Bool = false
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
...@@ -90,19 +96,25 @@ class AppMenuController: MenuController { ...@@ -90,19 +96,25 @@ class AppMenuController: MenuController {
} }
/// Shows the menuView. /// Shows the menuView.
func showMenu() { func showMenuView() {
menuView.animate(MaterialAnimation.animationGroup([ if isMenuViewHidden {
MaterialAnimation.rotate(rotation: 3), isMenuViewHidden = false
MaterialAnimation.translateY(0) menuView.animate(MaterialAnimation.animationGroup([
])) MaterialAnimation.rotate(rotation: 3),
MaterialAnimation.translateY(0)
]))
}
} }
/// Hides the menuView. /// Hides the menuView.
func hideMenu() { func hideMenuView() {
menuView.animate(MaterialAnimation.animationGroup([ if !isMenuViewHidden {
MaterialAnimation.rotate(rotation: 3), isMenuViewHidden = true
MaterialAnimation.translateY(150) menuView.animate(MaterialAnimation.animationGroup([
])) MaterialAnimation.rotate(rotation: 3),
MaterialAnimation.translateY(150)
]))
}
} }
/// Prepares the menuView. /// Prepares the menuView.
...@@ -147,7 +159,11 @@ class AppMenuController: MenuController { ...@@ -147,7 +159,11 @@ class AppMenuController: MenuController {
menuView.menu.views = [menuButton, blueButton, greenButton, yellowButton] menuView.menu.views = [menuButton, blueButton, greenButton, yellowButton]
menuView.delegate = self menuView.delegate = self
view.layout(menuView).width(baseSize.width).height(baseSize.height).bottom(menuViewInset).right(menuViewInset) view.layout(menuView)
.width(baseSize.width)
.height(baseSize.height)
.bottom(menuViewBottomInset)
.right(menuViewRightInset)
} }
} }
......
...@@ -75,6 +75,7 @@ class ItemViewController: UIViewController { ...@@ -75,6 +75,7 @@ class ItemViewController: UIViewController {
override func viewWillAppear(animated: Bool) { override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated) super.viewWillAppear(animated)
navigationDrawerController?.enabled = false navigationDrawerController?.enabled = false
(menuController as? AppMenuController)?.hideMenuView()
} }
override func viewWillLayoutSubviews() { override func viewWillLayoutSubviews() {
......
...@@ -62,9 +62,13 @@ class RecipesViewController: UIViewController { ...@@ -62,9 +62,13 @@ class RecipesViewController: UIViewController {
super.viewWillAppear(animated) super.viewWillAppear(animated)
// Stops the tableView contentInsets from being automatically adjusted. // Stops the tableView contentInsets from being automatically adjusted.
edgesForExtendedLayout = .None edgesForExtendedLayout = .None
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
// Enable the SideNavigation. // Enable the SideNavigation.
navigationDrawerController?.enabled = true navigationDrawerController?.enabled = true
(menuController as? AppMenuController)?.showMenuView()
} }
/// Prepares the items Array. /// Prepares the items Array.
......
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Material' s.name = 'Material'
s.version = '1.41.8' s.version = '1.42.0'
s.license = 'BSD-3-Clause' s.license = 'BSD-3-Clause'
s.summary = 'An animation and graphics framework for Material Design in Swift.' s.summary = 'An animation and graphics framework for Material Design in Swift.'
s.homepage = 'http://cosmicmind.io' s.homepage = 'http://cosmicmind.io'
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.41.8</string> <string>1.42.0</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
......
...@@ -331,6 +331,15 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD ...@@ -331,6 +331,15 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD
return rightView!.x != MaterialDevice.width return rightView!.x != MaterialDevice.width
} }
/**
Content view controller to encompase the entire component. This is
primarily used when the StatusBar is being hidden. The alpha value of
the rootViewController decreases, and shows the StatusBar. To avoid
this, and to add a hidden transition viewController for complex
situations, the contentViewController was added.
*/
public private(set) var contentViewController: UIViewController!
/** /**
A UIViewController property that references the active A UIViewController property that references the active
main UIViewController. To swap the rootViewController, it main UIViewController. To swap the rootViewController, it
...@@ -382,17 +391,6 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD ...@@ -382,17 +391,6 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD
layoutSubviews() layoutSubviews()
} }
public override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)
closeLeftView()
closeRightView()
// Ensures the view is hidden.
if let v: MaterialView = rightView {
v.position.x = size.width + v.width / 2
}
}
/** /**
A method to swap rootViewController objects. A method to swap rootViewController objects.
- Parameter toViewController: The UIViewController to swap - Parameter toViewController: The UIViewController to swap
...@@ -872,20 +870,24 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD ...@@ -872,20 +870,24 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD
public func prepareView() { public func prepareView() {
view.clipsToBounds = true view.clipsToBounds = true
view.contentScaleFactor = MaterialDevice.scale view.contentScaleFactor = MaterialDevice.scale
prepareContentViewController()
prepareRootViewController() prepareRootViewController()
prepareLeftView() prepareLeftView()
prepareRightView() prepareRightView()
} }
/// Prepares the contentViewController.
private func prepareContentViewController() {
contentViewController = UIViewController()
contentViewController.view.frame = view.bounds
contentViewController.view.backgroundColor = MaterialColor.black
prepareViewControllerWithinContainer(contentViewController, container: view)
}
/// A method that prepares the rootViewController. /// A method that prepares the rootViewController.
private func prepareRootViewController() { private func prepareRootViewController() {
let vc: UIViewController = UIViewController() rootViewController.view.frame = contentViewController.view.bounds
vc.view.frame = view.bounds prepareViewControllerWithinContainer(rootViewController, container: contentViewController.view)
vc.view.backgroundColor = MaterialColor.black
prepareViewControllerWithinContainer(vc, container: view)
rootViewController.view.frame = view.bounds
prepareViewControllerWithinContainer(rootViewController, container: vc.view)
} }
/// A method that prepares the leftViewController. /// A method that prepares the leftViewController.
...@@ -958,6 +960,7 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD ...@@ -958,6 +960,7 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD
v.didMoveToParentViewController(self) v.didMoveToParentViewController(self)
v.view.clipsToBounds = true v.view.clipsToBounds = true
v.view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] v.view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
v.view.contentScaleFactor = MaterialDevice.scale
container.addSubview(v.view) container.addSubview(v.view)
container.sendSubviewToBack(v.view) container.sendSubviewToBack(v.view)
} }
...@@ -1159,6 +1162,12 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD ...@@ -1159,6 +1162,12 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD
/// Layout subviews. /// Layout subviews.
private func layoutSubviews() { private func layoutSubviews() {
if opened {
hideStatusBar()
} else {
showStatusBar()
}
if let v: MaterialView = leftView { if let v: MaterialView = leftView {
v.width = leftViewWidth v.width = leftViewWidth
v.height = view.bounds.height v.height = view.bounds.height
......
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