Commit 63ce6b94 by Daniel Dahan

development: progression commit for HeightPreset and Bar height updates

parent 5c2d849d
......@@ -57,22 +57,25 @@ class ViewController: UIViewController {
private func prepareMenuButton() {
menuButton = IconButton(image: Icon.cm.menu, tintColor: .white)
menuButton.pulseColor = .white
}
private func prepareFavoriteButton() {
favoriteButton = IconButton(image: Icon.favorite, tintColor: .white)
favoriteButton.pulseColor = .white
}
private func prepareShareButton() {
shareButton = IconButton(image: Icon.cm.share, tintColor: .white)
shareButton.pulseColor = .white
}
private func prepareBar() {
bar = Bar(leftViews: [menuButton], rightViews: [favoriteButton, shareButton])
bar.backgroundColor = .blue.base
bar.backgroundColor = Color.blue.base
bar.contentView.cornerRadiusPreset = .cornerRadius1
bar.contentView.backgroundColor = .blue.lighten3
bar.contentView.backgroundColor = Color.blue.lighten3
view.layout(bar).horizontally().center()
}
......
......@@ -39,6 +39,6 @@ class AppBottomNavigationController: BottomNavigationController {
private func prepareTabBar() {
tabBar.depthPreset = .none
tabBar.dividerColor = .grey.lighten3
tabBar.dividerColor = Color.grey.lighten3
}
}
......@@ -39,12 +39,12 @@ class AudioViewController: UIViewController {
/// Prepare tabBarItem.
private func prepareTabBarItem() {
tabBarItem.image = Icon.cm.audioLibrary?.tint(with: .blueGrey.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = Icon.cm.audioLibrary?.tint(with: .blue.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.image = Icon.cm.audioLibrary?.tint(with: Color.blueGrey.base)
tabBarItem.selectedImage = Icon.cm.audioLibrary?.tint(with: Color.blue.base)
}
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .blue.base
view.backgroundColor = Color.blue.base
}
}
......@@ -39,12 +39,12 @@ class PhotoViewController: UIViewController {
/// Prepare tabBarItem.
private func prepareTabBarItem() {
tabBarItem.image = Icon.cm.photoCamera?.tint(with: .blueGrey.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = Icon.cm.photoCamera?.tint(with: .blue.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.image = Icon.cm.photoCamera?.tint(with: Color.blueGrey.base)
tabBarItem.selectedImage = Icon.cm.photoCamera?.tint(with: Color.blue.base)
}
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .red.base
view.backgroundColor = Color.red.base
}
}
......@@ -39,12 +39,12 @@ class RemindersViewController: UIViewController {
/// Prepare tabBarItem.
private func prepareTabBarItem() {
tabBarItem.image = Icon.cm.bell?.tint(with: .blueGrey.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = Icon.cm.bell?.tint(with: .blue.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.image = Icon.cm.bell?.tint(with: Color.blueGrey.base)
tabBarItem.selectedImage = Icon.cm.bell?.tint(with: Color.blue.base)
}
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .yellow.base
view.backgroundColor = Color.yellow.base
}
}
......@@ -39,12 +39,12 @@ class SearchViewController: UIViewController {
/// Prepare tabBarItem.
private func prepareTabBarItem() {
tabBarItem.image = Icon.cm.search?.tint(with: .blueGrey.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = Icon.cm.search?.tint(with: .blue.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.image = Icon.cm.search?.tint(with: Color.blueGrey.base)
tabBarItem.selectedImage = Icon.cm.search?.tint(with: Color.blue.base)
}
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .blueGrey.base
view.backgroundColor = Color.blueGrey.base
}
}
......@@ -39,12 +39,12 @@ class VideoViewController: UIViewController {
/// Prepare tabBarItem.
private func prepareTabBarItem() {
tabBarItem.image = Icon.cm.videocam?.tint(with: blueGrey.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = Icon.cm.videocam?.tint(with: blue.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.image = Icon.cm.videocam?.tint(with: Color.blueGrey.base)
tabBarItem.selectedImage = Icon.cm.videocam?.tint(with: Color.blue.base)
}
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = green.base
view.backgroundColor = Color.green.base
}
}
......@@ -58,7 +58,7 @@ struct ButtonLayout {
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = white
view.backgroundColor = .white
prepareFlatButton()
prepareRaisedButton()
......@@ -76,8 +76,9 @@ class ViewController: UIViewController {
}
private func prepareRaisedButton() {
let button = RaisedButton(title: "Raised Button", titleColor: white)
button.backgroundColor = blue.base
let button = RaisedButton(title: "Raised Button", titleColor: .white)
button.pulseColor = .white
button.backgroundColor = Color.blue.base
view.layout(button)
.width(ButtonLayout.Raised.width)
......@@ -86,7 +87,7 @@ class ViewController: UIViewController {
}
private func prepareFabButton() {
let button = FabButton(image: Icon.cm.add, tintColor: white)
let button = FabButton(image: Icon.cm.add, tintColor: .white)
view.layout(button)
.width(ButtonLayout.Fab.diameter)
......
......@@ -42,7 +42,7 @@ class AppCaptureController: CaptureController {
private func prepareToolbar() {
toolbar.titleLabel.isHidden = true
toolbar.titleLabel.textColor = white
toolbar.titleLabel.textColor = .white
toolbar.detailLabel.isHidden = true
toolbar.detail = "Recording"
......@@ -56,7 +56,7 @@ class AppCaptureController: CaptureController {
captureButton.width = 72
captureButton.height = 72
captureButton.backgroundColor = red.darken1.withAlphaComponent(0.3)
captureButton.borderColor = white
captureButton.borderColor = .white
captureButton.borderWidthPreset = .border3
captureButton.depthPreset = .none
}
......
......@@ -136,7 +136,7 @@ extension ViewController: CaptureDelegate {
}
public func captureDidPressCameraButton(capture: Capture, button: UIButton) {
// captureButton.backgroundColor = blue.darken1.withAlphaComponent(0.3)
// captureButton.backgroundColor = Color.blue.darken1.withAlphaComponent(0.3)
}
public func captureDidPressVideoButton(capture: Capture, button: UIButton) {
......
......@@ -50,7 +50,7 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = grey.lighten5
view.backgroundColor = Color.grey.lighten5
prepareDateFormatter()
prepareDateLabel()
......@@ -71,16 +71,16 @@ class ViewController: UIViewController {
private func prepareDateLabel() {
dateLabel = UILabel()
dateLabel.font = RobotoFont.regular(with: 12)
dateLabel.textColor = blueGrey.base
dateLabel.textColor = Color.blueGrey.base
dateLabel.text = dateFormatter.string(from: Date.distantFuture)
}
private func prepareFavoriteButton() {
favoriteButton = IconButton(image: Icon.favorite, tintColor: red.base)
favoriteButton = IconButton(image: Icon.favorite, tintColor: Color.red.base)
}
private func prepareMoreButton() {
moreButton = IconButton(image: Icon.cm.moreVertical, tintColor: blueGrey.base)
moreButton = IconButton(image: Icon.cm.moreVertical, tintColor: Color.blueGrey.base)
}
private func prepareAuthorView() {
......@@ -97,7 +97,7 @@ class ViewController: UIViewController {
toolbar.detail = "Build Beautiful Software"
toolbar.detailLabel.textAlignment = .left
toolbar.detailLabel.textColor = blueGrey.base
toolbar.detailLabel.textColor = Color.blueGrey.base
}
private func prepareContentView() {
......
......@@ -50,7 +50,7 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = grey.lighten5
view.backgroundColor = Color.grey.lighten5
prepareImageView()
prepareFavoriteButton()
......@@ -70,19 +70,19 @@ class ViewController: UIViewController {
}
private func prepareFavoriteButton() {
favoriteButton = FlatButton(image: Icon.favorite, tintColor: blueGrey.base)
favoriteButton = FlatButton(image: Icon.favorite, tintColor: Color.blueGrey.base)
}
private func prepareShareButton() {
shareButton = FlatButton(image: Icon.cm.share, tintColor: blueGrey.base)
shareButton = FlatButton(image: Icon.cm.share, tintColor: Color.blueGrey.base)
}
private func prepareStarButton() {
starButton = FlatButton(image: Icon.cm.star, tintColor: blueGrey.base)
starButton = FlatButton(image: Icon.cm.star, tintColor: Color.blueGrey.base)
}
private func prepareMoreButton() {
moreButton = IconButton(image: Icon.cm.moreHorizontal, tintColor: white)
moreButton = IconButton(image: Icon.cm.moreHorizontal, tintColor: .white)
}
private func prepareToolbar() {
......@@ -90,10 +90,10 @@ class ViewController: UIViewController {
toolbar.backgroundColor = nil
toolbar.title = "CosmicMind"
toolbar.titleLabel.textColor = white
toolbar.titleLabel.textColor = .white
toolbar.detail = "Build Beautiful Software"
toolbar.detailLabel.textColor = white
toolbar.detailLabel.textColor = .white
}
private func prepareContentView() {
......
......@@ -37,7 +37,7 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = white
view.backgroundColor = .white
prepareLayer()
}
......@@ -50,7 +50,7 @@ class ViewController: UIViewController {
layer = Layer(frame: CGRect(x: (w - d) / 2, y: (h - d) / 2, width: d, height: d))
layer.depthPreset = .depth3
layer.shapePreset = .circle
layer.backgroundColor = white.cgColor
layer.backgroundColor = Color.white.cgColor
layer.image = UIImage(named: "CosmicMind")
view.layer.addSublayer(layer)
......
......@@ -38,7 +38,7 @@ class AppMenuController: MenuController {
open override func prepare() {
super.prepare()
view.backgroundColor = grey.lighten5
view.backgroundColor = Color.grey.lighten5
prepareMenu()
}
......
......@@ -38,7 +38,7 @@ class RootViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = grey.lighten5
view.backgroundColor = Color.grey.lighten5
prepareAddButton()
prepareAudioLibraryButton()
......@@ -69,14 +69,14 @@ class RootViewController: UIViewController {
}
private func prepareAddButton() {
addButton = FabButton(image: Icon.cm.add, tintColor: white)
addButton = FabButton(image: Icon.cm.add)
addButton.addTarget(self, action: #selector(handleToggleMenu), for: .touchUpInside)
}
private func prepareAudioLibraryButton() {
audioLibraryMenuItem = MenuItem()
audioLibraryMenuItem.button.image = Icon.cm.audioLibrary
audioLibraryMenuItem.button.backgroundColor = green.base
audioLibraryMenuItem.button.backgroundColor = Color.green.base
audioLibraryMenuItem.button.depthPreset = .depth1
audioLibraryMenuItem.title = "Audio Library"
}
......@@ -84,7 +84,7 @@ class RootViewController: UIViewController {
private func prepareBellButton() {
reminderMenuItem = MenuItem()
reminderMenuItem.button.image = Icon.cm.bell
reminderMenuItem.button.backgroundColor = blue.base
reminderMenuItem.button.backgroundColor = Color.blue.base
reminderMenuItem.title = "Reminders"
}
......
......@@ -34,8 +34,12 @@ import Material
class AppNavigationController: NavigationController {
open override func prepare() {
super.prepare()
guard let v = navigationBar as? NavigationBar else {
return
}
statusBarStyle = .lightContent
(navigationBar as? NavigationBar)?.backgroundColor = blue.base
v.backgroundColor = Color.blue.base
}
}
......@@ -34,19 +34,19 @@ import Material
class NextViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = white
view.backgroundColor = .white
prepareNavigationItem()
}
private func prepareNavigationItem() {
navigationItem.title = "Title"
navigationItem.titleLabel.textColor = white
navigationItem.titleLabel.textColor = .white
navigationItem.detail = "Detail Description"
navigationItem.detailLabel.textColor = lightBlue.lighten5
navigationItem.detailLabel.textColor = Color.lightBlue.lighten5
navigationItem.backButton.tintColor = white
navigationItem.backButton.tintColor = .white
}
}
......@@ -42,7 +42,7 @@ class RootViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = grey.lighten5
view.backgroundColor = Color.grey.lighten5
prepareMenuButton()
prepareStarButton()
......@@ -56,23 +56,26 @@ class RootViewController: UIViewController {
}
private func prepareMenuButton() {
menuButton = IconButton(image: Icon.cm.menu, tintColor: white)
menuButton = IconButton(image: Icon.cm.menu, tintColor: .white)
menuButton.pulseColor = .white
}
private func prepareStarButton() {
starButton = IconButton(image: Icon.cm.star, tintColor: white)
starButton = IconButton(image: Icon.cm.star, tintColor: .white)
starButton.pulseColor = .white
}
private func prepareSearchButton() {
searchButton = IconButton(image: Icon.cm.search, tintColor: white)
searchButton = IconButton(image: Icon.cm.search, tintColor: .white)
searchButton.pulseColor = .white
}
private func prepareNavigationItem() {
navigationItem.title = "Material"
navigationItem.titleLabel.textColor = white
navigationItem.titleLabel.textColor = .white
navigationItem.detail = "Build Beautiful Software"
navigationItem.detailLabel.textColor = lightBlue.lighten5
navigationItem.detailLabel.textColor = Color.lightBlue.lighten5
navigationItem.leftViews = [menuButton]
navigationItem.rightViews = [starButton, searchButton]
......
......@@ -36,7 +36,7 @@ class LeftViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = blue.base
view.backgroundColor = Color.blue.base
prepareTransitionButton()
}
......@@ -55,7 +55,7 @@ class LeftViewController: UIViewController {
}
private func prepareTransitionButton() {
transitionButton = FlatButton(title: "Transition VC", titleColor: white)
transitionButton = FlatButton(title: "Transition VC", titleColor: .white)
transitionButton.addTarget(self, action: #selector(handleTransitionButton), for: .touchUpInside)
view.layout(transitionButton).horizontally().center()
......
......@@ -36,7 +36,7 @@ class RightViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = blue.base
view.backgroundColor = Color.blue.base
prepareRootButton()
}
......@@ -55,7 +55,7 @@ class RightViewController: UIViewController {
}
private func prepareRootButton() {
rootButton = FlatButton(title: "Root VC", titleColor: white)
rootButton = FlatButton(title: "Root VC", titleColor: .white)
rootButton.addTarget(self, action: #selector(handleTransitionButton), for: .touchUpInside)
view.layout(rootButton).horizontally().center()
......
......@@ -34,7 +34,7 @@ import Material
class RootViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = white
view.backgroundColor = .white
prepareToolbar()
}
......
......@@ -34,7 +34,7 @@ import Material
class TransitionedViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = purple.base
view.backgroundColor = Color.purple.base
prepareToolbar()
}
......
......@@ -40,8 +40,8 @@ class AppPageTabBarController: PageTabBarController {
}
private func preparePageTabBar() {
pageTabBar.lineColor = blueGrey.base
pageTabBar.dividerColor = blueGrey.lighten5
pageTabBar.lineColor = Color.blueGrey.base
pageTabBar.dividerColor = Color.blueGrey.lighten5
}
}
......
......@@ -44,12 +44,12 @@ class BlueViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = blue.base
view.backgroundColor = Color.blue.base
}
private func preparePageTabBarItem() {
pageTabBarItem.title = "Blue"
pageTabBarItem.titleColor = blueGrey.base
pageTabBarItem.titleColor = Color.blueGrey.base
}
}
......@@ -44,12 +44,12 @@ class GreenViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = green.base
view.backgroundColor = Color.green.base
}
private func preparePageTabBarItem() {
pageTabBarItem.title = "Green"
pageTabBarItem.titleColor = blueGrey.base
pageTabBarItem.titleColor = Color.blueGrey.base
}
}
......@@ -44,12 +44,12 @@ class RedViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = red.base
view.backgroundColor = Color.red.base
}
private func preparePageTabBarItem() {
pageTabBarItem.title = "Red"
pageTabBarItem.titleColor = blueGrey.base
pageTabBarItem.titleColor = Color.blueGrey.base
}
}
......@@ -42,6 +42,6 @@ class AppToolbarController: ToolbarController {
private func prepareToolbar() {
toolbar.title = "Photo Library"
toolbar.depthPreset = .none
toolbar.dividerColor = grey.lighten3
toolbar.dividerColor = Color.grey.lighten3
}
}
......@@ -50,7 +50,7 @@ class PhotoLibraryCollectionReusableView: CollectionReusableView {
toolbar.contentEdgeInsets.left = 16
toolbar.contentEdgeInsets.right = 16
toolbar.depthPreset = .none
toolbar.dividerColor = grey.lighten3
toolbar.dividerColor = Color.grey.lighten3
layout(toolbar).edges()
}
}
......@@ -73,7 +73,7 @@ class PhotoLibraryViewController: PhotoLibraryController {
open override func prepare() {
super.prepare()
view.backgroundColor = grey.lighten5
view.backgroundColor = Color.grey.lighten5
prepareCollectionView()
......
......@@ -51,7 +51,7 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = grey.lighten5
view.backgroundColor = Color.grey.lighten5
preparePresenterView()
prepareDateFormatter()
......@@ -79,21 +79,21 @@ class ViewController: UIViewController {
private func prepareDateLabel() {
dateLabel = UILabel()
dateLabel.font = RobotoFont.regular(with: 12)
dateLabel.textColor = blueGrey.base
dateLabel.textColor = Color.blueGrey.base
dateLabel.textAlignment = .center
dateLabel.text = dateFormatter.string(from: Date.distantFuture)
}
private func prepareFavoriteButton() {
favoriteButton = IconButton(image: Icon.favorite, tintColor: red.base)
favoriteButton = IconButton(image: Icon.favorite, tintColor: Color.red.base)
}
private func prepareShareButton() {
shareButton = IconButton(image: Icon.cm.share, tintColor: blueGrey.base)
shareButton = IconButton(image: Icon.cm.share, tintColor: Color.blueGrey.base)
}
private func prepareMoreButton() {
moreButton = IconButton(image: Icon.cm.moreHorizontal, tintColor: blueGrey.base)
moreButton = IconButton(image: Icon.cm.moreHorizontal, tintColor: Color.blueGrey.base)
}
private func prepareToolbar() {
......@@ -104,7 +104,7 @@ class ViewController: UIViewController {
toolbar.detail = "Build Beautiful Software"
toolbar.detailLabel.textAlignment = .left
toolbar.detailLabel.textColor = blueGrey.base
toolbar.detailLabel.textColor = Color.blueGrey.base
}
private func prepareContentView() {
......
......@@ -37,7 +37,7 @@ class RootViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = grey.lighten1
view.backgroundColor = Color.grey.lighten1
}
open override func viewWillAppear(_ animated: Bool) {
......
......@@ -36,7 +36,7 @@ class RootViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = grey.lighten5
view.backgroundColor = Color.grey.lighten5
}
open override func viewDidAppear(_ animated: Bool) {
......@@ -49,7 +49,7 @@ class RootViewController: UIViewController {
}
private func prepareUndoButton() {
undoButton = FlatButton(title: "Undo", titleColor: yellow.base)
undoButton = FlatButton(title: "Undo", titleColor: Color.yellow.base)
undoButton.pulseAnimation = .backing
undoButton.titleLabel?.font = snackbarController?.snackbar.textLabel.font
}
......
......@@ -34,7 +34,7 @@ import Material
class RootViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = grey.lighten1
view.backgroundColor = Color.grey.lighten1
}
}
......@@ -35,7 +35,7 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = white
view.backgroundColor = .white
prepareSwitch()
}
......
......@@ -40,22 +40,22 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = white
view.backgroundColor = .white
prepareButtons()
prepareTabBar()
}
private func prepareButtons() {
let btn1 = FlatButton(title: "Library", titleColor: blueGrey.base)
let btn1 = FlatButton(title: "Library", titleColor: Color.blueGrey.base)
btn1.pulseAnimation = .none
buttons.append(btn1)
let btn2 = FlatButton(title: "Photo", titleColor: blueGrey.base)
let btn2 = FlatButton(title: "Photo", titleColor: Color.blueGrey.base)
btn2.pulseAnimation = .none
buttons.append(btn2)
let btn3 = FlatButton(title: "Video", titleColor: blueGrey.base)
let btn3 = FlatButton(title: "Video", titleColor: Color.blueGrey.base)
btn3.pulseAnimation = .none
buttons.append(btn3)
}
......@@ -63,13 +63,13 @@ class ViewController: UIViewController {
private func prepareTabBar() {
tabBar = TabBar()
tabBar.dividerColor = grey.lighten3
tabBar.dividerColor = Color.grey.lighten3
tabBar.dividerAlignment = .top
tabBar.lineColor = blue.base
tabBar.lineColor = Color.blue.base
tabBar.lineAlignment = .top
tabBar.backgroundColor = grey.lighten5
tabBar.backgroundColor = Color.grey.lighten5
tabBar.buttons = buttons
view.layout(tabBar).horizontally().bottom()
......
......@@ -38,7 +38,7 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = white
view.backgroundColor = .white
prepareNameField()
prepareEmailField()
......@@ -53,7 +53,7 @@ class ViewController: UIViewController {
/// Prepares the resign responder button.
private func prepareResignResponderButton() {
let btn = RaisedButton(title: "Resign", titleColor: blue.base)
let btn = RaisedButton(title: "Resign", titleColor: Color.blue.base)
btn.addTarget(self, action: #selector(handleResignResponderButton(button:)), for: .touchUpInside)
view.layout(btn).width(100).height(50).bottom(24).right(24)
......@@ -102,7 +102,7 @@ class ViewController: UIViewController {
passwordField.isVisibilityIconButtonEnabled = true
// Setting the visibilityIconButton color.
passwordField.visibilityIconButton?.tintColor = green.base.withAlphaComponent(passwordField.isSecureTextEntry ? 0.38 : 0.54)
passwordField.visibilityIconButton?.tintColor = Color.green.base.withAlphaComponent(passwordField.isSecureTextEntry ? 0.38 : 0.54)
// Size the TextField to the maximum width, less 40 pixels on either side
// with a top margin of 200 pixels.
......
......@@ -35,6 +35,8 @@ class AppToolbarController: ToolbarController {
open override func prepare() {
super.prepare()
statusBarStyle = .default
// toolbar.heightPreset = .large
toolbar.height = 100
}
}
......@@ -38,7 +38,7 @@ class RootViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = white
view.backgroundColor = .white
}
open override func viewWillAppear(_ animated: Bool) {
......
......@@ -37,7 +37,7 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = white
view.backgroundColor = .white
prepareLogo()
}
......@@ -48,7 +48,7 @@ class ViewController: UIViewController {
logo = View()
logo.depthPreset = .depth3
logo.shapePreset = .circle
logo.backgroundColor = white
logo.backgroundColor = .white
logo.image = UIImage(named: "CosmicMind")
view.layout(logo).width(d).height(d).center()
......
......@@ -44,7 +44,7 @@ class AudioViewController: UIViewController {
private func prepareTabBarItem() {
tabBarItem.title = nil
tabBarItem.image = Icon.cm.audioLibrary?.tint(with: .blueGrey.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = Icon.cm.audioLibrary?.tint(with: .blue.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.image = Icon.cm.audioLibrary?.tint(with: .blueGrey.base)
tabBarItem.selectedImage = Icon.cm.audioLibrary?.tint(with: .blue.base)
}
}
......@@ -44,7 +44,7 @@ class PhotoViewController: UIViewController {
private func prepareTabBarItem() {
tabBarItem.title = nil
tabBarItem.image = Icon.cm.photoCamera?.tint(with: .blueGrey.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = Icon.cm.photoCamera?.tint(with: .blue.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.image = Icon.cm.photoCamera?.tint(with: .blueGrey.base)
tabBarItem.selectedImage = Icon.cm.photoCamera?.tint(with: .blue.base)
}
}
......@@ -44,7 +44,7 @@ class RemindersViewController: UIViewController {
private func prepareTabBarItem() {
tabBarItem.title = nil
tabBarItem.image = Icon.cm.bell?.tint(with: .blueGrey.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = Icon.cm.bell?.tint(with: .blue.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.image = Icon.cm.bell?.tint(with: .blueGrey.base)
tabBarItem.selectedImage = Icon.cm.bell?.tint(with: .blue.base)
}
}
......@@ -44,7 +44,7 @@ class SearchViewController: UIViewController {
private func prepareTabBarItem() {
tabBarItem.title = nil
tabBarItem.image = Icon.cm.search?.tint(with: .blueGrey.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = Icon.cm.search?.tint(with: .blue.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.image = Icon.cm.search?.tint(with: .blueGrey.base)
tabBarItem.selectedImage = Icon.cm.search?.tint(with: .blue.base)
}
}
......@@ -39,12 +39,12 @@ class VideoViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = green.base
view.backgroundColor = Color.green.base
}
private func prepareTabBarItem() {
tabBarItem.title = nil
tabBarItem.image = Icon.cm.videocam?.tint(with: blueGrey.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = Icon.cm.videocam?.tint(with: blue.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.image = Icon.cm.videocam?.tint(with: Color.blueGrey.base)
tabBarItem.selectedImage = Icon.cm.videocam?.tint(with: Color.blue.base)
}
}
......@@ -47,7 +47,7 @@ class ViewController: UIViewController {
private func prepareIconButton() {
iconButton.image = Icon.search
iconButton.pulseColor = blue.base
iconButton.pulseColor = Color.blue.base
}
}
......
......@@ -34,7 +34,7 @@ import Material
class NextViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = grey.base
view.backgroundColor = Color.grey.base
prepareNavigationItem()
}
......@@ -43,7 +43,7 @@ class NextViewController: UIViewController {
navigationItem.title = "Title"
navigationItem.detail = "Detail Description"
navigationItem.backButton.tintColor = blue.base
navigationItem.backButton.tintColor = Color.blue.base
}
}
......@@ -42,7 +42,7 @@ class RootViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = grey.lighten1
view.backgroundColor = Color.grey.lighten1
prepareMenuButton()
prepareStarButton()
......
......@@ -34,6 +34,6 @@ import Material
class LeftViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = blue.base
view.backgroundColor = Color.blue.base
}
}
......@@ -34,6 +34,6 @@ import Material
class RightViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = blue.base
view.backgroundColor = Color.blue.base
}
}
......@@ -40,7 +40,7 @@ class AppPageTabBarController: PageTabBarController {
}
private func preparePageTabBar() {
pageTabBar.lineColor = grey.darken1
pageTabBar.lineColor = Color.grey.darken1
}
}
......
......@@ -44,12 +44,12 @@ class BlueViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = blue.base
view.backgroundColor = Color.blue.base
}
private func preparePageTabBarItem() {
pageTabBarItem.title = "Blue"
pageTabBarItem.titleColor = blueGrey.base
pageTabBarItem.titleColor = Color.blueGrey.base
}
}
......@@ -44,12 +44,12 @@ class GreenViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = green.base
view.backgroundColor = Color.green.base
}
private func preparePageTabBarItem() {
pageTabBarItem.title = "Green"
pageTabBarItem.titleColor = blueGrey.base
pageTabBarItem.titleColor = Color.blueGrey.base
}
}
......@@ -44,12 +44,12 @@ class RedViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = red.base
view.backgroundColor = Color.red.base
}
private func preparePageTabBarItem() {
pageTabBarItem.title = "Red"
pageTabBarItem.titleColor = blueGrey.base
pageTabBarItem.titleColor = Color.blueGrey.base
}
}
......@@ -37,7 +37,7 @@ class RootViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = grey.lighten1
view.backgroundColor = Color.grey.lighten1
}
open override func viewWillAppear(_ animated: Bool) {
......
......@@ -36,7 +36,7 @@ class RootViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = grey.lighten5
view.backgroundColor = Color.grey.lighten5
}
open override func viewDidAppear(_ animated: Bool) {
......@@ -49,7 +49,7 @@ class RootViewController: UIViewController {
}
private func prepareUndoButton() {
undoButton = FlatButton(title: "Undo", titleColor: yellow.base)
undoButton = FlatButton(title: "Undo", titleColor: Color.yellow.base)
undoButton.pulseAnimation = .backing
undoButton.titleLabel?.font = snackbarController?.snackbar.textLabel.font
}
......
......@@ -34,7 +34,7 @@ import Material
class RootViewController: UIViewController {
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = grey.lighten5
view.backgroundColor = Color.grey.lighten5
}
}
......@@ -12,6 +12,7 @@
96230AB81D6A520C00AF47DC /* Divider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96230AB71D6A520C00AF47DC /* Divider.swift */; };
9626CA971DAB53A8003E2611 /* Display.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9626CA961DAB53A8003E2611 /* Display.swift */; };
9626CA9E1DAB55B8003E2611 /* CaptureController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9626CA9D1DAB55B8003E2611 /* CaptureController.swift */; };
9626CB9B1DAD3D1D003E2611 /* HeightPreset.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9626CB9A1DAD3D1D003E2611 /* HeightPreset.swift */; };
9628645A1D53FE3E00690B69 /* Material+UIWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 962864591D53FE3E00690B69 /* Material+UIWindow.swift */; };
9628645F1D540AF300690B69 /* DynamicFontType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9628645E1D540AF300690B69 /* DynamicFontType.swift */; };
9631A7C11D95E3AC00CFB109 /* PresenterCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9631A7C01D95E3AC00CFB109 /* PresenterCard.swift */; };
......@@ -213,6 +214,7 @@
96230AB71D6A520C00AF47DC /* Divider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Divider.swift; sourceTree = "<group>"; };
9626CA961DAB53A8003E2611 /* Display.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Display.swift; sourceTree = "<group>"; };
9626CA9D1DAB55B8003E2611 /* CaptureController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CaptureController.swift; sourceTree = "<group>"; };
9626CB9A1DAD3D1D003E2611 /* HeightPreset.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeightPreset.swift; sourceTree = "<group>"; };
962864591D53FE3E00690B69 /* Material+UIWindow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Material+UIWindow.swift"; sourceTree = "<group>"; };
9628645E1D540AF300690B69 /* DynamicFontType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DynamicFontType.swift; sourceTree = "<group>"; };
9631A7C01D95E3AC00CFB109 /* PresenterCard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PresenterCard.swift; sourceTree = "<group>"; };
......@@ -385,6 +387,14 @@
name = Root;
sourceTree = "<group>";
};
9626CBCC1DADA5F1003E2611 /* Height */ = {
isa = PBXGroup;
children = (
9626CB9A1DAD3D1D003E2611 /* HeightPreset.swift */,
);
name = Height;
sourceTree = "<group>";
};
962DDD071D6FBBB7001C307C /* Page */ = {
isa = PBXGroup;
children = (
......@@ -542,6 +552,7 @@
96BCB80A1CB410A100C806FE /* Extension */,
96BCB8071CB4101C00C806FE /* Font */,
9602F00C1DA1163000F3FB79 /* Grid */,
9626CBCC1DADA5F1003E2611 /* Height */,
96BCB8081CB4105E00C806FE /* Icon */,
96BCB80D1CB410FD00C806FE /* Layer */,
96BCB8041CB40F6C00C806FE /* Layout */,
......@@ -1074,6 +1085,7 @@
96BCB7C71CB40DC500C806FE /* KeyframeAnimation.swift in Sources */,
96BCB7BE1CB40DC500C806FE /* CollectionViewLayout.swift in Sources */,
96BCB7BF1CB40DC500C806FE /* Color.swift in Sources */,
9626CB9B1DAD3D1D003E2611 /* HeightPreset.swift in Sources */,
96EA9A431D4E68F80052C74D /* PhotoLibrary.swift in Sources */,
96BCB7C61CB40DC500C806FE /* Icon.swift in Sources */,
96BCB7E91CB40DC500C806FE /* ToolbarController.swift in Sources */,
......
......@@ -37,6 +37,15 @@ public enum ContentViewAlignment: Int {
}
open class Bar: View {
/// Will render the view.
open var willLayout: Bool {
return 0 < width && 0 < height && nil != superview
}
open override var intrinsicContentSize: CGSize {
return CGSize(width: width, height: height)
}
/// Should center the contentView.
open var contentViewAlignment = ContentViewAlignment.any {
didSet {
......@@ -44,11 +53,6 @@ open class Bar: View {
}
}
/// Will render the view.
open var willLayout: Bool {
return 0 < width && 0 < height && nil != superview
}
/// A preset wrapper around contentEdgeInsets.
open var contentEdgeInsetsPreset: EdgeInsetsPreset {
get {
......@@ -88,10 +92,6 @@ open class Bar: View {
}
}
open override var intrinsicContentSize: CGSize {
return CGSize(width: width, height: 44)
}
/// Grid cell factor.
@IBInspectable
open var gridFactor: CGFloat = 12 {
......@@ -130,6 +130,9 @@ open class Bar: View {
return contentView.grid.views
}
set(value) {
for v in contentView.grid.views {
v.removeFromSuperview()
}
contentView.grid.views = value
}
}
......@@ -250,6 +253,7 @@ open class Bar: View {
*/
open override func prepare() {
super.prepare()
heightPreset = .default
autoresizingMask = .flexibleWidth
interimSpacePreset = .interimSpace3
contentEdgeInsetsPreset = .square1
......
......@@ -158,6 +158,7 @@ open class BottomNavigationController: UITabBarController, UITabBarControllerDel
/// Prepares the tabBar.
private func prepareTabBar() {
tabBar.heightPreset = .normal
tabBar.depthPreset = .depth1
tabBar.dividerAlignment = .top
let image = UIImage.image(with: Color.clear, size: CGSize(width: 1, height: 1))
......
......@@ -38,6 +38,10 @@ extension UITabBarItem {
}
open class BottomTabBar: UITabBar {
open override var intrinsicContentSize: CGSize {
return CGSize(width: width, height: height)
}
/// Automatically aligns the BottomNavigationBar to the superview.
open var isAlignedToParentAutomatically = true
......@@ -124,6 +128,7 @@ open class BottomTabBar: UITabBar {
when subclassing.
*/
public func prepare() {
heightPreset = .normal
depthPreset = .depth1
dividerAlignment = .top
contentScaleFactor = Device.scale
......
......@@ -150,6 +150,7 @@ open class Button: UIButton {
public convenience init(image: UIImage?, tintColor: UIColor = Color.blue.base) {
self.init()
prepare(with: image, tintColor: tintColor)
prepare()
}
/**
......@@ -160,6 +161,7 @@ open class Button: UIButton {
public convenience init(title: String?, titleColor: UIColor = Color.blue.base) {
self.init()
prepare(with: title, titleColor: titleColor)
prepare()
}
open override func layoutSublayers(of layer: CALayer) {
......@@ -259,7 +261,6 @@ open class Button: UIButton {
private func prepare(with image: UIImage?, tintColor: UIColor) {
self.image = image
self.tintColor = tintColor
pulseColor = tintColor
}
/**
......@@ -270,6 +271,5 @@ open class Button: UIButton {
private func prepare(with title: String?, titleColor: UIColor) {
self.title = title
self.titleColor = titleColor
pulseColor = titleColor
}
}
......@@ -59,18 +59,18 @@ public protocol ColorPalette {
open class Color: UIColor {
// dark text
open class darkText {
open static let primary = black.withAlphaComponent(0.87)
open static let secondary = black.withAlphaComponent(0.54)
open static let others = black.withAlphaComponent(0.38)
open static let dividers = black.withAlphaComponent(0.12)
open static let primary = Color.black.withAlphaComponent(0.87)
open static let secondary = Color.black.withAlphaComponent(0.54)
open static let others = Color.black.withAlphaComponent(0.38)
open static let dividers = Color.black.withAlphaComponent(0.12)
}
// light text
open class lightText {
open static let primary = white
open static let secondary = white.withAlphaComponent(0.7)
open static let others = white.withAlphaComponent(0.5)
open static let dividers = white.withAlphaComponent(0.12)
open static let primary = Color.white
open static let secondary = Color.white.withAlphaComponent(0.7)
open static let others = Color.white.withAlphaComponent(0.5)
open static let dividers = Color.white.withAlphaComponent(0.12)
}
// red
......
......@@ -48,7 +48,7 @@ open class Divider {
/// A reference to the height.
public var height: CGFloat
/// A UI
/// A UIColor.
open var color: UIColor? {
get {
return line?.backgroundColor
......
......@@ -293,4 +293,25 @@ extension UIView {
AssociateObject(base: self, key: &GridKey, value: value)
}
}
/// A reference to grid's layoutEdgeInsetsPreset.
open var layoutEdgeInsetsPreset: EdgeInsetsPreset {
get {
return grid.layoutEdgeInsetsPreset
}
set(value) {
grid.layoutEdgeInsetsPreset = value
}
}
/// A reference to grid's layoutEdgeInsets.
@IBInspectable
open var layoutEdgeInsets: EdgeInsets {
get {
return grid.layoutEdgeInsets
}
set(value) {
grid.layoutEdgeInsets = value
}
}
}
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
@objc(HeightPreset)
public enum HeightPreset: Int {
case tiny = 20
case xsmall = 28
case small = 36
case `default` = 44
case normal = 49
case medium = 52
case large = 60
case xlarge = 68
}
......@@ -34,25 +34,24 @@ internal class MaterialLayer {
/// A reference to the CALayer.
internal weak var layer: CALayer?
/// A property that sets the cornerRadius of the backing layer.
internal var cornerRadiusPreset = CornerRadiusPreset.none {
/// A property that sets the height of the layer's frame.
internal var heightPreset = HeightPreset.default {
didSet {
guard let v = layer else {
return
layer?.height = CGFloat(heightPreset.rawValue)
}
}
v.cornerRadius = CornerRadiusPresetToValue(preset: cornerRadiusPreset)
/// A property that sets the cornerRadius of the backing layer.
internal var cornerRadiusPreset = CornerRadiusPreset.none {
didSet {
layer?.cornerRadius = CornerRadiusPresetToValue(preset: cornerRadiusPreset)
}
}
/// A preset property to set the borderWidth.
internal var borderWidthPreset = BorderWidthPreset.none {
didSet {
guard let v = layer else {
return
}
v.borderWidth = BorderWidthPresetToValue(preset: borderWidthPreset)
layer?.borderWidth = BorderWidthPresetToValue(preset: borderWidthPreset)
}
}
......@@ -174,6 +173,16 @@ extension CALayer {
}
}
/// HeightPreset value.
open var heightPreset: HeightPreset {
get {
return materialLayer.heightPreset
}
set(value) {
materialLayer.heightPreset = value
}
}
/**
A property that manages the overall shape for the object. If either the
width or height property is set, the other will be automatically adjusted
......
......@@ -116,9 +116,9 @@ extension UIImage {
color.setFill()
context.fill(rect)
let image: UIImage = UIGraphicsGetImageFromCurrentImageContext()!
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image
return image?.withRenderingMode(.alwaysOriginal)
}
}
......@@ -136,7 +136,7 @@ extension UIImage {
UIRectFill(rect)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image
return image?.withRenderingMode(.alwaysOriginal)
}
}
......
......@@ -76,6 +76,16 @@ extension UIView {
}
}
/// HeightPreset value.
open var heightPreset: HeightPreset {
get {
return layer.heightPreset
}
set(value) {
layer.heightPreset = value
}
}
/**
A property that manages the overall shape for the object. If either the
width or height property is set, the other will be automatically adjusted
......
......@@ -30,36 +30,16 @@
import UIKit
/// NavigationBar styles.
@objc(NavigationBarStyle)
public enum NavigationBarStyle: Int {
case small
case medium
case large
}
open class NavigationBar: UINavigationBar {
open override var intrinsicContentSize: CGSize {
switch navigationBarStyle {
case .small:
return CGSize(width: Device.width, height: 32)
case .medium:
return CGSize(width: Device.width, height: 44)
case .large:
return CGSize(width: Device.width, height: 56)
}
}
/// NavigationBarStyle value.
open var navigationBarStyle = NavigationBarStyle.medium
internal var animating = false
/// Will render the view.
open var willLayout: Bool {
return 0 < width && 0 < height && nil != superview
}
open override var intrinsicContentSize: CGSize {
return CGSize(width: width, height: height)
}
/// A preset wrapper around contentEdgeInsets.
open var contentEdgeInsetsPreset = EdgeInsetsPreset.none {
didSet {
......@@ -301,6 +281,7 @@ open class NavigationBar: UINavigationBar {
when subclassing.
*/
open func prepare() {
heightPreset = .default
barStyle = .black
isTranslucent = false
depthPreset = .depth1
......
......@@ -208,6 +208,9 @@ extension UINavigationItem {
return navigationItem.contentView.grid.views
}
set(value) {
for v in navigationItem.contentView.grid.views {
v.removeFromSuperview()
}
navigationItem.contentView.grid.views = value
}
}
......
......@@ -146,11 +146,11 @@ open class PageTabBarController: RootController {
open override func layoutSubviews() {
super.layoutSubviews()
let p = pageTabBar.intrinsicContentSize.height + pageTabBar.grid.layoutEdgeInsets.top + pageTabBar.grid.layoutEdgeInsets.bottom
let p = pageTabBar.intrinsicContentSize.height + pageTabBar.layoutEdgeInsets.top + pageTabBar.layoutEdgeInsets.bottom
let y = view.height - p
pageTabBar.height = p
pageTabBar.width = view.width + pageTabBar.grid.layoutEdgeInsets.left + pageTabBar.grid.layoutEdgeInsets.right
pageTabBar.width = view.width + pageTabBar.layoutEdgeInsets.left + pageTabBar.layoutEdgeInsets.right
rootViewController.view.height = y
......
......@@ -34,8 +34,8 @@ internal struct Pulse {
/// An Array of layers.
internal lazy var layers = [CAShapeLayer]()
/// A UI
internal var color = Color.blueGrey.base
/// A UIColor.
internal var color = Color.grey.base
/// A reference to the PulseAnimation.
internal var animation = PulseAnimation.pointWithBacking
......
......@@ -56,11 +56,11 @@ open class SearchBarController: RootController {
open override func layoutSubviews() {
super.layoutSubviews()
searchBar.grid.layoutEdgeInsets.top = .phone == Device.userInterfaceIdiom && Device.isLandscape ? 0 : 20
searchBar.layoutEdgeInsets.top = .phone == Device.userInterfaceIdiom && Device.isLandscape ? 0 : 20
let p = searchBar.intrinsicContentSize.height + searchBar.grid.layoutEdgeInsets.top + searchBar.grid.layoutEdgeInsets.bottom
let p = searchBar.intrinsicContentSize.height + searchBar.layoutEdgeInsets.top + searchBar.layoutEdgeInsets.bottom
searchBar.width = view.width + searchBar.grid.layoutEdgeInsets.left + searchBar.grid.layoutEdgeInsets.right
searchBar.width = view.width + searchBar.layoutEdgeInsets.left + searchBar.layoutEdgeInsets.right
searchBar.height = p
rootViewController.view.y = p
......
......@@ -163,7 +163,7 @@ open class SnackbarController: RootController {
/// Reloads the view.
open func reload() {
snackbar.width = view.width
snackbar.height = snackbar.intrinsicContentSize.height + snackbar.grid.layoutEdgeInsets.top + snackbar.grid.layoutEdgeInsets.bottom
snackbar.height = snackbar.intrinsicContentSize.height + snackbar.layoutEdgeInsets.top + snackbar.layoutEdgeInsets.bottom
layoutSnackbar(status: snackbar.status)
}
......
......@@ -64,10 +64,6 @@ open class TabBar: Bar {
/// A delegation reference.
open weak var delegate: TabBarDelegate?
open override var intrinsicContentSize: CGSize {
return CGSize(width: width, height: 49)
}
/// The currently selected button.
open internal(set) var selected: UIButton?
......@@ -206,6 +202,7 @@ open class TabBar: Bar {
*/
open override func prepare() {
super.prepare()
heightPreset = .normal
contentEdgeInsetsPreset = .none
interimSpacePreset = .none
prepareLine()
......
......@@ -68,7 +68,7 @@ public protocol ToolbarControllerDelegate {
}
@objc(ToolbarController)
open class ToolbarController: RootController {
open class ToolbarController: StatusBarController {
open var display = Display.partial {
didSet {
layoutSubviews()
......@@ -167,12 +167,10 @@ open class ToolbarController: RootController {
open override func layoutSubviews() {
super.layoutSubviews()
toolbar.grid.layoutEdgeInsets.top = .phone == Device.userInterfaceIdiom && Device.isLandscape ? 0 : 20
toolbar.y = .phone == Device.userInterfaceIdiom && Device.isLandscape ? 0 : 20
toolbar.width = view.width
let p = toolbar.intrinsicContentSize.height + toolbar.grid.layoutEdgeInsets.top + toolbar.grid.layoutEdgeInsets.bottom
toolbar.width = view.width + toolbar.grid.layoutEdgeInsets.left + toolbar.grid.layoutEdgeInsets.right
toolbar.height = p
let p = toolbar.y + toolbar.height
switch display {
case .partial:
......
......@@ -56,30 +56,21 @@ public protocol ColorPalette {
optional static var accent4: NSColor { get }
}
open class Color {
// clear
open static let clear = NSclear
// white
open static let white = NSwhite
// black
open static let black = NSblack
open class Color: NSColor {
// dark text
open class darkText {
open static let primary = black.withAlphaComponent(0.87)
open static let secondary = black.withAlphaComponent(0.54)
open static let others = black.withAlphaComponent(0.38)
open static let dividers = black.withAlphaComponent(0.12)
open static let primary = Color.black.withAlphaComponent(0.87)
open static let secondary = Color.black.withAlphaComponent(0.54)
open static let others = Color.black.withAlphaComponent(0.38)
open static let dividers = Color.black.withAlphaComponent(0.12)
}
// light text
open class lightText {
open static let primary = white
open static let secondary = white.withAlphaComponent(0.7)
open static let others = white.withAlphaComponent(0.5)
open static let dividers = white.withAlphaComponent(0.12)
open static let primary = Color.white
open static let secondary = Color.white.withAlphaComponent(0.7)
open static let others = Color.white.withAlphaComponent(0.5)
open static let dividers = Color.white.withAlphaComponent(0.12)
}
// red
......
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