Commit 71fcc474 by Daniel Dahan

added Flat, Fab, and Raised buttons with pulse

parent dc553e4a
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
65BDD14D1BB5ED9F006F7F2B /* MaterialTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD14C1BB5ED9F006F7F2B /* MaterialTheme.swift */; settings = {ASSET_TAGS = (); }; }; 65BDD14D1BB5ED9F006F7F2B /* MaterialTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD14C1BB5ED9F006F7F2B /* MaterialTheme.swift */; settings = {ASSET_TAGS = (); }; };
65BDD14F1BB5EE4A006F7F2B /* MaterialGravity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD14E1BB5EE4A006F7F2B /* MaterialGravity.swift */; settings = {ASSET_TAGS = (); }; }; 65BDD14F1BB5EE4A006F7F2B /* MaterialGravity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD14E1BB5EE4A006F7F2B /* MaterialGravity.swift */; settings = {ASSET_TAGS = (); }; };
65BDD1521BB6EE7C006F7F2B /* RobotoFont.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1511BB6EE7C006F7F2B /* RobotoFont.swift */; settings = {ASSET_TAGS = (); }; }; 65BDD1521BB6EE7C006F7F2B /* RobotoFont.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1511BB6EE7C006F7F2B /* RobotoFont.swift */; settings = {ASSET_TAGS = (); }; };
65BDD1541BB6F473006F7F2B /* MaterialShadow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1531BB6F473006F7F2B /* MaterialShadow.swift */; settings = {ASSET_TAGS = (); }; }; 65BDD1541BB6F473006F7F2B /* MaterialDepth.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1531BB6F473006F7F2B /* MaterialDepth.swift */; settings = {ASSET_TAGS = (); }; };
65BDD1571BB6FC82006F7F2B /* MaterialButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1561BB6FC82006F7F2B /* MaterialButton.swift */; settings = {ASSET_TAGS = (); }; }; 65BDD1571BB6FC82006F7F2B /* MaterialButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1561BB6FC82006F7F2B /* MaterialButton.swift */; settings = {ASSET_TAGS = (); }; };
65BDD1591BB6FE3E006F7F2B /* FlatButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1581BB6FE3E006F7F2B /* FlatButton.swift */; settings = {ASSET_TAGS = (); }; }; 65BDD1591BB6FE3E006F7F2B /* FlatButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1581BB6FE3E006F7F2B /* FlatButton.swift */; settings = {ASSET_TAGS = (); }; };
65BDD15B1BB7095E006F7F2B /* MaterialRadius.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD15A1BB7095E006F7F2B /* MaterialRadius.swift */; settings = {ASSET_TAGS = (); }; }; 65BDD15B1BB7095E006F7F2B /* MaterialRadius.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD15A1BB7095E006F7F2B /* MaterialRadius.swift */; settings = {ASSET_TAGS = (); }; };
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
65BDD15E1BB7111E006F7F2B /* MaterialTheme.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD14C1BB5ED9F006F7F2B /* MaterialTheme.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 65BDD15E1BB7111E006F7F2B /* MaterialTheme.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD14C1BB5ED9F006F7F2B /* MaterialTheme.swift */; settings = {ATTRIBUTES = (Public, ); }; };
65BDD15F1BB7111E006F7F2B /* MaterialColor.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD1481BB5DC98006F7F2B /* MaterialColor.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 65BDD15F1BB7111E006F7F2B /* MaterialColor.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD1481BB5DC98006F7F2B /* MaterialColor.swift */; settings = {ATTRIBUTES = (Public, ); }; };
65BDD1601BB7111E006F7F2B /* MaterialGravity.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD14E1BB5EE4A006F7F2B /* MaterialGravity.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 65BDD1601BB7111E006F7F2B /* MaterialGravity.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD14E1BB5EE4A006F7F2B /* MaterialGravity.swift */; settings = {ATTRIBUTES = (Public, ); }; };
65BDD1611BB7111E006F7F2B /* MaterialShadow.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD1531BB6F473006F7F2B /* MaterialShadow.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 65BDD1611BB7111E006F7F2B /* MaterialDepth.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD1531BB6F473006F7F2B /* MaterialDepth.swift */; settings = {ATTRIBUTES = (Public, ); }; };
65BDD1621BB7111E006F7F2B /* MaterialRadius.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD15A1BB7095E006F7F2B /* MaterialRadius.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 65BDD1621BB7111E006F7F2B /* MaterialRadius.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD15A1BB7095E006F7F2B /* MaterialRadius.swift */; settings = {ATTRIBUTES = (Public, ); }; };
65BDD1631BB7111E006F7F2B /* MaterialInsets.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD15C1BB70D60006F7F2B /* MaterialInsets.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 65BDD1631BB7111E006F7F2B /* MaterialInsets.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD15C1BB70D60006F7F2B /* MaterialInsets.swift */; settings = {ATTRIBUTES = (Public, ); }; };
65BDD1641BB7111E006F7F2B /* MaterialFont.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD14A1BB5DD02006F7F2B /* MaterialFont.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 65BDD1641BB7111E006F7F2B /* MaterialFont.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD14A1BB5DD02006F7F2B /* MaterialFont.swift */; settings = {ATTRIBUTES = (Public, ); }; };
...@@ -34,6 +34,9 @@ ...@@ -34,6 +34,9 @@
65BDD16E1BB899F2006F7F2B /* MaterialPulseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD16D1BB899F2006F7F2B /* MaterialPulseView.swift */; settings = {ASSET_TAGS = (); }; }; 65BDD16E1BB899F2006F7F2B /* MaterialPulseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD16D1BB899F2006F7F2B /* MaterialPulseView.swift */; settings = {ASSET_TAGS = (); }; };
65BDD1721BB8CD77006F7F2B /* MaterialLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1711BB8CD77006F7F2B /* MaterialLabel.swift */; settings = {ASSET_TAGS = (); }; }; 65BDD1721BB8CD77006F7F2B /* MaterialLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1711BB8CD77006F7F2B /* MaterialLabel.swift */; settings = {ASSET_TAGS = (); }; };
65BDD1741BB8D443006F7F2B /* MaterialAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1731BB8D443006F7F2B /* MaterialAnimation.swift */; settings = {ASSET_TAGS = (); }; }; 65BDD1741BB8D443006F7F2B /* MaterialAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1731BB8D443006F7F2B /* MaterialAnimation.swift */; settings = {ASSET_TAGS = (); }; };
65BDD1771BB98E31006F7F2B /* MaterialSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1761BB98E31006F7F2B /* MaterialSize.swift */; settings = {ASSET_TAGS = (); }; };
65BDD1791BB99C0F006F7F2B /* RaisedButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1781BB99C0F006F7F2B /* RaisedButton.swift */; settings = {ASSET_TAGS = (); }; };
65BDD17C1BB99E29006F7F2B /* FabButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD17B1BB99E29006F7F2B /* FabButton.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 */; };
...@@ -63,7 +66,7 @@ ...@@ -63,7 +66,7 @@
65BDD14C1BB5ED9F006F7F2B /* MaterialTheme.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialTheme.swift; sourceTree = "<group>"; }; 65BDD14C1BB5ED9F006F7F2B /* MaterialTheme.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialTheme.swift; sourceTree = "<group>"; };
65BDD14E1BB5EE4A006F7F2B /* MaterialGravity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialGravity.swift; sourceTree = "<group>"; }; 65BDD14E1BB5EE4A006F7F2B /* MaterialGravity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialGravity.swift; sourceTree = "<group>"; };
65BDD1511BB6EE7C006F7F2B /* RobotoFont.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RobotoFont.swift; sourceTree = "<group>"; }; 65BDD1511BB6EE7C006F7F2B /* RobotoFont.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RobotoFont.swift; sourceTree = "<group>"; };
65BDD1531BB6F473006F7F2B /* MaterialShadow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialShadow.swift; sourceTree = "<group>"; }; 65BDD1531BB6F473006F7F2B /* MaterialDepth.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialDepth.swift; sourceTree = "<group>"; };
65BDD1561BB6FC82006F7F2B /* MaterialButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialButton.swift; sourceTree = "<group>"; }; 65BDD1561BB6FC82006F7F2B /* MaterialButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialButton.swift; sourceTree = "<group>"; };
65BDD1581BB6FE3E006F7F2B /* FlatButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FlatButton.swift; sourceTree = "<group>"; }; 65BDD1581BB6FE3E006F7F2B /* FlatButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FlatButton.swift; sourceTree = "<group>"; };
65BDD15A1BB7095E006F7F2B /* MaterialRadius.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialRadius.swift; sourceTree = "<group>"; }; 65BDD15A1BB7095E006F7F2B /* MaterialRadius.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialRadius.swift; sourceTree = "<group>"; };
...@@ -73,6 +76,9 @@ ...@@ -73,6 +76,9 @@
65BDD16D1BB899F2006F7F2B /* MaterialPulseView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialPulseView.swift; sourceTree = "<group>"; }; 65BDD16D1BB899F2006F7F2B /* MaterialPulseView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialPulseView.swift; sourceTree = "<group>"; };
65BDD1711BB8CD77006F7F2B /* MaterialLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialLabel.swift; sourceTree = "<group>"; }; 65BDD1711BB8CD77006F7F2B /* MaterialLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialLabel.swift; sourceTree = "<group>"; };
65BDD1731BB8D443006F7F2B /* MaterialAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialAnimation.swift; sourceTree = "<group>"; }; 65BDD1731BB8D443006F7F2B /* MaterialAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialAnimation.swift; sourceTree = "<group>"; };
65BDD1761BB98E31006F7F2B /* MaterialSize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialSize.swift; sourceTree = "<group>"; };
65BDD1781BB99C0F006F7F2B /* RaisedButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RaisedButton.swift; sourceTree = "<group>"; };
65BDD17B1BB99E29006F7F2B /* FabButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FabButton.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>"; };
...@@ -133,6 +139,8 @@ ...@@ -133,6 +139,8 @@
children = ( children = (
65BDD1561BB6FC82006F7F2B /* MaterialButton.swift */, 65BDD1561BB6FC82006F7F2B /* MaterialButton.swift */,
65BDD1581BB6FE3E006F7F2B /* FlatButton.swift */, 65BDD1581BB6FE3E006F7F2B /* FlatButton.swift */,
65BDD1781BB99C0F006F7F2B /* RaisedButton.swift */,
65BDD17B1BB99E29006F7F2B /* FabButton.swift */,
); );
name = Button; name = Button;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -226,11 +234,12 @@ ...@@ -226,11 +234,12 @@
65BDD14C1BB5ED9F006F7F2B /* MaterialTheme.swift */, 65BDD14C1BB5ED9F006F7F2B /* MaterialTheme.swift */,
65BDD1481BB5DC98006F7F2B /* MaterialColor.swift */, 65BDD1481BB5DC98006F7F2B /* MaterialColor.swift */,
65BDD14E1BB5EE4A006F7F2B /* MaterialGravity.swift */, 65BDD14E1BB5EE4A006F7F2B /* MaterialGravity.swift */,
65BDD1531BB6F473006F7F2B /* MaterialShadow.swift */, 65BDD1531BB6F473006F7F2B /* MaterialDepth.swift */,
65BDD15A1BB7095E006F7F2B /* MaterialRadius.swift */, 65BDD15A1BB7095E006F7F2B /* MaterialRadius.swift */,
65BDD15C1BB70D60006F7F2B /* MaterialInsets.swift */, 65BDD15C1BB70D60006F7F2B /* MaterialInsets.swift */,
65BDD1691BB7146B006F7F2B /* MaterialBorder.swift */, 65BDD1691BB7146B006F7F2B /* MaterialBorder.swift */,
65BDD16B1BB88D1A006F7F2B /* MaterialShape.swift */, 65BDD16B1BB88D1A006F7F2B /* MaterialShape.swift */,
65BDD1761BB98E31006F7F2B /* MaterialSize.swift */,
); );
name = Theme; name = Theme;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -255,7 +264,7 @@ ...@@ -255,7 +264,7 @@
65BDD15E1BB7111E006F7F2B /* MaterialTheme.swift in Headers */, 65BDD15E1BB7111E006F7F2B /* MaterialTheme.swift in Headers */,
65BDD15F1BB7111E006F7F2B /* MaterialColor.swift in Headers */, 65BDD15F1BB7111E006F7F2B /* MaterialColor.swift in Headers */,
65BDD1601BB7111E006F7F2B /* MaterialGravity.swift in Headers */, 65BDD1601BB7111E006F7F2B /* MaterialGravity.swift in Headers */,
65BDD1611BB7111E006F7F2B /* MaterialShadow.swift in Headers */, 65BDD1611BB7111E006F7F2B /* MaterialDepth.swift in Headers */,
65BDD1621BB7111E006F7F2B /* MaterialRadius.swift in Headers */, 65BDD1621BB7111E006F7F2B /* MaterialRadius.swift in Headers */,
65BDD1631BB7111E006F7F2B /* MaterialInsets.swift in Headers */, 65BDD1631BB7111E006F7F2B /* MaterialInsets.swift in Headers */,
65BDD1641BB7111E006F7F2B /* MaterialFont.swift in Headers */, 65BDD1641BB7111E006F7F2B /* MaterialFont.swift in Headers */,
...@@ -375,10 +384,13 @@ ...@@ -375,10 +384,13 @@
65BDD16C1BB88D1A006F7F2B /* MaterialShape.swift in Sources */, 65BDD16C1BB88D1A006F7F2B /* MaterialShape.swift in Sources */,
65BDD1521BB6EE7C006F7F2B /* RobotoFont.swift in Sources */, 65BDD1521BB6EE7C006F7F2B /* RobotoFont.swift in Sources */,
65BDD1591BB6FE3E006F7F2B /* FlatButton.swift in Sources */, 65BDD1591BB6FE3E006F7F2B /* FlatButton.swift in Sources */,
65BDD1791BB99C0F006F7F2B /* RaisedButton.swift in Sources */,
962F3E531BACA68C0004B8AD /* NavigationBarView.swift in Sources */, 962F3E531BACA68C0004B8AD /* NavigationBarView.swift in Sources */,
65BDD14F1BB5EE4A006F7F2B /* MaterialGravity.swift in Sources */, 65BDD14F1BB5EE4A006F7F2B /* MaterialGravity.swift in Sources */,
65BDD1541BB6F473006F7F2B /* MaterialShadow.swift in Sources */, 65BDD1771BB98E31006F7F2B /* MaterialSize.swift in Sources */,
65BDD1541BB6F473006F7F2B /* MaterialDepth.swift in Sources */,
65BDD1571BB6FC82006F7F2B /* MaterialButton.swift in Sources */, 65BDD1571BB6FC82006F7F2B /* MaterialButton.swift in Sources */,
65BDD17C1BB99E29006F7F2B /* FabButton.swift in Sources */,
65BDD16E1BB899F2006F7F2B /* MaterialPulseView.swift in Sources */, 65BDD16E1BB899F2006F7F2B /* MaterialPulseView.swift in Sources */,
65BDD1741BB8D443006F7F2B /* MaterialAnimation.swift in Sources */, 65BDD1741BB8D443006F7F2B /* MaterialAnimation.swift in Sources */,
65BDD14B1BB5DD02006F7F2B /* MaterialFont.swift in Sources */, 65BDD14B1BB5DD02006F7F2B /* MaterialFont.swift in Sources */,
......
//
// 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
public class FabButton : MaterialButton {
//
// :name: prepareView
//
internal override func prepareView() {
super.prepareView()
setTitleColor(MaterialTheme.button.fab.titleLabelColorForNormalState, forState: .Normal)
titleLabel!.font = MaterialTheme.button.fab.titleLabelFont
userInteractionEnabled = MaterialTheme.button.fab.userInteractionEnabled
backgroundColor = MaterialTheme.button.fab.backgroudColor
pulseColor = MaterialTheme.button.fab.pulseColor
shadowDepth = MaterialTheme.button.fab.shadowDepth
shadowColor = MaterialTheme.button.fab.shadowColor
zPosition = MaterialTheme.button.fab.zPosition
masksToBounds = MaterialTheme.button.fab.masksToBounds
cornerRadius = MaterialTheme.button.fab.cornerRadius
borderWidth = MaterialTheme.button.fab.borderWidth
borderColor = MaterialTheme.button.fab.bordercolor
contentInsets = MaterialTheme.button.fab.contentInsets
shape = MaterialTheme.button.fab.shape
}
}
\ No newline at end of file
...@@ -26,13 +26,11 @@ public class FlatButton : MaterialButton { ...@@ -26,13 +26,11 @@ public class FlatButton : MaterialButton {
super.prepareView() super.prepareView()
setTitleColor(MaterialTheme.button.flat.titleLabelColorForNormalState, forState: .Normal) setTitleColor(MaterialTheme.button.flat.titleLabelColorForNormalState, forState: .Normal)
titleLabel!.font = MaterialTheme.button.flat.titleLabelFont titleLabel!.font = MaterialTheme.button.flat.titleLabelFont
}
userInteractionEnabled = MaterialTheme.button.flat.userInteractionEnabled
// backgroundColor = MaterialTheme.button.flat.backgroudColor
// :name: prepareLayer pulseColor = MaterialTheme.button.flat.pulseColor
//
internal override func prepareLayer() {
super.prepareLayer()
shadowDepth = MaterialTheme.button.flat.shadowDepth shadowDepth = MaterialTheme.button.flat.shadowDepth
shadowColor = MaterialTheme.button.flat.shadowColor shadowColor = MaterialTheme.button.flat.shadowColor
zPosition = MaterialTheme.button.flat.zPosition zPosition = MaterialTheme.button.flat.zPosition
...@@ -41,6 +39,6 @@ public class FlatButton : MaterialButton { ...@@ -41,6 +39,6 @@ public class FlatButton : MaterialButton {
borderWidth = MaterialTheme.button.flat.borderWidth borderWidth = MaterialTheme.button.flat.borderWidth
borderColor = MaterialTheme.button.flat.bordercolor borderColor = MaterialTheme.button.flat.bordercolor
contentInsets = MaterialTheme.button.flat.contentInsets contentInsets = MaterialTheme.button.flat.contentInsets
backgroundColor = MaterialTheme.button.flat.backgroudColor shape = MaterialTheme.button.flat.shape
} }
} }
\ No newline at end of file
...@@ -20,31 +20,28 @@ import UIKit ...@@ -20,31 +20,28 @@ import UIKit
public typealias MaterialBorderType = CGFloat public typealias MaterialBorderType = CGFloat
public enum MaterialBorder : MaterialBorderType { public enum MaterialBorder {
case None case Border0
case Thin case Border1
case Light case Border2
case Regular case Border3
case Medium case Border4
case Thick
} }
/** /**
:name: MaterialBorderToValue :name: MaterialBorderToValue
*/ */
public func MaterialBorderToValue(width: MaterialBorder) -> MaterialBorderType { public func MaterialBorderToValue(border: MaterialBorder) -> MaterialBorderType {
switch width { switch border {
case .None: case .Border0:
return 0 return 0
case .Thin: case .Border1:
return 0.5 return 0.5
case .Light: case .Border2:
return 1 return 1
case .Regular: case .Border3:
return 2 return 2
case .Medium: case .Border4:
return 3 return 3
case .Thick:
return 4
} }
} }
...@@ -19,15 +19,34 @@ ...@@ -19,15 +19,34 @@
import UIKit import UIKit
public class MaterialButton : UIButton { public class MaterialButton : UIButton {
//
// :name: visualLayer
//
public private(set) lazy var visualLayer: CAShapeLayer = CAShapeLayer()
//
// :name: pulseLayer
//
internal lazy var pulseLayer: CAShapeLayer = CAShapeLayer()
/**
:name: pulseColor
*/
public var pulseColor: UIColor? {
didSet {
pulseLayer.backgroundColor = pulseColor?.colorWithAlphaComponent(0.5).CGColor
}
}
/** /**
:name: backgroundColor :name: backgroundColor
*/ */
public override var backgroundColor: UIColor? { public override var backgroundColor: UIColor? {
get { get {
return nil == layer.backgroundColor ? nil : UIColor(CGColor: layer.backgroundColor!) return nil == visualLayer.backgroundColor ? nil : UIColor(CGColor: visualLayer.backgroundColor!)
} }
set(value) { set(value) {
layer.backgroundColor = value?.CGColor visualLayer.backgroundColor = value?.CGColor
} }
} }
...@@ -36,10 +55,10 @@ public class MaterialButton : UIButton { ...@@ -36,10 +55,10 @@ public class MaterialButton : UIButton {
*/ */
public var x: CGFloat { public var x: CGFloat {
get { get {
return layer.frame.origin.x return frame.origin.x
} }
set(value) { set(value) {
layer.frame.origin.x = value frame.origin.x = value
} }
} }
...@@ -48,10 +67,10 @@ public class MaterialButton : UIButton { ...@@ -48,10 +67,10 @@ public class MaterialButton : UIButton {
*/ */
public var y: CGFloat { public var y: CGFloat {
get { get {
return layer.frame.origin.y return frame.origin.y
} }
set(value) { set(value) {
layer.frame.origin.y = value frame.origin.y = value
} }
} }
...@@ -60,10 +79,14 @@ public class MaterialButton : UIButton { ...@@ -60,10 +79,14 @@ public class MaterialButton : UIButton {
*/ */
public var width: CGFloat { public var width: CGFloat {
get { get {
return layer.frame.size.width return frame.size.width
} }
set(value) { set(value) {
layer.frame.size.width = value frame.size.width = value
if nil != shape {
frame.size.height = value
prepareShape()
}
} }
} }
...@@ -72,10 +95,14 @@ public class MaterialButton : UIButton { ...@@ -72,10 +95,14 @@ public class MaterialButton : UIButton {
*/ */
public var height: CGFloat { public var height: CGFloat {
get { get {
return layer.frame.size.height return frame.size.height
} }
set(value) { set(value) {
layer.frame.size.height = value frame.size.height = value
if nil != shape {
frame.size.width = value
prepareShape()
}
} }
} }
...@@ -84,7 +111,7 @@ public class MaterialButton : UIButton { ...@@ -84,7 +111,7 @@ public class MaterialButton : UIButton {
*/ */
public var shadowColor: UIColor! { public var shadowColor: UIColor! {
didSet { didSet {
layer.shadowColor = shadowColor.CGColor layer.shadowColor = nil == shadowColor ? MaterialColor.clear.CGColor : shadowColor!.CGColor
} }
} }
...@@ -93,7 +120,7 @@ public class MaterialButton : UIButton { ...@@ -93,7 +120,7 @@ public class MaterialButton : UIButton {
*/ */
public var shadowOffset: CGSize! { public var shadowOffset: CGSize! {
didSet { didSet {
layer.shadowOffset = shadowOffset layer.shadowOffset = nil == shadowOffset ? CGSizeMake(0, 0) : shadowOffset!
} }
} }
...@@ -102,7 +129,7 @@ public class MaterialButton : UIButton { ...@@ -102,7 +129,7 @@ public class MaterialButton : UIButton {
*/ */
public var shadowOpacity: Float! { public var shadowOpacity: Float! {
didSet { didSet {
layer.shadowOpacity = shadowOpacity layer.shadowOpacity = nil == shadowOpacity ? 0 : shadowOpacity!
} }
} }
...@@ -111,7 +138,7 @@ public class MaterialButton : UIButton { ...@@ -111,7 +138,7 @@ public class MaterialButton : UIButton {
*/ */
public var shadowRadius: CGFloat! { public var shadowRadius: CGFloat! {
didSet { didSet {
layer.shadowRadius = shadowRadius layer.shadowRadius = nil == shadowRadius ? 0 : shadowRadius!
} }
} }
...@@ -120,7 +147,7 @@ public class MaterialButton : UIButton { ...@@ -120,7 +147,7 @@ public class MaterialButton : UIButton {
*/ */
public var masksToBounds: Bool! { public var masksToBounds: Bool! {
didSet { didSet {
layer.masksToBounds = masksToBounds visualLayer.masksToBounds = nil == masksToBounds ? false : masksToBounds!
} }
} }
...@@ -129,7 +156,8 @@ public class MaterialButton : UIButton { ...@@ -129,7 +156,8 @@ public class MaterialButton : UIButton {
*/ */
public var cornerRadius: MaterialRadius! { public var cornerRadius: MaterialRadius! {
didSet { didSet {
layer.cornerRadius = MaterialRadiusToValue(cornerRadius!) visualLayer.cornerRadius = MaterialRadiusToValue(nil == cornerRadius ? .Radius0 : cornerRadius!)
shape = nil
} }
} }
...@@ -138,16 +166,13 @@ public class MaterialButton : UIButton { ...@@ -138,16 +166,13 @@ public class MaterialButton : UIButton {
*/ */
public var shape: MaterialShape? { public var shape: MaterialShape? {
didSet { didSet {
if width < height { if nil != shape {
width = height if width < height {
} else { frame.size.width = height
height = width } else {
} frame.size.height = width
switch shape! { }
case .Square: prepareShape()
layer.cornerRadius = 0
case .Circle:
layer.cornerRadius = width / 2
} }
} }
} }
...@@ -157,7 +182,7 @@ public class MaterialButton : UIButton { ...@@ -157,7 +182,7 @@ public class MaterialButton : UIButton {
*/ */
public var borderWidth: MaterialBorder! { public var borderWidth: MaterialBorder! {
didSet { didSet {
layer.borderWidth = MaterialBorderToValue(borderWidth) visualLayer.borderWidth = MaterialBorderToValue(nil == borderWidth ? .Border0 : borderWidth!)
} }
} }
...@@ -166,16 +191,16 @@ public class MaterialButton : UIButton { ...@@ -166,16 +191,16 @@ public class MaterialButton : UIButton {
*/ */
public var borderColor: UIColor! { public var borderColor: UIColor! {
didSet { didSet {
layer.borderColor = borderColor.CGColor visualLayer.borderColor = nil == borderColor ? MaterialColor.clear.CGColor : borderColor!.CGColor
} }
} }
/** /**
:name: shadowDepth :name: shadowDepth
*/ */
public var shadowDepth: MaterialShadow! { public var shadowDepth: MaterialDepth! {
didSet { didSet {
let value: MaterialShadowType = MaterialShadowToValue(shadowDepth) let value: MaterialDepthType = MaterialDepthToValue(shadowDepth!)
shadowOffset = value.offset shadowOffset = value.offset
shadowOpacity = value.opacity shadowOpacity = value.opacity
shadowRadius = value.radius shadowRadius = value.radius
...@@ -196,17 +221,12 @@ public class MaterialButton : UIButton { ...@@ -196,17 +221,12 @@ public class MaterialButton : UIButton {
*/ */
public var contentInsets: MaterialInsets! { public var contentInsets: MaterialInsets! {
didSet { didSet {
let value: MaterialInsetsType = MaterialInsetsToValue(contentInsets) let value: MaterialInsetsType = MaterialInsetsToValue(nil == contentInsets ? .Inset0 : contentInsets)
contentEdgeInsets = UIEdgeInsetsMake(value.top, value.left, value.bottom, value.right) contentEdgeInsets = UIEdgeInsetsMake(value.top, value.left, value.bottom, value.right)
} }
} }
/** /**
:name: pulseColor
*/
public var pulseColor: UIColor? = MaterialColor.white
/**
:name: init :name: init
*/ */
public required init?(coder aDecoder: NSCoder) { public required init?(coder aDecoder: NSCoder) {
...@@ -219,11 +239,27 @@ public class MaterialButton : UIButton { ...@@ -219,11 +239,27 @@ public class MaterialButton : UIButton {
public override init(frame: CGRect) { public override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
prepareView() prepareView()
prepareLayer()
} }
/**
:name: init
*/
public convenience init() { public convenience init() {
self.init(frame: CGRectZero) self.init(frame: CGRectMake(MaterialTheme.view.x, MaterialTheme.view.y, MaterialTheme.view.width, MaterialTheme.view.height))
}
/**
:name: layerClass
*/
public override class func layerClass() -> AnyClass {
return CAShapeLayer.self
}
/**
:name: layoutSubviews
*/
public override func layoutSubviews() {
super.layoutSubviews()
visualLayer.frame = bounds
} }
/** /**
...@@ -231,6 +267,25 @@ public class MaterialButton : UIButton { ...@@ -231,6 +267,25 @@ public class MaterialButton : UIButton {
*/ */
public override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) { public override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesBegan(touches, withEvent: event) super.touchesBegan(touches, withEvent: event)
let point: CGPoint = touches.first!.locationInView(self)
if nil != visualLayer.presentationLayer()?.hitTest(point) {
// set start position
CATransaction.begin()
CATransaction.setAnimationDuration(0)
let w: CGFloat = width / 2
pulseLayer.hidden = false
pulseLayer.position = point
pulseLayer.bounds = CGRectMake(0, 0, w, w)
pulseLayer.cornerRadius = CGFloat(w / 2)
CATransaction.commit()
// expand
CATransaction.begin()
CATransaction.setAnimationDuration(0.3)
pulseLayer.transform = CATransform3DMakeScale(2.5, 2.5, 2.5)
visualLayer.transform = CATransform3DMakeScale(1.05, 1.05, 1.05)
CATransaction.commit()
}
} }
/** /**
...@@ -238,6 +293,7 @@ public class MaterialButton : UIButton { ...@@ -238,6 +293,7 @@ public class MaterialButton : UIButton {
*/ */
public override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) { public override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesEnded(touches, withEvent: event) super.touchesEnded(touches, withEvent: event)
shrink()
} }
/** /**
...@@ -245,19 +301,38 @@ public class MaterialButton : UIButton { ...@@ -245,19 +301,38 @@ public class MaterialButton : UIButton {
*/ */
public override func touchesCancelled(touches: Set<UITouch>?, withEvent event: UIEvent?) { public override func touchesCancelled(touches: Set<UITouch>?, withEvent event: UIEvent?) {
super.touchesCancelled(touches, withEvent: event) super.touchesCancelled(touches, withEvent: event)
shrink()
} }
// //
// :name: prepareView // :name: prepareView
// //
internal func prepareView() { internal func prepareView() {
userInteractionEnabled = MaterialTheme.button.userInteractionEnabled // visualLayer
layer.addSublayer(visualLayer)
// pulseLayer
pulseLayer.hidden = true
visualLayer.insertSublayer(pulseLayer, atIndex: 1000)
} }
// //
// :name: prepareLayer // :name: prepareShape
// //
internal func prepareLayer() { internal func prepareShape() {
visualLayer.cornerRadius = .Square == shape ? 0 : width / 2
}
//
// :name: shrink
//
internal func shrink() {
// contract
CATransaction.begin()
CATransaction.setAnimationDuration(0.3)
pulseLayer.hidden = true
pulseLayer.transform = CATransform3DIdentity
visualLayer.transform = CATransform3DIdentity
CATransaction.commit()
} }
} }
\ No newline at end of file
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
import UIKit import UIKit
// color
public struct MaterialColor { public struct MaterialColor {
// clear // clear
public static let clear: UIColor = UIColor.clearColor() public static let clear: UIColor = UIColor.clearColor()
......
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
import UIKit import UIKit
public typealias MaterialShadowType = (offset: CGSize, opacity: Float, radius: CGFloat) public typealias MaterialDepthType = (offset: CGSize, opacity: Float, radius: CGFloat)
public enum MaterialShadow { public enum MaterialDepth {
case Depth0 case Depth0
case Depth1 case Depth1
case Depth2 case Depth2
...@@ -30,10 +30,10 @@ public enum MaterialShadow { ...@@ -30,10 +30,10 @@ public enum MaterialShadow {
} }
/** /**
:name: MaterialShadowToValue :name: MaterialDepthToValue
*/ */
public func MaterialShadowToValue(shadow: MaterialShadow) -> MaterialShadowType { public func MaterialDepthToValue(depth: MaterialDepth) -> MaterialDepthType {
switch shadow { switch depth {
case .Depth0: case .Depth0:
return (offset: CGSizeZero, opacity: 0, radius: 0) return (offset: CGSizeZero, opacity: 0, radius: 0)
case .Depth1: case .Depth1:
......
...@@ -18,9 +18,8 @@ ...@@ -18,9 +18,8 @@
import UIKit import UIKit
/** public typealias MaterialGravityType = String
:name: MaterialGravity
*/
public enum MaterialGravity { public enum MaterialGravity {
case Center case Center
case Top case Top
......
...@@ -26,7 +26,6 @@ public enum MaterialInsets { ...@@ -26,7 +26,6 @@ public enum MaterialInsets {
case Inset2 case Inset2
case Inset3 case Inset3
case Inset4 case Inset4
case Inset5
} }
/** /**
...@@ -41,10 +40,8 @@ public func MaterialInsetsToValue(inset: MaterialInsets) -> MaterialInsetsType { ...@@ -41,10 +40,8 @@ public func MaterialInsetsToValue(inset: MaterialInsets) -> MaterialInsetsType {
case .Inset2: case .Inset2:
return (top: 8, left: 8, bottom: 8, right: 8) return (top: 8, left: 8, bottom: 8, right: 8)
case .Inset3: case .Inset3:
return (top: 12, left: 12, bottom: 12, right: 12)
case .Inset4:
return (top: 16, left: 16, bottom: 16, right: 16) return (top: 16, left: 16, bottom: 16, right: 16)
case .Inset5: case .Inset4:
return (top: 20, left: 18, bottom: 20, right: 20) return (top: 32, left: 32, bottom: 32, right: 32)
} }
} }
...@@ -60,7 +60,7 @@ public class MaterialPulseView: MaterialView { ...@@ -60,7 +60,7 @@ public class MaterialPulseView: MaterialView {
// expand // expand
CATransaction.begin() CATransaction.begin()
CATransaction.setAnimationDuration(0.3) CATransaction.setAnimationDuration(0.3)
pulseLayer.transform = CATransform3DMakeScale(2, 2, 2) pulseLayer.transform = CATransform3DMakeScale(2.5, 2.5, 2.5)
visualLayer.transform = CATransform3DMakeScale(1.05, 1.05, 1.05) visualLayer.transform = CATransform3DMakeScale(1.05, 1.05, 1.05)
CATransaction.commit() CATransaction.commit()
} }
...@@ -71,13 +71,7 @@ public class MaterialPulseView: MaterialView { ...@@ -71,13 +71,7 @@ public class MaterialPulseView: MaterialView {
*/ */
public override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) { public override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesEnded(touches, withEvent: event) super.touchesEnded(touches, withEvent: event)
// contract shrink()
CATransaction.begin()
CATransaction.setAnimationDuration(0.3)
pulseLayer.hidden = true
pulseLayer.transform = CATransform3DIdentity
visualLayer.transform = CATransform3DIdentity
CATransaction.commit()
} }
/** /**
...@@ -85,6 +79,7 @@ public class MaterialPulseView: MaterialView { ...@@ -85,6 +79,7 @@ public class MaterialPulseView: MaterialView {
*/ */
public override func touchesCancelled(touches: Set<UITouch>?, withEvent event: UIEvent?) { public override func touchesCancelled(touches: Set<UITouch>?, withEvent event: UIEvent?) {
super.touchesCancelled(touches, withEvent: event) super.touchesCancelled(touches, withEvent: event)
shrink()
} }
// //
...@@ -95,13 +90,7 @@ public class MaterialPulseView: MaterialView { ...@@ -95,13 +90,7 @@ public class MaterialPulseView: MaterialView {
userInteractionEnabled = MaterialTheme.pulseView.userInteractionEnabled userInteractionEnabled = MaterialTheme.pulseView.userInteractionEnabled
backgroundColor = MaterialTheme.pulseView.backgroudColor backgroundColor = MaterialTheme.pulseView.backgroudColor
pulseColor = MaterialTheme.pulseView.pulseColor pulseColor = MaterialTheme.pulseView.pulseColor
}
//
// :name: prepareLayer
//
internal override func prepareLayer() {
super.prepareLayer()
contentsRect = MaterialTheme.pulseView.contentsRect contentsRect = MaterialTheme.pulseView.contentsRect
contentsCenter = MaterialTheme.pulseView.contentsCenter contentsCenter = MaterialTheme.pulseView.contentsCenter
contentsScale = MaterialTheme.pulseView.contentsScale contentsScale = MaterialTheme.pulseView.contentsScale
...@@ -118,4 +107,17 @@ public class MaterialPulseView: MaterialView { ...@@ -118,4 +107,17 @@ public class MaterialPulseView: MaterialView {
pulseLayer.hidden = true pulseLayer.hidden = true
visualLayer.insertSublayer(pulseLayer, atIndex: 1000) visualLayer.insertSublayer(pulseLayer, atIndex: 1000)
} }
//
// :name: shrink
//
internal func shrink() {
// contract
CATransaction.begin()
CATransaction.setAnimationDuration(0.3)
pulseLayer.hidden = true
pulseLayer.transform = CATransform3DIdentity
visualLayer.transform = CATransform3DIdentity
CATransaction.commit()
}
} }
...@@ -21,11 +21,11 @@ import UIKit ...@@ -21,11 +21,11 @@ import UIKit
public typealias MaterialRadiusType = CGFloat public typealias MaterialRadiusType = CGFloat
public enum MaterialRadius { public enum MaterialRadius {
case None case Radius0
case Light case Radius1
case Regular case Radius2
case Medium case Radius3
case Heavy case Radius4
} }
/** /**
...@@ -33,15 +33,15 @@ public enum MaterialRadius { ...@@ -33,15 +33,15 @@ public enum MaterialRadius {
*/ */
public func MaterialRadiusToValue(radius: MaterialRadius) -> MaterialRadiusType { public func MaterialRadiusToValue(radius: MaterialRadius) -> MaterialRadiusType {
switch radius { switch radius {
case .None: case .Radius0:
return 0 return 0
case .Light: case .Radius1:
return 4 return 4
case .Regular: case .Radius2:
return 8 return 8
case .Medium: case .Radius3:
return 16 return 16
case .Heavy: case .Radius4:
return 20 return 32
} }
} }
//
// 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
public typealias MaterialSizeType = CGFloat
public enum MaterialSize {
case Size0
case Size1
case Size2
case Size3
case Size4
}
/**
:name: MaterialSizeToValue
*/
public func MaterialSizeToValue(size: MaterialSize) -> MaterialSizeType {
switch size {
case .Size0:
return 0
case .Size1:
return 0.5
case .Size2:
return 1
case .Size3:
return 2
case .Size4:
return 3
}
}
...@@ -23,9 +23,9 @@ public struct MaterialTheme { ...@@ -23,9 +23,9 @@ public struct MaterialTheme {
public struct pulseView {} public struct pulseView {}
public struct navigation {} public struct navigation {}
public struct button { public struct button {
public struct fab {}
public struct flat {} public struct flat {}
public struct raised {} public struct raised {}
public struct fab {}
} }
} }
...@@ -38,15 +38,15 @@ public extension MaterialTheme.view { ...@@ -38,15 +38,15 @@ public extension MaterialTheme.view {
public static let height: CGFloat = UIScreen.mainScreen().bounds.height public static let height: CGFloat = UIScreen.mainScreen().bounds.height
// shadow // shadow
public static let shadowDepth: MaterialShadow = .Depth0 public static let shadowDepth: MaterialDepth = .Depth0
public static let shadowColor: UIColor = MaterialColor.black public static let shadowColor: UIColor = MaterialColor.black
// shape // shape
public static let masksToBounds: Bool = false public static let masksToBounds: Bool = false
public static let cornerRadius: MaterialRadius = .None public static let cornerRadius: MaterialRadius = .Radius0
// border // border
public static let borderWidth: MaterialBorder = .None public static let borderWidth: MaterialBorder = .Border0
public static let bordercolor: UIColor = MaterialColor.black public static let bordercolor: UIColor = MaterialColor.black
// color // color
...@@ -74,7 +74,7 @@ public extension MaterialTheme.pulseView { ...@@ -74,7 +74,7 @@ public extension MaterialTheme.pulseView {
public static let height: CGFloat = MaterialTheme.view.height public static let height: CGFloat = MaterialTheme.view.height
// shadow // shadow
public static let shadowDepth: MaterialShadow = MaterialTheme.view.shadowDepth public static let shadowDepth: MaterialDepth = MaterialTheme.view.shadowDepth
public static let shadowColor: UIColor = MaterialTheme.view.shadowColor public static let shadowColor: UIColor = MaterialTheme.view.shadowColor
// shape // shape
...@@ -111,7 +111,7 @@ public extension MaterialTheme.navigation { ...@@ -111,7 +111,7 @@ public extension MaterialTheme.navigation {
public static let height: CGFloat = 70 public static let height: CGFloat = 70
// shadow // shadow
public static let shadowDepth: MaterialShadow = .Depth1 public static let shadowDepth: MaterialDepth = .Depth1
public static let shadowColor: UIColor = MaterialTheme.view.shadowColor public static let shadowColor: UIColor = MaterialTheme.view.shadowColor
// shape // shape
...@@ -139,16 +139,17 @@ public extension MaterialTheme.navigation { ...@@ -139,16 +139,17 @@ public extension MaterialTheme.navigation {
public static let zPosition: CGFloat = 100 public static let zPosition: CGFloat = 100
} }
// button // button.flat
public extension MaterialTheme.button { public extension MaterialTheme.button.flat {
// shadow // shadow
public static let shadowDepth: MaterialShadow = .Depth0 public static let shadowDepth: MaterialDepth = .Depth0
public static let shadowColor: UIColor = MaterialTheme.view.shadowColor public static let shadowColor: UIColor = MaterialTheme.view.shadowColor
// shape // shape
public static let masksToBounds: Bool = MaterialTheme.view.masksToBounds public static let masksToBounds: Bool = true
public static let cornerRadius: MaterialRadius = .Light public static let cornerRadius: MaterialRadius = .Radius1
public static let contentInsets: MaterialInsets = .Inset2 public static let contentInsets: MaterialInsets = .Inset2
public static let shape: MaterialShape? = nil
// border // border
public static let borderWidth: MaterialBorder = MaterialTheme.view.borderWidth public static let borderWidth: MaterialBorder = MaterialTheme.view.borderWidth
...@@ -156,7 +157,8 @@ public extension MaterialTheme.button { ...@@ -156,7 +157,8 @@ public extension MaterialTheme.button {
// color // color
public static let backgroudColor: UIColor = MaterialColor.clear public static let backgroudColor: UIColor = MaterialColor.clear
public static let titleLabelColorForNormalState: UIColor = MaterialColor.blueGrey.darken4 public static let pulseColor: UIColor = MaterialColor.blue.accent3
public static let titleLabelColorForNormalState: UIColor = MaterialColor.blue.accent3
// interaction // interaction
public static let userInteractionEnabled: Bool = true public static let userInteractionEnabled: Bool = true
...@@ -168,41 +170,65 @@ public extension MaterialTheme.button { ...@@ -168,41 +170,65 @@ public extension MaterialTheme.button {
public static let titleLabelFont: UIFont = RobotoFont.regular public static let titleLabelFont: UIFont = RobotoFont.regular
} }
// button.flat // button.raised
public extension MaterialTheme.button.flat { public extension MaterialTheme.button.raised {
// shadow // shadow
public static let shadowDepth: MaterialShadow = MaterialTheme.button.shadowDepth public static let shadowDepth: MaterialDepth = .Depth2
public static let shadowColor: UIColor = MaterialTheme.button.shadowColor public static let shadowColor: UIColor = MaterialTheme.view.shadowColor
// shape // shape
public static let masksToBounds: Bool = MaterialTheme.button.masksToBounds public static let masksToBounds: Bool = true
public static let cornerRadius: MaterialRadius = MaterialTheme.button.cornerRadius public static let cornerRadius: MaterialRadius = .Radius1
public static let contentInsets: MaterialInsets = MaterialTheme.button.contentInsets public static let contentInsets: MaterialInsets = .Inset2
public static let shape: MaterialShape? = nil
// border // border
public static let borderWidth: MaterialBorder = MaterialTheme.button.borderWidth public static let borderWidth: MaterialBorder = MaterialTheme.view.borderWidth
public static let bordercolor: UIColor = MaterialTheme.button.bordercolor public static let bordercolor: UIColor = MaterialTheme.view.bordercolor
// color // color
public static let backgroudColor: UIColor = MaterialTheme.button.backgroudColor public static let backgroudColor: UIColor = MaterialColor.blue.accent3
public static let titleLabelColorForNormalState: UIColor = MaterialTheme.button.titleLabelColorForNormalState public static let pulseColor: UIColor = MaterialColor.white
public static let titleLabelColorForNormalState: UIColor = MaterialColor.white
// interaction // interaction
public static let userInteractionEnabled: Bool = MaterialTheme.button.userInteractionEnabled public static let userInteractionEnabled: Bool = true
// position // position
public static let zPosition: CGFloat = MaterialTheme.button.zPosition public static let zPosition: CGFloat = 200
// font // font
public static let titleLabelFont: UIFont = RobotoFont.regular public static let titleLabelFont: UIFont = RobotoFont.regular
} }
// button.fab // button.fab
public extension MaterialTheme.button.fab { public extension MaterialTheme.button.fab {
// shadow
public static let shadowDepth: MaterialDepth = .Depth2
public static let shadowColor: UIColor = MaterialTheme.view.shadowColor
} // shape
public static let masksToBounds: Bool = true
// button.raised public static let cornerRadius: MaterialRadius = .Radius0
public extension MaterialTheme.button.raised { public static let contentInsets: MaterialInsets = .Inset0
public static let shape: MaterialShape? = .Circle
// border
public static let borderWidth: MaterialBorder = MaterialTheme.view.borderWidth
public static let bordercolor: UIColor = MaterialTheme.view.bordercolor
// color
public static let backgroudColor: UIColor = MaterialColor.red.darken1
public static let pulseColor: UIColor = MaterialColor.white
public static let titleLabelColorForNormalState: UIColor = MaterialColor.white
// interaction
public static let userInteractionEnabled: Bool = true
// position
public static let zPosition: CGFloat = 200
// font
public static let titleLabelFont: UIFont = RobotoFont.regular
} }
...@@ -187,7 +187,7 @@ public class MaterialView: UIView { ...@@ -187,7 +187,7 @@ public class MaterialView: UIView {
*/ */
public var cornerRadius: MaterialRadius! { public var cornerRadius: MaterialRadius! {
didSet { didSet {
visualLayer.cornerRadius = MaterialRadiusToValue(nil == cornerRadius ? .None : cornerRadius!) visualLayer.cornerRadius = MaterialRadiusToValue(nil == cornerRadius ? .Radius0 : cornerRadius!)
shape = nil shape = nil
} }
} }
...@@ -213,7 +213,7 @@ public class MaterialView: UIView { ...@@ -213,7 +213,7 @@ public class MaterialView: UIView {
*/ */
public var borderWidth: MaterialBorder! { public var borderWidth: MaterialBorder! {
didSet { didSet {
visualLayer.borderWidth = MaterialBorderToValue(nil == borderWidth ? .None : borderWidth!) visualLayer.borderWidth = MaterialBorderToValue(nil == borderWidth ? .Border0 : borderWidth!)
} }
} }
...@@ -229,9 +229,9 @@ public class MaterialView: UIView { ...@@ -229,9 +229,9 @@ public class MaterialView: UIView {
/** /**
:name: shadowDepth :name: shadowDepth
*/ */
public var shadowDepth: MaterialShadow! { public var shadowDepth: MaterialDepth! {
didSet { didSet {
let value: MaterialShadowType = MaterialShadowToValue(shadowDepth!) let value: MaterialDepthType = MaterialDepthToValue(shadowDepth!)
shadowOffset = value.offset shadowOffset = value.offset
shadowOpacity = value.opacity shadowOpacity = value.opacity
shadowRadius = value.radius shadowRadius = value.radius
...@@ -260,7 +260,6 @@ public class MaterialView: UIView { ...@@ -260,7 +260,6 @@ public class MaterialView: UIView {
public override init(frame: CGRect) { public override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
prepareView() prepareView()
prepareLayer()
} }
/** /**
...@@ -291,12 +290,7 @@ public class MaterialView: UIView { ...@@ -291,12 +290,7 @@ public class MaterialView: UIView {
internal func prepareView() { internal func prepareView() {
userInteractionEnabled = MaterialTheme.view.userInteractionEnabled userInteractionEnabled = MaterialTheme.view.userInteractionEnabled
backgroundColor = MaterialTheme.view.backgroudColor backgroundColor = MaterialTheme.view.backgroudColor
}
//
// :name: prepareLayer
//
internal func prepareLayer() {
contentsRect = MaterialTheme.view.contentsRect contentsRect = MaterialTheme.view.contentsRect
contentsCenter = MaterialTheme.view.contentsCenter contentsCenter = MaterialTheme.view.contentsCenter
contentsScale = MaterialTheme.view.contentsScale contentsScale = MaterialTheme.view.contentsScale
......
...@@ -43,13 +43,7 @@ public class NavigationBarView: MaterialView { ...@@ -43,13 +43,7 @@ public class NavigationBarView: MaterialView {
userInteractionEnabled = MaterialTheme.navigation.userInteractionEnabled userInteractionEnabled = MaterialTheme.navigation.userInteractionEnabled
backgroundColor = MaterialTheme.navigation.backgroudColor backgroundColor = MaterialTheme.navigation.backgroudColor
lightContentStatusBar = MaterialTheme.navigation.lightContentStatusBar lightContentStatusBar = MaterialTheme.navigation.lightContentStatusBar
}
//
// :name: prepareLayer
//
internal override func prepareLayer() {
super.prepareLayer()
contentsRect = MaterialTheme.navigation.contentsRect contentsRect = MaterialTheme.navigation.contentsRect
contentsCenter = MaterialTheme.navigation.contentsCenter contentsCenter = MaterialTheme.navigation.contentsCenter
contentsScale = MaterialTheme.navigation.contentsScale contentsScale = MaterialTheme.navigation.contentsScale
......
//
// 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
public class RaisedButton : MaterialButton {
//
// :name: prepareView
//
internal override func prepareView() {
super.prepareView()
setTitleColor(MaterialTheme.button.raised.titleLabelColorForNormalState, forState: .Normal)
titleLabel!.font = MaterialTheme.button.raised.titleLabelFont
userInteractionEnabled = MaterialTheme.button.raised.userInteractionEnabled
backgroundColor = MaterialTheme.button.raised.backgroudColor
pulseColor = MaterialTheme.button.raised.pulseColor
shadowDepth = MaterialTheme.button.raised.shadowDepth
shadowColor = MaterialTheme.button.raised.shadowColor
zPosition = MaterialTheme.button.raised.zPosition
masksToBounds = MaterialTheme.button.raised.masksToBounds
cornerRadius = MaterialTheme.button.raised.cornerRadius
borderWidth = MaterialTheme.button.raised.borderWidth
borderColor = MaterialTheme.button.raised.bordercolor
contentInsets = MaterialTheme.button.raised.contentInsets
shape = MaterialTheme.button.raised.shape
}
}
\ No newline at end of file
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