Skip to content

Commit

Permalink
[UI] Make printer controls action more visible
Browse files Browse the repository at this point in the history
  • Loading branch information
josefdolezal committed Jun 6, 2017
1 parent 823980b commit ecf2d8d
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions OctoPhone/View Related/Controls/ControlsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,26 +132,38 @@ class ControlsView: UIView {

// MARK: Internal logic

private static func moveButton(icon: FontAwesomeIcon) -> UIButton {
private static func genericButton(icon: FontAwesomeIcon, normalColor: UIColor?,
tintColor: UIColor?) -> UIButton {

let button = UIButton(type: .custom)

button.layer.cornerRadius = 30
button.layer.masksToBounds = true
button.backgroundColor = normalColor

button.setIconImage(withIcon: icon, size: CGSize(width: 18, height: 18),
color: Colors.Pallete.greyHue4, forState: .normal)

button.reactive.controlEvents(.touchDown).observeValues { selectedButton in
selectedButton.backgroundColor = tintColor
}

button.reactive.controlEvents([.touchUpInside, .touchUpOutside]).observeValues { selectedButton in
selectedButton.backgroundColor = normalColor
}

button.snp.makeConstraints { make in
make.width.height.equalTo(60)
}

return button
}

private static func homeButton() -> UIButton {
let button = moveButton(icon: .homeIcon)

button.layer.cornerRadius = 30
button.layer.masksToBounds = true
button.backgroundColor = .white
private static func moveButton(icon: FontAwesomeIcon) -> UIButton {
return genericButton(icon: icon, normalColor: nil, tintColor: .white)
}

return button
private static func homeButton() -> UIButton {
return genericButton(icon: .homeIcon, normalColor: .white, tintColor: Colors.Pallete.greyHue3)
}
}

0 comments on commit ecf2d8d

Please sign in to comment.