Commit a5a35b4c by Daniel Dahan

issue-27: updated default colors

parent e991d1ff
......@@ -24,7 +24,7 @@ public class FlatButton : MaterialButton {
//
internal override func prepareView() {
super.prepareView()
setTitleColor(MaterialTheme.blue.darken1, forState: .Normal)
setTitleColor(MaterialTheme.blueGrey.darken1, forState: .Normal)
backgroundColor = MaterialTheme.clear.color
contentEdgeInsets = UIEdgeInsetsMake(4, 16, 4, 16)
}
......
......@@ -44,7 +44,7 @@ public class MaterialButton : UIButton {
/**
:name: pulseColor
*/
public var pulseColor: UIColor? = MaterialTheme.blue.lighten3
public var pulseColor: UIColor? = MaterialTheme.blueGrey.lighten3
/**
:name: init
......
......@@ -49,7 +49,7 @@ public class MaterialCardView : UIView {
/**
:name: pulseColor
*/
public var pulseColor: UIColor = MaterialTheme.blue.lighten3
public var pulseColor: UIColor = MaterialTheme.blueGrey.lighten3
/**
:name: init
......
......@@ -25,7 +25,7 @@ public class RaisedButton : MaterialButton {
internal override func prepareView() {
super.prepareView()
setTitleColor(MaterialTheme.white.color, forState: .Normal)
backgroundColor = MaterialTheme.blue.darken1
backgroundColor = MaterialTheme.blueGrey.darken1
contentEdgeInsets = UIEdgeInsetsMake(4, 16, 4, 16)
}
......
......@@ -57,12 +57,16 @@ public class TextView: UITextView {
*/
public var placeholderLabel: UILabel? {
didSet {
placeholderLabel!.setTranslatesAutoresizingMaskIntoConstraints(false)
placeholderLabel!.font = font
placeholderLabel!.textAlignment = textAlignment
placeholderLabel!.numberOfLines = 0
placeholderLabel!.backgroundColor = MaterialTheme.clear.color
addSubview(placeholderLabel!)
if let p = placeholderLabel {
p.setTranslatesAutoresizingMaskIntoConstraints(false)
p.font = font
p.textAlignment = textAlignment
p.numberOfLines = 0
p.backgroundColor = MaterialTheme.clear.color
addSubview(p)
updateLabelConstraints()
textViewTextDidChange()
}
}
}
......@@ -107,7 +111,9 @@ public class TextView: UITextView {
// :description: Updates the label visibility when text is empty or not.
//
internal func textViewTextDidChange() {
placeholderLabel?.hidden = !text.isEmpty
if let p = placeholderLabel {
p.hidden = !text.isEmpty
}
}
//
......@@ -118,7 +124,7 @@ public class TextView: UITextView {
// label needs to be added to the view
// hierarchy before setting insets
textContainerInset = UIEdgeInsetsMake(16, 16, 16, 16)
backgroundColor = MaterialTheme.clear.color
NSNotificationCenter.defaultCenter().addObserver(self, selector: "textViewTextDidChange", name: UITextViewTextDidChangeNotification, object: nil)
updateLabelConstraints()
}
......@@ -128,27 +134,26 @@ public class TextView: UITextView {
// :description: Updates the placeholder constraints.
//
private func updateLabelConstraints() {
if nil != placeholderLabel {
if let p = placeholderLabel {
NSLayoutConstraint.deactivateConstraints(layoutConstraints)
layoutConstraints = Layout.constraint("H:|-(left)-[placeholder]-(right)-|",
layoutConstraints = Layout.constraint("H:|-(left)-[placeholderLabel]-(right)-|",
options: nil,
metrics: [
"left": textContainerInset.left + textContainer.lineFragmentPadding,
"right": textContainerInset.right + textContainer.lineFragmentPadding
], views: [
"placeholder": placeholderLabel!
"placeholderLabel": p
])
layoutConstraints += Layout.constraint("V:|-(top)-[placeholder]-(>=bottom)-|",
layoutConstraints += Layout.constraint("V:|-(top)-[placeholderLabel]-(>=bottom)-|",
options: nil,
metrics: [
"top": textContainerInset.top,
"bottom": textContainerInset.bottom
],
views: [
"placeholder": placeholderLabel!
"placeholderLabel": p
])
NSLayoutConstraint.activateConstraints(layoutConstraints)
}
}
......
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