Commit b84b24ab authored by Jose Blaya's avatar Jose Blaya
Browse files

Update UI in Redeem and PIAWelcome view controller

parent 49f3926f
......@@ -39,7 +39,7 @@ public class BorderedTextField: UITextField {
public var borderColor: UIColor? {
didSet {
if (!highlightsWhileEditing || !isEditing) {
viewBorder?.backgroundColor = borderColor
self.layer.borderColor = borderColor?.cgColor
}
reloadPlaceholder()
}
......@@ -49,7 +49,7 @@ public class BorderedTextField: UITextField {
public var highlightedBorderColor: UIColor? = .blue {
didSet {
if (highlightsWhileEditing && isEditing) {
viewBorder?.backgroundColor = highlightedBorderColor
self.layer.borderColor = highlightedBorderColor?.cgColor
}
}
}
......@@ -91,20 +91,12 @@ public class BorderedTextField: UITextField {
public override func willMove(toSuperview newSuperview: UIView?) {
super.willMove(toSuperview: newSuperview)
let border = UIView()
border.backgroundColor = borderColor
border.translatesAutoresizingMaskIntoConstraints = false
addSubview(border)
viewBorder = border
self.layer.cornerRadius = 6.0
self.layer.borderColor = borderColor?.cgColor
self.layer.borderWidth = 1
reloadPlaceholder()
NSLayoutConstraint.activate([
border.heightAnchor.constraint(equalToConstant: 0.5),
border.leftAnchor.constraint(equalTo: leftAnchor),
border.rightAnchor.constraint(equalTo: rightAnchor),
border.bottomAnchor.constraint(equalTo: bottomAnchor)
])
}
/// :nodoc:
......@@ -133,6 +125,16 @@ public class BorderedTextField: UITextField {
attributedPlaceholder = NSAttributedString(string: placeholder, attributes: attributes)
}
}
override public func textRect(forBounds bounds: CGRect) -> CGRect {
return UIEdgeInsetsInsetRect(bounds,
UIEdgeInsetsMake(0, 16, 0, 16))
}
override public func placeholderRect(forBounds bounds: CGRect) -> CGRect {
return UIEdgeInsetsInsetRect(bounds,
UIEdgeInsetsMake(0, 16, 0, 16))
}
}
// XXX: hack to inject self delegate
......@@ -164,7 +166,7 @@ extension BorderedTextField: UITextFieldDelegate {
public func textFieldDidBeginEditing(_ textField: UITextField) {
if highlightsWhileEditing {
viewBorder?.backgroundColor = highlightedBorderColor
self.layer.borderColor = highlightedBorderColor?.cgColor
}
if let method = realDelegate?.textFieldDidBeginEditing(_:) {
......@@ -173,7 +175,7 @@ extension BorderedTextField: UITextFieldDelegate {
}
public func textFieldDidEndEditing(_ textField: UITextField) {
viewBorder?.backgroundColor = borderColor
self.layer.borderColor = borderColor?.cgColor
if let method = realDelegate?.textFieldDidEndEditing(_:) {
return method(textField)
......
......@@ -497,8 +497,8 @@ public class Theme {
/// :nodoc:
public func applyInput(_ textField: UITextField) { // hint is placeholder
textField.font = typeface.regularFont(size: 14.0)
textField.textColor = palette.textColor(forRelevance: 1, appearance: .dark)
textField.style(style: TextStyle.textStyle8)
if let borderedTextField = textField as? BorderedTextField {
borderedTextField.borderColor = palette.divider
......
......@@ -190,6 +190,7 @@ public class PIAWelcomeViewController: AutolayoutViewController, WelcomeCompleti
public override func viewShouldRestyle() {
super.viewShouldRestyle()
navigationItem.titleView = NavigationLogoView()
Theme.current.applyLightBackground(view)
Theme.current.applyNavigationBarStyle(to: self)
Theme.current.applyCancelButton(buttonCancel, appearance: .dark)
buttonEnvironment.setTitleColor(buttonCancel.titleColor(for: .normal), for: .normal)
......
......@@ -46,7 +46,7 @@ class RedeemViewController: AutolayoutViewController, WelcomeChild {
@IBOutlet private weak var labelLogin2: UILabel!
@IBOutlet private weak var cameraButton: UIButton!
@IBOutlet private weak var cameraButton: PIAButton!
var preset: Preset?
......@@ -100,6 +100,8 @@ class RedeemViewController: AutolayoutViewController, WelcomeChild {
super.viewDidLoad()
labelSubtitle.textAlignment = .center
cameraButton.setRounded()
cameraButton.style(style: TextStyle.Buttons.piaPlainTextButton)
}
......@@ -239,7 +241,7 @@ class RedeemViewController: AutolayoutViewController, WelcomeChild {
override func viewShouldRestyle() {
super.viewShouldRestyle()
Theme.current.applyLightBackground(view)
Theme.current.applyTitle(labelTitle, appearance: .dark)
Theme.current.applySubtitle(labelSubtitle)
Theme.current.applyInput(textEmail)
......
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