Commit 973a8015 by Daniel Dahan

updated base theme

parent 56d71fc4
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
65B965871B8BEEC60055B139 /* SideNavigationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65B965861B8BEEC60055B139 /* SideNavigationViewController.swift */; }; 65B965871B8BEEC60055B139 /* SideNavigationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65B965861B8BEEC60055B139 /* SideNavigationViewController.swift */; };
65BDD1451BB5B8B8006F7F2B /* MaterialTheme+View.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1441BB5B8B8006F7F2B /* MaterialTheme+View.swift */; settings = {ASSET_TAGS = (); }; }; 65BDD1451BB5B8B8006F7F2B /* MaterialTheme+View.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1441BB5B8B8006F7F2B /* MaterialTheme+View.swift */; settings = {ASSET_TAGS = (); }; };
65BDD1471BB5B916006F7F2B /* MaterialView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1461BB5B916006F7F2B /* MaterialView.swift */; settings = {ASSET_TAGS = (); }; }; 65BDD1471BB5B916006F7F2B /* MaterialView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1461BB5B916006F7F2B /* MaterialView.swift */; settings = {ASSET_TAGS = (); }; };
65BDD1491BB5DC98006F7F2B /* MaterialTheme+Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1481BB5DC98006F7F2B /* MaterialTheme+Color.swift */; settings = {ASSET_TAGS = (); }; };
65BDD14B1BB5DD02006F7F2B /* MaterialTheme+Font.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD14A1BB5DD02006F7F2B /* MaterialTheme+Font.swift */; settings = {ASSET_TAGS = (); }; };
65DBE4201B9A9244000C804F /* Roboto-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 65DBE41E1B9A9244000C804F /* Roboto-Bold.ttf */; }; 65DBE4201B9A9244000C804F /* Roboto-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 65DBE41E1B9A9244000C804F /* Roboto-Bold.ttf */; };
65DBE4211B9A9244000C804F /* Roboto-Thin.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 65DBE41F1B9A9244000C804F /* Roboto-Thin.ttf */; }; 65DBE4211B9A9244000C804F /* Roboto-Thin.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 65DBE41F1B9A9244000C804F /* Roboto-Thin.ttf */; };
962F3E531BACA68C0004B8AD /* NavigationBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 962F3E521BACA68C0004B8AD /* NavigationBarView.swift */; }; 962F3E531BACA68C0004B8AD /* NavigationBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 962F3E521BACA68C0004B8AD /* NavigationBarView.swift */; };
...@@ -68,6 +70,8 @@ ...@@ -68,6 +70,8 @@
65B965861B8BEEC60055B139 /* SideNavigationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SideNavigationViewController.swift; sourceTree = "<group>"; }; 65B965861B8BEEC60055B139 /* SideNavigationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SideNavigationViewController.swift; sourceTree = "<group>"; };
65BDD1441BB5B8B8006F7F2B /* MaterialTheme+View.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "MaterialTheme+View.swift"; sourceTree = "<group>"; }; 65BDD1441BB5B8B8006F7F2B /* MaterialTheme+View.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "MaterialTheme+View.swift"; sourceTree = "<group>"; };
65BDD1461BB5B916006F7F2B /* MaterialView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialView.swift; sourceTree = "<group>"; }; 65BDD1461BB5B916006F7F2B /* MaterialView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialView.swift; sourceTree = "<group>"; };
65BDD1481BB5DC98006F7F2B /* MaterialTheme+Color.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "MaterialTheme+Color.swift"; sourceTree = "<group>"; };
65BDD14A1BB5DD02006F7F2B /* MaterialTheme+Font.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "MaterialTheme+Font.swift"; sourceTree = "<group>"; };
65DBE41E1B9A9244000C804F /* Roboto-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Roboto-Bold.ttf"; sourceTree = "<group>"; }; 65DBE41E1B9A9244000C804F /* Roboto-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Roboto-Bold.ttf"; sourceTree = "<group>"; };
65DBE41F1B9A9244000C804F /* Roboto-Thin.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Roboto-Thin.ttf"; sourceTree = "<group>"; }; 65DBE41F1B9A9244000C804F /* Roboto-Thin.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Roboto-Thin.ttf"; sourceTree = "<group>"; };
962F3E521BACA68C0004B8AD /* NavigationBarView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationBarView.swift; sourceTree = "<group>"; }; 962F3E521BACA68C0004B8AD /* NavigationBarView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationBarView.swift; sourceTree = "<group>"; };
...@@ -228,6 +232,8 @@ ...@@ -228,6 +232,8 @@
children = ( children = (
96B57D4D1B90AF7D00DE7BBB /* MaterialTheme.swift */, 96B57D4D1B90AF7D00DE7BBB /* MaterialTheme.swift */,
65BDD1441BB5B8B8006F7F2B /* MaterialTheme+View.swift */, 65BDD1441BB5B8B8006F7F2B /* MaterialTheme+View.swift */,
65BDD1481BB5DC98006F7F2B /* MaterialTheme+Color.swift */,
65BDD14A1BB5DD02006F7F2B /* MaterialTheme+Font.swift */,
); );
name = Theme; name = Theme;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -394,10 +400,12 @@ ...@@ -394,10 +400,12 @@
9638326B1B88E5BF0015F710 /* FabButton.swift in Sources */, 9638326B1B88E5BF0015F710 /* FabButton.swift in Sources */,
9A94D1091B8A3F5100F586A5 /* MaterialCardView.swift in Sources */, 9A94D1091B8A3F5100F586A5 /* MaterialCardView.swift in Sources */,
65B965871B8BEEC60055B139 /* SideNavigationViewController.swift in Sources */, 65B965871B8BEEC60055B139 /* SideNavigationViewController.swift in Sources */,
65BDD14B1BB5DD02006F7F2B /* MaterialTheme+Font.swift in Sources */,
65BDD1451BB5B8B8006F7F2B /* MaterialTheme+View.swift in Sources */, 65BDD1451BB5B8B8006F7F2B /* MaterialTheme+View.swift in Sources */,
9638326C1B88E5BF0015F710 /* FlatButton.swift in Sources */, 9638326C1B88E5BF0015F710 /* FlatButton.swift in Sources */,
963832711B88E5BF0015F710 /* MaterialText.swift in Sources */, 963832711B88E5BF0015F710 /* MaterialText.swift in Sources */,
9638326A1B88E5BF0015F710 /* CapturePreview.swift in Sources */, 9638326A1B88E5BF0015F710 /* CapturePreview.swift in Sources */,
65BDD1491BB5DC98006F7F2B /* MaterialTheme+Color.swift in Sources */,
9AAC38541B89559900FE6B2D /* Roboto.swift in Sources */, 9AAC38541B89559900FE6B2D /* Roboto.swift in Sources */,
65B9657E1B8A7C330055B139 /* MaterialButton.swift in Sources */, 65B9657E1B8A7C330055B139 /* MaterialButton.swift in Sources */,
963832881B8908180015F710 /* Layout.swift in Sources */, 963832881B8908180015F710 /* Layout.swift in Sources */,
......
...@@ -226,18 +226,18 @@ public class BasicCardView : MaterialCardView, Comparable { ...@@ -226,18 +226,18 @@ public class BasicCardView : MaterialCardView, Comparable {
if nil == titleLabelContainer { if nil == titleLabelContainer {
titleLabelContainer = UIView() titleLabelContainer = UIView()
titleLabelContainer!.translatesAutoresizingMaskIntoConstraints = false titleLabelContainer!.translatesAutoresizingMaskIntoConstraints = false
titleLabelContainer!.backgroundColor = MaterialTheme.clear.color titleLabelContainer!.backgroundColor = MaterialTheme.color.clear.base
addSubview(titleLabelContainer!) addSubview(titleLabelContainer!)
} }
// text // text
titleLabelContainer!.addSubview(t) titleLabelContainer!.addSubview(t)
t.translatesAutoresizingMaskIntoConstraints = false t.translatesAutoresizingMaskIntoConstraints = false
t.backgroundColor = MaterialTheme.clear.color t.backgroundColor = MaterialTheme.color.clear.base
t.font = Roboto.regular t.font = Roboto.regular
t.numberOfLines = 0 t.numberOfLines = 0
t.lineBreakMode = .ByTruncatingTail t.lineBreakMode = .ByTruncatingTail
t.textColor = MaterialTheme.white.color t.textColor = MaterialTheme.color.white.base
} else { } else {
titleLabelContainer?.removeFromSuperview() titleLabelContainer?.removeFromSuperview()
titleLabelContainer = nil titleLabelContainer = nil
...@@ -270,15 +270,15 @@ public class BasicCardView : MaterialCardView, Comparable { ...@@ -270,15 +270,15 @@ public class BasicCardView : MaterialCardView, Comparable {
if nil == detailLabelContainer { if nil == detailLabelContainer {
detailLabelContainer = UIView() detailLabelContainer = UIView()
detailLabelContainer!.translatesAutoresizingMaskIntoConstraints = false detailLabelContainer!.translatesAutoresizingMaskIntoConstraints = false
detailLabelContainer!.backgroundColor = MaterialTheme.clear.color detailLabelContainer!.backgroundColor = MaterialTheme.color.clear.base
addSubview(detailLabelContainer!) addSubview(detailLabelContainer!)
} }
// text // text
detailLabelContainer!.addSubview(l) detailLabelContainer!.addSubview(l)
l.translatesAutoresizingMaskIntoConstraints = false l.translatesAutoresizingMaskIntoConstraints = false
l.textColor = MaterialTheme.white.color l.textColor = MaterialTheme.color.white.base
l.backgroundColor = MaterialTheme.clear.color l.backgroundColor = MaterialTheme.color.clear.base
l.font = Roboto.light l.font = Roboto.light
l.numberOfLines = 0 l.numberOfLines = 0
l.lineBreakMode = .ByTruncatingTail l.lineBreakMode = .ByTruncatingTail
...@@ -297,7 +297,7 @@ public class BasicCardView : MaterialCardView, Comparable { ...@@ -297,7 +297,7 @@ public class BasicCardView : MaterialCardView, Comparable {
didSet { didSet {
if let d = divider { if let d = divider {
d.translatesAutoresizingMaskIntoConstraints = false d.translatesAutoresizingMaskIntoConstraints = false
d.backgroundColor = MaterialTheme.blueGrey.darken1 d.backgroundColor = MaterialTheme.color.blueGrey.darken1
addSubview(d) addSubview(d)
} else { } else {
divider?.removeFromSuperview() divider?.removeFromSuperview()
...@@ -322,7 +322,7 @@ public class BasicCardView : MaterialCardView, Comparable { ...@@ -322,7 +322,7 @@ public class BasicCardView : MaterialCardView, Comparable {
} else if nil == buttonsContainer { } else if nil == buttonsContainer {
buttonsContainer = UIView() buttonsContainer = UIView()
buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false
buttonsContainer!.backgroundColor = MaterialTheme.clear.color buttonsContainer!.backgroundColor = MaterialTheme.color.clear.base
addSubview(buttonsContainer!) addSubview(buttonsContainer!)
} else { } else {
for v in buttonsContainer!.subviews { for v in buttonsContainer!.subviews {
...@@ -344,7 +344,7 @@ public class BasicCardView : MaterialCardView, Comparable { ...@@ -344,7 +344,7 @@ public class BasicCardView : MaterialCardView, Comparable {
} else if nil == buttonsContainer { } else if nil == buttonsContainer {
buttonsContainer = UIView() buttonsContainer = UIView()
buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false
buttonsContainer!.backgroundColor = MaterialTheme.clear.color buttonsContainer!.backgroundColor = MaterialTheme.color.clear.base
addSubview(buttonsContainer!) addSubview(buttonsContainer!)
} }
reloadView() reloadView()
...@@ -504,7 +504,7 @@ public class BasicCardView : MaterialCardView, Comparable { ...@@ -504,7 +504,7 @@ public class BasicCardView : MaterialCardView, Comparable {
internal override func prepareView() { internal override func prepareView() {
super.prepareView() super.prepareView()
prepareShadow() prepareShadow()
backgroundColor = MaterialTheme.blueGrey.color backgroundColor = MaterialTheme.color.blueGrey.base
} }
} }
......
...@@ -194,7 +194,7 @@ public class Preview: UIView { ...@@ -194,7 +194,7 @@ public class Preview: UIView {
// //
private func viewWithColor(color: UIColor) -> UIView { private func viewWithColor(color: UIColor) -> UIView {
let view: UIView = UIView(frame: Preview.boxBounds) let view: UIView = UIView(frame: Preview.boxBounds)
view.backgroundColor = MaterialTheme.clear.color view.backgroundColor = MaterialTheme.color.clear.base
view.layer.borderColor = color.CGColor view.layer.borderColor = color.CGColor
view.layer.borderWidth = 5 view.layer.borderWidth = 5
view.hidden = true view.hidden = true
......
...@@ -24,8 +24,8 @@ public class FabButton : MaterialButton { ...@@ -24,8 +24,8 @@ public class FabButton : MaterialButton {
// //
internal override func prepareView() { internal override func prepareView() {
super.prepareView() super.prepareView()
setTitleColor(MaterialTheme.white.color, forState: .Normal) setTitleColor(MaterialTheme.color.white.base, forState: .Normal)
backgroundColor = MaterialTheme.red.darken1 backgroundColor = MaterialTheme.color.red.darken1
contentEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0) contentEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0)
} }
......
...@@ -25,9 +25,9 @@ public class FlatButton : MaterialButton { ...@@ -25,9 +25,9 @@ public class FlatButton : MaterialButton {
internal override func prepareView() { internal override func prepareView() {
super.prepareView() super.prepareView()
titleLabel!.font = Roboto.regular titleLabel!.font = Roboto.regular
setTitleColor(MaterialTheme.blueGrey.darken4, forState: .Normal) setTitleColor(MaterialTheme.color.blueGrey.darken4, forState: .Normal)
pulseColor = MaterialTheme.blueGrey.lighten3 pulseColor = MaterialTheme.color.blueGrey.lighten3
backgroundColor = MaterialTheme.clear.color backgroundColor = MaterialTheme.color.clear.base
contentEdgeInsets = UIEdgeInsetsMake(MaterialTheme.buttonVerticalInset, MaterialTheme.buttonHorizontalInset, MaterialTheme.buttonVerticalInset, MaterialTheme.buttonHorizontalInset) contentEdgeInsets = UIEdgeInsetsMake(MaterialTheme.buttonVerticalInset, MaterialTheme.buttonHorizontalInset, MaterialTheme.buttonVerticalInset, MaterialTheme.buttonHorizontalInset)
} }
......
...@@ -282,7 +282,7 @@ public class ImageCardView : MaterialCardView, Comparable { ...@@ -282,7 +282,7 @@ public class ImageCardView : MaterialCardView, Comparable {
if nil == imageViewContainer { if nil == imageViewContainer {
imageViewContainer = UIView() imageViewContainer = UIView()
imageViewContainer!.translatesAutoresizingMaskIntoConstraints = false imageViewContainer!.translatesAutoresizingMaskIntoConstraints = false
imageViewContainer!.backgroundColor = MaterialTheme.clear.color imageViewContainer!.backgroundColor = MaterialTheme.color.clear.base
addSubview(imageViewContainer!) addSubview(imageViewContainer!)
} }
...@@ -293,8 +293,8 @@ public class ImageCardView : MaterialCardView, Comparable { ...@@ -293,8 +293,8 @@ public class ImageCardView : MaterialCardView, Comparable {
t.userInteractionEnabled = false t.userInteractionEnabled = false
t.clipsToBounds = true t.clipsToBounds = true
if nil != titleLabel { if nil != titleLabel {
titleLabelContainer!.backgroundColor = MaterialTheme.clear.color titleLabelContainer!.backgroundColor = MaterialTheme.color.clear.base
titleLabel!.textColor = MaterialTheme.white.color titleLabel!.textColor = MaterialTheme.color.white.base
titleLabelContainer!.removeFromSuperview() titleLabelContainer!.removeFromSuperview()
imageViewContainer!.addSubview(titleLabelContainer!) imageViewContainer!.addSubview(titleLabelContainer!)
} }
...@@ -336,16 +336,16 @@ public class ImageCardView : MaterialCardView, Comparable { ...@@ -336,16 +336,16 @@ public class ImageCardView : MaterialCardView, Comparable {
// text // text
titleLabelContainer!.addSubview(t) titleLabelContainer!.addSubview(t)
t.translatesAutoresizingMaskIntoConstraints = false t.translatesAutoresizingMaskIntoConstraints = false
t.backgroundColor = MaterialTheme.clear.color t.backgroundColor = MaterialTheme.color.clear.base
t.font = Roboto.regular t.font = Roboto.regular
t.numberOfLines = 0 t.numberOfLines = 0
t.lineBreakMode = .ByTruncatingTail t.lineBreakMode = .ByTruncatingTail
if nil == imageView { if nil == imageView {
titleLabelContainer!.backgroundColor = MaterialTheme.clear.color titleLabelContainer!.backgroundColor = MaterialTheme.color.clear.base
t.textColor = MaterialTheme.black.color t.textColor = MaterialTheme.color.black.base
} else { } else {
titleLabelContainer!.backgroundColor = MaterialTheme.clear.color titleLabelContainer!.backgroundColor = MaterialTheme.color.clear.base
t.textColor = MaterialTheme.clear.color t.textColor = MaterialTheme.color.clear.base
titleLabelContainer!.removeFromSuperview() titleLabelContainer!.removeFromSuperview()
imageViewContainer!.addSubview(titleLabelContainer!) imageViewContainer!.addSubview(titleLabelContainer!)
} }
...@@ -381,15 +381,15 @@ public class ImageCardView : MaterialCardView, Comparable { ...@@ -381,15 +381,15 @@ public class ImageCardView : MaterialCardView, Comparable {
if nil == detailLabelContainer { if nil == detailLabelContainer {
detailLabelContainer = UIView() detailLabelContainer = UIView()
detailLabelContainer!.translatesAutoresizingMaskIntoConstraints = false detailLabelContainer!.translatesAutoresizingMaskIntoConstraints = false
detailLabelContainer!.backgroundColor = MaterialTheme.clear.color detailLabelContainer!.backgroundColor = MaterialTheme.color.clear.base
addSubview(detailLabelContainer!) addSubview(detailLabelContainer!)
} }
// text // text
detailLabelContainer!.addSubview(l) detailLabelContainer!.addSubview(l)
l.translatesAutoresizingMaskIntoConstraints = false l.translatesAutoresizingMaskIntoConstraints = false
l.textColor = MaterialTheme.black.color l.textColor = MaterialTheme.color.black.base
l.backgroundColor = MaterialTheme.clear.color l.backgroundColor = MaterialTheme.color.clear.base
l.font = Roboto.light l.font = Roboto.light
l.numberOfLines = 0 l.numberOfLines = 0
l.lineBreakMode = .ByTruncatingTail l.lineBreakMode = .ByTruncatingTail
...@@ -408,7 +408,7 @@ public class ImageCardView : MaterialCardView, Comparable { ...@@ -408,7 +408,7 @@ public class ImageCardView : MaterialCardView, Comparable {
didSet { didSet {
if let d = divider { if let d = divider {
d.translatesAutoresizingMaskIntoConstraints = false d.translatesAutoresizingMaskIntoConstraints = false
d.backgroundColor = MaterialTheme.blueGrey.lighten5 d.backgroundColor = MaterialTheme.color.blueGrey.lighten5
addSubview(d) addSubview(d)
} else { } else {
divider?.removeFromSuperview() divider?.removeFromSuperview()
...@@ -433,7 +433,7 @@ public class ImageCardView : MaterialCardView, Comparable { ...@@ -433,7 +433,7 @@ public class ImageCardView : MaterialCardView, Comparable {
} else if nil == buttonsContainer { } else if nil == buttonsContainer {
buttonsContainer = UIView() buttonsContainer = UIView()
buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false
buttonsContainer!.backgroundColor = MaterialTheme.clear.color buttonsContainer!.backgroundColor = MaterialTheme.color.clear.base
addSubview(buttonsContainer!) addSubview(buttonsContainer!)
} }
reloadView() reloadView()
...@@ -451,7 +451,7 @@ public class ImageCardView : MaterialCardView, Comparable { ...@@ -451,7 +451,7 @@ public class ImageCardView : MaterialCardView, Comparable {
} else if nil == buttonsContainer { } else if nil == buttonsContainer {
buttonsContainer = UIView() buttonsContainer = UIView()
buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false
buttonsContainer!.backgroundColor = MaterialTheme.clear.color buttonsContainer!.backgroundColor = MaterialTheme.color.clear.base
addSubview(buttonsContainer!) addSubview(buttonsContainer!)
} else { } else {
for v in buttonsContainer!.subviews { for v in buttonsContainer!.subviews {
...@@ -638,7 +638,7 @@ public class ImageCardView : MaterialCardView, Comparable { ...@@ -638,7 +638,7 @@ public class ImageCardView : MaterialCardView, Comparable {
internal override func prepareView() { internal override func prepareView() {
super.prepareView() super.prepareView()
prepareShadow() prepareShadow()
backgroundColor = MaterialTheme.white.color backgroundColor = MaterialTheme.color.white.base
} }
} }
......
...@@ -44,7 +44,7 @@ public class MaterialButton : UIButton { ...@@ -44,7 +44,7 @@ public class MaterialButton : UIButton {
/** /**
:name: pulseColor :name: pulseColor
*/ */
public var pulseColor: UIColor? = MaterialTheme.white.color public var pulseColor: UIColor? = MaterialTheme.color.white.base
/** /**
:name: init :name: init
...@@ -119,7 +119,7 @@ public class MaterialButton : UIButton { ...@@ -119,7 +119,7 @@ public class MaterialButton : UIButton {
// :name: prepareShadow // :name: prepareShadow
// //
internal func prepareShadow() { internal func prepareShadow() {
layer.shadowColor = MaterialTheme.black.color.CGColor layer.shadowColor = MaterialTheme.color.black.base.CGColor
layer.shadowOffset = CGSizeMake(0.1, 0.1) layer.shadowOffset = CGSizeMake(0.1, 0.1)
layer.shadowOpacity = 0.4 layer.shadowOpacity = 0.4
layer.shadowRadius = 2 layer.shadowRadius = 2
......
...@@ -49,7 +49,7 @@ public class MaterialCardView : UIView { ...@@ -49,7 +49,7 @@ public class MaterialCardView : UIView {
/** /**
:name: pulseColor :name: pulseColor
*/ */
public var pulseColor: UIColor? = MaterialTheme.blueGrey.lighten3 public var pulseColor: UIColor? = MaterialTheme.color.blueGrey.lighten3
/** /**
:name: init :name: init
...@@ -113,7 +113,7 @@ public class MaterialCardView : UIView { ...@@ -113,7 +113,7 @@ public class MaterialCardView : UIView {
// :name: prepareShadow // :name: prepareShadow
// //
internal func prepareShadow() { internal func prepareShadow() {
layer.shadowColor = MaterialTheme.black.color.CGColor layer.shadowColor = MaterialTheme.color.black.base.CGColor
layer.shadowOffset = CGSizeMake(0.1, 0.1) layer.shadowOffset = CGSizeMake(0.1, 0.1)
layer.shadowOpacity = 0.4 layer.shadowOpacity = 0.4
layer.shadowRadius = 2 layer.shadowRadius = 2
...@@ -123,7 +123,7 @@ public class MaterialCardView : UIView { ...@@ -123,7 +123,7 @@ public class MaterialCardView : UIView {
// :name: removeShadow // :name: removeShadow
// //
internal func removeShadow() { internal func removeShadow() {
layer.shadowColor = MaterialTheme.clear.color.CGColor layer.shadowColor = MaterialTheme.color.clear.base.CGColor
layer.shadowOffset = CGSizeMake(0, 0) layer.shadowOffset = CGSizeMake(0, 0)
layer.shadowOpacity = 0 layer.shadowOpacity = 0
layer.shadowRadius = 0 layer.shadowRadius = 0
......
//
// Copyright (C) 2015 GraphKit, Inc. <http://graphkit.io> and other GraphKit contributors.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program located at the root of the software package
// in a file called LICENSE. If not, see <http://www.gnu.org/licenses/>.
//
import UIKit
// font
public extension MaterialTheme {
public struct font {
public static var pointSize: CGFloat = 16
}
}
\ No newline at end of file
...@@ -33,7 +33,7 @@ public extension MaterialTheme.view { ...@@ -33,7 +33,7 @@ public extension MaterialTheme.view {
public static let height: CGFloat = UIScreen.mainScreen().bounds.height public static let height: CGFloat = UIScreen.mainScreen().bounds.height
// layer // layer
public static let shadowColor: UIColor = MaterialTheme.blueGrey.darken4 public static let shadowColor: UIColor = MaterialTheme.color.blueGrey.darken4
public static let shadowOffset: CGSize = CGSizeMake(0.2, 0.2) public static let shadowOffset: CGSize = CGSizeMake(0.2, 0.2)
public static let shadowOpacity: Float = 0.5 public static let shadowOpacity: Float = 0.5
public static let shadowRadius: CGFloat = 1 public static let shadowRadius: CGFloat = 1
...@@ -41,13 +41,14 @@ public extension MaterialTheme.view { ...@@ -41,13 +41,14 @@ public extension MaterialTheme.view {
public static let masksToBounds: Bool = false public static let masksToBounds: Bool = false
// color // color
public static let backgroudColor: UIColor = MaterialTheme.white.color public static let backgroudColor: UIColor = MaterialTheme.color.white.base
// interaction // interaction
public static let userInteractionEnabled: Bool = true public static let userInteractionEnabled: Bool = true
// image // image
public static let imageGravity: String = kCAGravityCenter public static let imageGravity: String = kCAGravityCenter
public static let imageContentsRect: CGRect = CGRectMake(0, 0, 1, 1)
} }
// navigation // navigation
...@@ -67,7 +68,7 @@ public extension MaterialTheme.navigation { ...@@ -67,7 +68,7 @@ public extension MaterialTheme.navigation {
public static let masksToBounds: Bool = MaterialTheme.view.masksToBounds public static let masksToBounds: Bool = MaterialTheme.view.masksToBounds
// color // color
public static let backgroudColor: UIColor = MaterialTheme.blue.accent2 public static let backgroudColor: UIColor = MaterialTheme.color.blue.accent2
public static let lightContentStatusBar: Bool = true public static let lightContentStatusBar: Bool = true
// interaction // interaction
...@@ -75,5 +76,6 @@ public extension MaterialTheme.navigation { ...@@ -75,5 +76,6 @@ public extension MaterialTheme.navigation {
// image // image
public static let imageGravity: String = MaterialTheme.view.imageGravity public static let imageGravity: String = MaterialTheme.view.imageGravity
public static let imageContentsRect: CGRect = MaterialTheme.view.imageContentsRect
} }
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
import UIKit import UIKit
public class MaterialView: UIView { public class MaterialView: UIView {
/** /**
:name: image :name: image
*/ */
...@@ -33,7 +34,16 @@ public class MaterialView: UIView { ...@@ -33,7 +34,16 @@ public class MaterialView: UIView {
*/ */
public var imageGravity: String? { public var imageGravity: String? {
didSet { didSet {
layer.contentsGravity = nil == imageGravity ? MaterialTheme.navigation.imageGravity : imageGravity! layer.contentsGravity = nil == imageGravity ? MaterialTheme.view.imageGravity : imageGravity!
}
}
/**
:name: imageContentsRect
*/
public var imageContentsRect: CGRect? {
didSet {
layer.contentsRect = nil == imageContentsRect ? MaterialTheme.view.imageContentsRect : imageContentsRect!
} }
} }
...@@ -142,6 +152,9 @@ public class MaterialView: UIView { ...@@ -142,6 +152,9 @@ public class MaterialView: UIView {
*/ */
public override init(frame: CGRect) { public override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
prepareView()
prepareLayer()
prepareBounds()
} }
/** /**
...@@ -150,8 +163,8 @@ public class MaterialView: UIView { ...@@ -150,8 +163,8 @@ public class MaterialView: UIView {
public convenience init() { public convenience init() {
self.init(frame: CGRectMake(MaterialTheme.view.x, MaterialTheme.view.y, MaterialTheme.view.width, MaterialTheme.view.height)) self.init(frame: CGRectMake(MaterialTheme.view.x, MaterialTheme.view.y, MaterialTheme.view.width, MaterialTheme.view.height))
prepareView() prepareView()
prepareFrame()
prepareLayer() prepareLayer()
prepareBounds()
} }
/** /**
...@@ -163,13 +176,13 @@ public class MaterialView: UIView { ...@@ -163,13 +176,13 @@ public class MaterialView: UIView {
} }
/** /**
:name: prepareFrame :name: prepareBounds
*/ */
internal func prepareFrame() { internal func prepareBounds() {
x = frame.origin.x self.x = frame.origin.x
y = frame.origin.y self.y = frame.origin.y
width = frame.size.width self.width = frame.size.width
height = frame.size.height self.height = frame.size.height
} }
/** /**
......
...@@ -29,13 +29,31 @@ public class NavigationBarView: MaterialView { ...@@ -29,13 +29,31 @@ public class NavigationBarView: MaterialView {
} }
/** /**
:name: imageGravity
*/
public override var imageGravity: String? {
didSet {
layer.contentsGravity = nil == imageGravity ? MaterialTheme.navigation.imageGravity : imageGravity!
}
}
/**
:name: imageContentsRect
*/
public override var imageContentsRect: CGRect? {
didSet {
layer.contentsRect = nil == imageContentsRect ? MaterialTheme.navigation.imageContentsRect : imageContentsRect!
}
}
/**
:name: init :name: init
*/ */
public convenience init() { public convenience init() {
self.init(frame: CGRectMake(MaterialTheme.navigation.x, MaterialTheme.navigation.y, MaterialTheme.navigation.width, MaterialTheme.navigation.height)) self.init(frame: CGRectMake(MaterialTheme.navigation.x, MaterialTheme.navigation.y, MaterialTheme.navigation.width, MaterialTheme.navigation.height))
prepareView() prepareView()
prepareFrame()
prepareLayer() prepareLayer()
prepareBounds()
} }
/** /**
......
...@@ -25,8 +25,8 @@ public class RaisedButton : MaterialButton { ...@@ -25,8 +25,8 @@ public class RaisedButton : MaterialButton {
internal override func prepareView() { internal override func prepareView() {
super.prepareView() super.prepareView()
titleLabel!.font = Roboto.regular titleLabel!.font = Roboto.regular
setTitleColor(MaterialTheme.white.color, forState: .Normal) setTitleColor(MaterialTheme.color.white.base, forState: .Normal)
backgroundColor = MaterialTheme.blue.accent2 backgroundColor = MaterialTheme.color.blue.accent2
contentEdgeInsets = UIEdgeInsetsMake(MaterialTheme.buttonVerticalInset, MaterialTheme.buttonHorizontalInset, MaterialTheme.buttonVerticalInset, MaterialTheme.buttonHorizontalInset) contentEdgeInsets = UIEdgeInsetsMake(MaterialTheme.buttonVerticalInset, MaterialTheme.buttonHorizontalInset, MaterialTheme.buttonVerticalInset, MaterialTheme.buttonHorizontalInset)
} }
......
...@@ -23,7 +23,7 @@ public struct Roboto { ...@@ -23,7 +23,7 @@ public struct Roboto {
:name: thin :name: thin
*/ */
public static var thin: UIFont { public static var thin: UIFont {
return thinWithSize(MaterialTheme.textFontSize) return thinWithSize(MaterialTheme.font.pointSize)
} }
/** /**
...@@ -40,7 +40,7 @@ public struct Roboto { ...@@ -40,7 +40,7 @@ public struct Roboto {
:name: light :name: light
*/ */
public static var light: UIFont { public static var light: UIFont {
return lightWithSize(MaterialTheme.textFontSize) return lightWithSize(MaterialTheme.font.pointSize)
} }
/** /**
...@@ -57,7 +57,7 @@ public struct Roboto { ...@@ -57,7 +57,7 @@ public struct Roboto {
:name: regular :name: regular
*/ */
public static var regular: UIFont { public static var regular: UIFont {
return regularWithSize(MaterialTheme.textFontSize) return regularWithSize(MaterialTheme.font.pointSize)
} }
/** /**
...@@ -74,7 +74,7 @@ public struct Roboto { ...@@ -74,7 +74,7 @@ public struct Roboto {
:name: medium :name: medium
*/ */
public static var medium: UIFont { public static var medium: UIFont {
return mediumWithSize(MaterialTheme.textFontSize) return mediumWithSize(MaterialTheme.font.pointSize)
} }
/** /**
...@@ -91,7 +91,7 @@ public struct Roboto { ...@@ -91,7 +91,7 @@ public struct Roboto {
:name: bold :name: bold
*/ */
public static var bold: UIFont { public static var bold: UIFont {
return boldWithSize(MaterialTheme.textFontSize) return boldWithSize(MaterialTheme.font.pointSize)
} }
/** /**
......
...@@ -136,7 +136,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -136,7 +136,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
public static var hideStatusBar: Bool = true public static var hideStatusBar: Bool = true
public static var horizontalThreshold: CGFloat = defaultOptions.threshold public static var horizontalThreshold: CGFloat = defaultOptions.threshold
public static var verticalThreshold: CGFloat = defaultOptions.threshold public static var verticalThreshold: CGFloat = defaultOptions.threshold
public static var backdropBackgroundColor: UIColor = MaterialTheme.black.color public static var backdropBackgroundColor: UIColor = MaterialTheme.color.black.base
public static var animationDuration: CGFloat = defaultOptions.defaultAnimationDuration public static var animationDuration: CGFloat = defaultOptions.defaultAnimationDuration
public static var leftBezelWidth: CGFloat = defaultOptions.bezelWidth public static var leftBezelWidth: CGFloat = defaultOptions.bezelWidth
public static var leftViewContainerWidth: CGFloat = defaultOptions.containerWidth public static var leftViewContainerWidth: CGFloat = defaultOptions.containerWidth
...@@ -1242,7 +1242,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -1242,7 +1242,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
// //
private func prepareMainContainer() { private func prepareMainContainer() {
mainViewContainer = UIView(frame: view.bounds) mainViewContainer = UIView(frame: view.bounds)
mainViewContainer!.backgroundColor = MaterialTheme.clear.color mainViewContainer!.backgroundColor = MaterialTheme.color.clear.base
mainViewContainer!.autoresizingMask = [.FlexibleHeight, .FlexibleWidth] mainViewContainer!.autoresizingMask = [.FlexibleHeight, .FlexibleWidth]
view.addSubview(mainViewContainer!) view.addSubview(mainViewContainer!)
} }
...@@ -1301,7 +1301,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -1301,7 +1301,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
b.origin.x = originX b.origin.x = originX
b.origin.y = originY b.origin.y = originY
viewContainer = UIView(frame: b) viewContainer = UIView(frame: b)
viewContainer!.backgroundColor = MaterialTheme.clear.color viewContainer!.backgroundColor = MaterialTheme.color.clear.base
viewContainer!.autoresizingMask = .FlexibleHeight viewContainer!.autoresizingMask = .FlexibleHeight
view.addSubview(viewContainer!) view.addSubview(viewContainer!)
} }
......
...@@ -62,7 +62,7 @@ public class TextView: UITextView { ...@@ -62,7 +62,7 @@ public class TextView: UITextView {
p.font = font p.font = font
p.textAlignment = textAlignment p.textAlignment = textAlignment
p.numberOfLines = 0 p.numberOfLines = 0
p.backgroundColor = MaterialTheme.clear.color p.backgroundColor = MaterialTheme.color.clear.base
addSubview(p) addSubview(p)
updateLabelConstraints() updateLabelConstraints()
textViewTextDidChange() textViewTextDidChange()
...@@ -124,7 +124,7 @@ public class TextView: UITextView { ...@@ -124,7 +124,7 @@ public class TextView: UITextView {
// label needs to be added to the view // label needs to be added to the view
// hierarchy before setting insets // hierarchy before setting insets
textContainerInset = UIEdgeInsetsMake(16, 16, 16, 16) textContainerInset = UIEdgeInsetsMake(16, 16, 16, 16)
backgroundColor = MaterialTheme.clear.color backgroundColor = MaterialTheme.color.clear.base
NSNotificationCenter.defaultCenter().addObserver(self, selector: "textViewTextDidChange", name: UITextViewTextDidChangeNotification, object: nil) NSNotificationCenter.defaultCenter().addObserver(self, selector: "textViewTextDidChange", name: UITextViewTextDidChangeNotification, object: nil)
updateLabelConstraints() updateLabelConstraints()
} }
......
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