Commit 76b54ae7 by Daniel Dahan

removed unnecessary Theme settings

parent 12cb5f8f
...@@ -24,8 +24,6 @@ public struct MaterialTheme { ...@@ -24,8 +24,6 @@ public struct MaterialTheme {
public struct basicCardView {} public struct basicCardView {}
public struct imageCardView {} public struct imageCardView {}
public struct navigationBarView {} public struct navigationBarView {}
public struct searchBarView {}
public struct pulseCollectionView {}
public struct textLayer {} public struct textLayer {}
public struct label {} public struct label {}
public struct flatButton {} public struct flatButton {}
...@@ -206,72 +204,6 @@ public extension MaterialTheme.navigationBarView { ...@@ -206,72 +204,6 @@ public extension MaterialTheme.navigationBarView {
public static var zPosition: CGFloat = 100 public static var zPosition: CGFloat = 100
} }
// searchBarView
public extension MaterialTheme.searchBarView {
// frame
public static var x: CGFloat = 0
public static var y: CGFloat = 0
public static var width: CGFloat = UIScreen.mainScreen().bounds.width
public static var height: CGFloat = 70
// shadow
public static var shadowDepth: MaterialDepth = .Depth2
public static var shadowColor: UIColor = MaterialColor.black
// shape
public static var contentInsetsRef: MaterialInsetsType = MaterialInsetsToValue(.Square2)
public static var textFieldInsetsRef: MaterialInsetsType = (top: 20, left: 0, bottom: 0, right: 0)
public static var leftButtonsInsetsRef: MaterialInsetsType = (top: 8, left: 0, bottom: 0, right: 0)
public static var rightButtonsInsetsRef: MaterialInsetsType = (top: 8, left: 0, bottom: 0, right: 0)
// border
public static var borderWidth: MaterialBorder = .None
public static var bordercolor: UIColor = MaterialColor.black
// color
public static var backgroundColor: UIColor = MaterialColor.white
// interaction
public static var userInteractionEnabled: Bool = true
// image
public static var contentsRect: CGRect = CGRectMake(0, 0, 1, 1)
public static var contentsCenter: CGRect = CGRectMake(0, 0, 1, 1)
public static var contentsScale: CGFloat = UIScreen.mainScreen().scale
public static var contentsGravity: MaterialGravity = .ResizeAspectFill
// position
public static var zPosition: CGFloat = 100
}
// pulseCollectionView
public extension MaterialTheme.pulseCollectionView {
// shadow
public static var shadowDepth: MaterialDepth = .None
public static var shadowColor: UIColor = MaterialColor.black
// border
public static var borderWidth: MaterialBorder = .None
public static var bordercolor: UIColor = MaterialColor.black
// color
public static var backgroundColor: UIColor = MaterialColor.white
public static var pulseColor: UIColor = MaterialColor.blueGrey.lighten4
public static var pulseColorOpacity: CGFloat = 0.25
// interaction
public static var userInteractionEnabled: Bool = true
// image
public static var contentsRect: CGRect = CGRectMake(0, 0, 1, 1)
public static var contentsCenter: CGRect = CGRectMake(0, 0, 1, 1)
public static var contentsScale: CGFloat = UIScreen.mainScreen().scale
public static var contentsGravity: MaterialGravity = .ResizeAspectFill
// position
public static var zPosition: CGFloat = 0
}
// textLayer // textLayer
public extension MaterialTheme.textLayer { public extension MaterialTheme.textLayer {
// scale // scale
......
...@@ -42,11 +42,6 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -42,11 +42,6 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
private lazy var originalPosition: CGPoint = CGPointZero private lazy var originalPosition: CGPoint = CGPointZero
// //
// :name: sideView
//
private lazy var sideView: MaterialView = MaterialView()
//
// :name: sidePanGesture // :name: sidePanGesture
// //
internal var sidePanGesture: UIPanGestureRecognizer? internal var sidePanGesture: UIPanGestureRecognizer?
...@@ -96,11 +91,38 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -96,11 +91,38 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
public lazy var hideStatusBar: Bool = true public lazy var hideStatusBar: Bool = true
/** /**
:name: enableShadowDepth
*/
public var enableShadowDepth: Bool = true {
didSet {
if !enableShadowDepth {
sideView.shadowDepth = .None
}
}
}
/**
:name: shadowDepth
*/
public var shadowDepth: MaterialDepth = .Depth2 {
didSet {
if !enableShadowDepth && .None != sideView.shadowDepth {
sideView.shadowDepth = shadowDepth
}
}
}
/**
:name: backdropLayer :name: backdropLayer
*/ */
public private(set) lazy var backdropLayer: CAShapeLayer = CAShapeLayer() public private(set) lazy var backdropLayer: CAShapeLayer = CAShapeLayer()
/** /**
:name: sideView
*/
public private(set) lazy var sideView: MaterialView = MaterialView()
/**
:name: backdropOpacity :name: backdropOpacity
*/ */
public var backdropOpacity: CGFloat = 0.5 { public var backdropOpacity: CGFloat = 0.5 {
...@@ -207,6 +229,9 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -207,6 +229,9 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
self.sideView.position = CGPointMake(self.sideView.width / 2, self.sideView.height / 2) self.sideView.position = CGPointMake(self.sideView.width / 2, self.sideView.height / 2)
}) { }) {
self.userInteractionEnabled = false self.userInteractionEnabled = false
if self.enableShadowDepth {
self.sideView.shadowDepth = self.shadowDepth
}
} }
} }
...@@ -221,6 +246,9 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -221,6 +246,9 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
self.sideView.position = CGPointMake(-self.sideView.width / 2, self.sideView.height / 2) self.sideView.position = CGPointMake(-self.sideView.width / 2, self.sideView.height / 2)
}) { }) {
self.userInteractionEnabled = true self.userInteractionEnabled = true
if self.enableShadowDepth {
self.sideView.shadowDepth = .None
}
} }
} }
...@@ -297,6 +325,9 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -297,6 +325,9 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
internal func handlePanGesture(recognizer: UIPanGestureRecognizer) { internal func handlePanGesture(recognizer: UIPanGestureRecognizer) {
switch recognizer.state { switch recognizer.state {
case .Began: case .Began:
if enableShadowDepth {
sideView.shadowDepth = shadowDepth
}
backdropLayer.hidden = false backdropLayer.hidden = false
originalPosition = sideView.position originalPosition = sideView.position
toggleStatusBar(true) toggleStatusBar(true)
......
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