Commit 8eed8b5d by Daniel Dahan

issue-7: working on card interactivity

parent 676b31ec
...@@ -34,13 +34,12 @@ public class BasicCard : MaterialCard { ...@@ -34,13 +34,12 @@ public class BasicCard : MaterialCard {
prepareDetailTextLabel() prepareDetailTextLabel()
prepareHorizontalSeparator() prepareHorizontalSeparator()
prepareButtons() prepareButtons()
// super.constrainSubviews() addConstraints(Layout.constraint("H:|-(20)-[titleLabel]-(20)-|", options: nil, metrics: nil, views: ["titleLabel": titleLabel]))
// addConstraints(Layout.constraint("H:|-(20)-[titleLabel]-(20)-|", options: nil, metrics: nil, views: views)) addConstraints(Layout.constraint("H:|-(20)-[detailTextLabel]-(20)-|", options: nil, metrics: nil, views: ["detailTextLabel": detailTextLabel]))
// addConstraints(Layout.constraint("H:|-(20)-[detailTextLabel]-(20)-|", options: nil, metrics: nil, views: views)) addConstraints(Layout.constraint("H:|[horizontalSeparator]|", options: nil, metrics: nil, views: ["horizontalSeparator": horizontalSeparator]))
// addConstraints(Layout.constraint("H:|[horizontalSeparator]|", options: nil, metrics: nil, views: views)) addConstraints(Layout.constraint("H:|-(10)-[cancelButton(80)]-(10)-[otherButton(80)]", options: nil, metrics: nil, views: ["cancelButton": cancelButton, "otherButton": otherButton]))
// addConstraints(Layout.constraint("H:|-(10)-[cancelButton(80)]-(10)-[otherButton(80)]", options: nil, metrics: nil, views: views)) addConstraints(Layout.constraint("V:|-(20)-[titleLabel(22)]-(10)-[detailTextLabel]-(20)-[horizontalSeparator(1)]-(10)-[cancelButton]-(10)-|", options: nil, metrics: nil, views: ["titleLabel": titleLabel, "detailTextLabel": detailTextLabel, "horizontalSeparator": horizontalSeparator, "cancelButton": cancelButton, "otherButton": otherButton]))
// addConstraints(Layout.constraint("V:|-(20)-[titleLabel(22)]-(10)-[detailTextLabel]-(20)-[horizontalSeparator(1)]-(10)-[cancelButton]-(10)-|", options: nil, metrics: nil, views: views)) addConstraints(Layout.constraint("V:|-(20)-[titleLabel(22)]-(10)-[detailTextLabel]-(20)-[horizontalSeparator(1)]-(10)-[otherButton]-(10)-|", options: nil, metrics: nil, views: ["titleLabel": titleLabel, "detailTextLabel": detailTextLabel, "horizontalSeparator": horizontalSeparator, "otherButton": otherButton]))
// addConstraints(Layout.constraint("V:|-(20)-[titleLabel(22)]-(10)-[detailTextLabel]-(20)-[horizontalSeparator(1)]-(10)-[otherButton]-(10)-|", options: nil, metrics: nil, views: views))
} }
private func prepareTitleLabel() { private func prepareTitleLabel() {
...@@ -49,7 +48,6 @@ public class BasicCard : MaterialCard { ...@@ -49,7 +48,6 @@ public class BasicCard : MaterialCard {
titleLabel.textColor = UIColor.whiteColor() titleLabel.textColor = UIColor.whiteColor()
titleLabel.text = "Card Title" titleLabel.text = "Card Title"
addSubview(titleLabel) addSubview(titleLabel)
views["titleLabel"] = titleLabel
} }
private func prepareDetailTextLabel() { private func prepareDetailTextLabel() {
...@@ -60,7 +58,6 @@ public class BasicCard : MaterialCard { ...@@ -60,7 +58,6 @@ public class BasicCard : MaterialCard {
detailTextLabel.numberOfLines = 0 detailTextLabel.numberOfLines = 0
detailTextLabel.lineBreakMode = NSLineBreakMode.ByWordWrapping detailTextLabel.lineBreakMode = NSLineBreakMode.ByWordWrapping
addSubview(detailTextLabel) addSubview(detailTextLabel)
views["detailTextLabel"] = detailTextLabel
} }
private func prepareHorizontalSeparator() { private func prepareHorizontalSeparator() {
...@@ -68,7 +65,6 @@ public class BasicCard : MaterialCard { ...@@ -68,7 +65,6 @@ public class BasicCard : MaterialCard {
horizontalSeparator.backgroundColor = UIColor.whiteColor() horizontalSeparator.backgroundColor = UIColor.whiteColor()
horizontalSeparator.alpha = 0.2 horizontalSeparator.alpha = 0.2
addSubview(horizontalSeparator) addSubview(horizontalSeparator)
views["horizontalSeparator"] = horizontalSeparator
} }
private func prepareButtons() { private func prepareButtons() {
...@@ -82,7 +78,6 @@ public class BasicCard : MaterialCard { ...@@ -82,7 +78,6 @@ public class BasicCard : MaterialCard {
cancelButton.setTitleColor(buttonColor, forState: .Normal) cancelButton.setTitleColor(buttonColor, forState: .Normal)
cancelButton.pulseColor = buttonColor cancelButton.pulseColor = buttonColor
addSubview(cancelButton) addSubview(cancelButton)
views["cancelButton"] = cancelButton
} }
private func prepareOtherButton() { private func prepareOtherButton() {
...@@ -91,6 +86,5 @@ public class BasicCard : MaterialCard { ...@@ -91,6 +86,5 @@ public class BasicCard : MaterialCard {
otherButton.setTitleColor(buttonColor, forState: .Normal) otherButton.setTitleColor(buttonColor, forState: .Normal)
otherButton.pulseColor = buttonColor otherButton.pulseColor = buttonColor
addSubview(otherButton) addSubview(otherButton)
views["otherButton"] = otherButton
} }
} }
...@@ -24,9 +24,9 @@ public class FlatButton : MaterialButton { ...@@ -24,9 +24,9 @@ public class FlatButton : MaterialButton {
// //
internal override func prepareButton() { internal override func prepareButton() {
super.prepareButton() super.prepareButton()
setTitleColor(UIColor.purpleColor(), forState: .Normal) setTitleColor(MaterialTheme.indigo.darken1, forState: .Normal)
pulseColor = MaterialTheme.purple.darken1 pulseColor = MaterialTheme.indigo.darken1
backgroundColor = .clearColor() backgroundColor = MaterialTheme.clear.color
backgroundColorView.layer.cornerRadius = 3 backgroundColorView.layer.cornerRadius = 3
} }
......
...@@ -19,6 +19,11 @@ ...@@ -19,6 +19,11 @@
import UIKit import UIKit
public struct MaterialTheme { public struct MaterialTheme {
// clear
public struct clear {
public static let color: UIColor = UIColor.clearColor()
}
// white // white
public struct white { public struct white {
public static let color: UIColor = UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 1) public static let color: UIColor = UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 1)
......
...@@ -25,8 +25,8 @@ public class RaisedButton : MaterialButton { ...@@ -25,8 +25,8 @@ public class RaisedButton : MaterialButton {
internal override func prepareButton() { internal override func prepareButton() {
super.prepareButton() super.prepareButton()
prepareShadow() prepareShadow()
setTitleColor(UIColor.whiteColor(), forState: .Normal) setTitleColor(MaterialTheme.white.color, forState: .Normal)
backgroundColor = MaterialTheme.purple.darken1 backgroundColor = MaterialTheme.indigo.darken1
backgroundColorView.layer.cornerRadius = 3 backgroundColorView.layer.cornerRadius = 3
} }
......
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