Commit 8eed8b5d by Daniel Dahan

issue-7: working on card interactivity

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