Commit 8c5de0bc by Daniel Dahan

updated NavigationBarView default text sizing to handle lowercase long letters.

parent 96df5177
......@@ -5,12 +5,19 @@ Please read it before you start participating.
**Topics**
* [Pull Request Submissions](#pull-request-submissions)
* [Asking Questions](#asking-questions)
* [Reporting Security Issues](#reporting-security-issues)
* [Reporting Issues](#reporting-other-issues)
* [Developers Certificate of Origin](#developers-certificate-of-origin)
* [Code of Conduct](#code-of-conduct)
<a href="#pull-request-submissions"></a>
## Pull Request Submissions.
All pull requests should be made to the development branch. Details should be available describing your fix. Before submitting a pull request, please confirm that merge issues are resolved.
<a href="#asking-questions"></a>
## Asking Questions
We don't use GitHub as a support forum.
......@@ -20,6 +27,7 @@ By doing so, you'll be more likely to quickly solve your problem,
and you'll allow anyone else with the same question to find the answer.
This also allows maintainers to focus on improving the project for others.
<a href="#reporting-security-issues"></a>
## Reporting Security Issues
CosmicMind takes security seriously.
......@@ -31,6 +39,7 @@ This will help ensure that any vulnerabilities that _are_ found
can be [disclosed responsibly](http://en.wikipedia.org/wiki/Responsible_disclosure)
to any affected parties.
<a href="#reporting-other-issues"></a>
## Reporting Other Issues
A great way to contribute to the project
......@@ -52,6 +61,7 @@ When reporting issues, please include the following:
This information will help us review and fix your issue faster.
<a href="#developers-certificate-of-origin"></a>
## Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
......
......@@ -51,12 +51,14 @@ class AppMenuViewController: MenuViewController {
override func openMenu(completion: (() -> Void)? = nil) {
super.openMenu(completion)
sideNavigationViewController?.enabled = false
mainViewController.view.alpha = 0.5
(menuView.menu.views?.first as? MaterialButton)?.animate(MaterialAnimation.rotate(0.125))
}
override func closeMenu(completion: (() -> Void)? = nil) {
super.closeMenu(completion)
sideNavigationViewController?.enabled = true
mainViewController.view.alpha = 1
(menuView.menu.views?.first as? MaterialButton)?.animate(MaterialAnimation.rotate(-0.125))
}
......
......@@ -58,7 +58,7 @@ class AppNavigationBarViewController: NavigationBarViewController {
/// Prepares view.
private func prepareView() {
view.backgroundColor = MaterialColor.white
view.backgroundColor = MaterialColor.black
}
/// Toggle SideNavigationViewController left UIViewController.
......@@ -68,11 +68,7 @@ class AppNavigationBarViewController: NavigationBarViewController {
/// Toggle SideNavigationViewController right UIViewController.
internal func handleSearchButton() {
guard let v: AppSearchBarViewController = AppSearchBarViewController(mainViewController: SearchListViewController()) else {
return
}
floatingViewController = v
floatingViewController = AppSearchBarViewController(mainViewController: SearchListViewController())
}
/// Prepares the navigationBarView.
......@@ -82,7 +78,7 @@ class AppNavigationBarViewController: NavigationBarViewController {
titleLabel.text = "Feed"
titleLabel.textAlignment = .Left
titleLabel.textColor = MaterialColor.white
titleLabel.font = RobotoFont.regularWithSize(20)
titleLabel.font = RobotoFont.regular
var image = UIImage(named: "ic_menu_white")
......
......@@ -43,9 +43,16 @@ class AppSearchBarViewController: SearchBarViewController {
prepareSearchBarView()
}
override func viewWillDisappear(animated: Bool) {
super.viewWillDisappear(animated)
sideNavigationViewController?.enabled = true
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
searchBarView.statusBarStyle = .Default
sideNavigationViewController?.delegate = self
sideNavigationViewController?.enabled = false
}
/// Toggle SideSearchViewController left UIViewController.
......@@ -97,8 +104,6 @@ class AppSearchBarViewController: SearchBarViewController {
moreButton.setImage(image, forState: .Highlighted)
moreButton.addTarget(self, action: "handleMoreButton", forControlEvents: .TouchUpInside)
searchBarView.statusBarStyle = .Default
searchBarView.delegate = self
searchBarView.placeholder = "Search"
searchBarView.tintColor = MaterialColor.blueGrey.darken4
......@@ -126,5 +131,6 @@ extension AppSearchBarViewController: TextFieldDelegate {
extension AppSearchBarViewController: SideNavigationViewControllerDelegate {
func sideNavigationViewDidClose(sideNavigationViewController: SideNavigationViewController, position: SideNavigationPosition) {
searchBarView.textField.becomeFirstResponder()
sideNavigationViewController.enabled = false
}
}
......@@ -34,8 +34,7 @@ import AVFoundation
class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDelegate {
lazy var captureView: CaptureView = CaptureView()
lazy var navigationBarView: NavigationBarView = NavigationBarView(frame: CGRectNull)
lazy var closeButton: FlatButton = FlatButton()
lazy var navigationBarView: NavigationBarView = NavigationBarView()
lazy var cameraButton: FlatButton = FlatButton()
lazy var videoButton: FlatButton = FlatButton()
lazy var switchCamerasButton: FlatButton = FlatButton()
......@@ -48,7 +47,6 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
prepareCaptureButton()
prepareCameraButton()
prepareVideoButton()
prepareCloseButton()
prepareSwitchCamerasButton()
prepareFlashButton()
prepareCaptureView()
......@@ -82,7 +80,6 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
func captureDidStartRecordingToOutputFileAtURL(capture: CaptureSession, captureOutput: AVCaptureFileOutput, fileURL: NSURL, fromConnections connections: [AnyObject]) {
print("Capture Started Recording \(fileURL)")
closeButton.hidden = true
cameraButton.hidden = true
videoButton.hidden = true
switchCamerasButton.hidden = true
......@@ -95,7 +92,6 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
func captureDidFinishRecordingToOutputFileAtURL(capture: CaptureSession, captureOutput: AVCaptureFileOutput, outputFileURL: NSURL, fromConnections connections: [AnyObject], error: NSError!) {
print("Capture Stopped Recording \(outputFileURL)")
closeButton.hidden = false
cameraButton.hidden = false
videoButton.hidden = false
switchCamerasButton.hidden = false
......@@ -247,7 +243,7 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
titleLabel.hidden = true
titleLabel.textAlignment = .Center
titleLabel.textColor = MaterialColor.white
titleLabel.font = RobotoFont.regularWithSize(20)
titleLabel.font = RobotoFont.regular
navigationBarView.titleLabel = titleLabel
// Detail label.
......@@ -256,17 +252,13 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
detailLabel.text = "Recording"
detailLabel.textAlignment = .Center
detailLabel.textColor = MaterialColor.red.accent1
detailLabel.font = RobotoFont.regularWithSize(12)
detailLabel.font = RobotoFont.regular
navigationBarView.detailLabel = detailLabel
navigationBarView.leftButtons = [closeButton]
navigationBarView.rightButtons = [switchCamerasButton, flashButton]
navigationBarView.leftControls = [switchCamerasButton]
navigationBarView.rightControls = [flashButton]
view.addSubview(navigationBarView)
navigationBarView.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignFromTop(view, child: navigationBarView)
MaterialLayout.alignToParentHorizontally(view, child: navigationBarView)
MaterialLayout.height(view, child: navigationBarView, height: 70)
}
/**
......@@ -313,16 +305,6 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
}
/**
:name: prepareCloseButton
*/
private func prepareCloseButton() {
let img: UIImage? = UIImage(named: "ic_close_white")
closeButton.pulseColor = nil
closeButton.setImage(img, forState: .Normal)
closeButton.setImage(img, forState: .Highlighted)
}
/**
:name: prepareSwitchCamerasButton
*/
private func prepareSwitchCamerasButton() {
......
......@@ -59,14 +59,14 @@ class ViewController: UIViewController {
titleLabel.text = "Material"
titleLabel.textAlignment = .Left
titleLabel.textColor = MaterialColor.white
titleLabel.font = RobotoFont.regularWithSize(17)
titleLabel.font = RobotoFont.regular
// Detail label.
let detailLabel: UILabel = UILabel()
detailLabel.text = "Build Beautiful Software"
detailLabel.textAlignment = .Left
detailLabel.textColor = MaterialColor.white
detailLabel.font = RobotoFont.regularWithSize(12)
detailLabel.font = RobotoFont.regular
var image = UIImage(named: "ic_menu_white")
......
......@@ -82,15 +82,14 @@ class AppNavigationBarViewController: NavigationBarViewController {
titleLabel.text = "Material"
titleLabel.textAlignment = .Left
titleLabel.textColor = MaterialColor.white
titleLabel.font = RobotoFont.regularWithSize(20)
titleLabel.font = RobotoFont.regular
// Detail label. Uncomment the code below to use a detail label.
// let detailLabel: UILabel = UILabel()
// detailLabel.text = "Build Beautiful Software"
// detailLabel.textAlignment = .Left
// detailLabel.textColor = MaterialColor.white
// detailLabel.font = RobotoFont.regularWithSize(12)
// titleLabel.font = RobotoFont.regularWithSize(17) // 17 point looks better with the detailLabel.
// detailLabel.font = RobotoFont.regular
// navigationBarView.detailLabel = detailLabel
var image = UIImage(named: "ic_menu_white")
......
......@@ -96,7 +96,7 @@ class ViewController: UIViewController {
searchBarView.tintColor = MaterialColor.blueGrey.darken4
searchBarView.textColor = MaterialColor.blueGrey.darken4
searchBarView.placeholderTextColor = MaterialColor.blueGrey.darken4
searchBarView.textField.font = RobotoFont.regularWithSize(17)
searchBarView.textField.font = RobotoFont.regularWithSize(20)
searchBarView.clearButton = clearButton
searchBarView.leftControls = [backButton]
......
......@@ -126,7 +126,7 @@ class AppSearchBarViewController: SearchBarViewController {
searchBarView.tintColor = MaterialColor.blueGrey.darken4
searchBarView.textColor = MaterialColor.blueGrey.darken4
searchBarView.placeholderTextColor = MaterialColor.blueGrey.darken4
searchBarView.textField.font = RobotoFont.regularWithSize(17)
searchBarView.textField.font = RobotoFont.regularWithSize(20)
searchBarView.textField.delegate = self
searchBarView.clearButton = clearButton
......
......@@ -72,7 +72,7 @@ class ViewController: UIViewController {
titleLabel.text = "Material"
titleLabel.textAlignment = .Left
titleLabel.textColor = MaterialColor.white
titleLabel.font = RobotoFont.regularWithSize(17)
titleLabel.font = RobotoFont.regular
navigationBarView.titleLabel = titleLabel
// Detail label.
......@@ -80,7 +80,7 @@ class ViewController: UIViewController {
detailLabel.text = "Build Beautiful Software"
detailLabel.textAlignment = .Left
detailLabel.textColor = MaterialColor.white
detailLabel.font = RobotoFont.regularWithSize(12)
detailLabel.font = RobotoFont.regular
navigationBarView.detailLabel = detailLabel
// Menu button.
......
Pod::Spec.new do |s|
s.name = 'Material'
s.version = '1.34.0'
s.version = '1.34.1'
s.license = 'BSD'
s.summary = 'Express your creativity with Material, an animation and graphics framework for Google\'s Material Design and Apple\'s Flat UI in Swift.'
s.homepage = 'http://cosmicmind.io'
......
......@@ -12,7 +12,7 @@ Express your creativity with Material, an animation and graphics framework for G
- [x] Grid System For Complex UIs
- [x] Layout Library To Simplify AutoLayout
- [x] Base Material Layers & Material Views To Create New UI Components
- [x] Navigation Controls
- [x] Navigation Controllers
- [x] Material Buttons
- [x] Material Switch
- [x] Material Card Views
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.34.0</string>
<string>1.34.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -73,34 +73,22 @@ public class NavigationBarView : StatusBarView {
grid.axis.columns = Int(width / 48)
// General alignment.
if UIApplication.sharedApplication().statusBarOrientation.isLandscape {
// TitleView alignment.
if let v: UILabel = titleLabel {
if let d: UILabel = detailLabel {
v.grid.rows = 7
d.grid.rows = 5
contentView.grid.spacing = 4
contentView.grid.contentInset.top = -3
} else {
v.grid.rows = 12
contentView.grid.spacing = 0
contentView.grid.contentInset.top = 0
}
}
} else {
// TitleView alignment.
if let v: UILabel = titleLabel {
if let d: UILabel = detailLabel {
v.grid.rows = 7
d.grid.rows = 5
contentView.grid.spacing = 4
contentView.grid.contentInset.top = -3
} else {
v.grid.rows = 12
contentView.grid.spacing = 0
contentView.grid.contentInset.top = 0
}
// TitleView alignment.
if let v: UILabel = titleLabel {
if let d: UILabel = detailLabel {
v.grid.rows = 2
v.font = v.font.fontWithSize(17)
d.grid.rows = 2
d.font = d.font.fontWithSize(12)
contentView.grid.axis.rows = 3
contentView.grid.spacing = -8
contentView.grid.contentInset.top = -8
} else {
v.grid.rows = 1
v.font = v.font.fontWithSize(20)
contentView.grid.axis.rows = 1
contentView.grid.spacing = 0
contentView.grid.contentInset.top = 0
}
}
......@@ -111,7 +99,6 @@ public class NavigationBarView : StatusBarView {
public override func reloadView() {
super.reloadView()
contentView.grid.views = []
contentView.grid.axis.rows = 6
if let v: UILabel = titleLabel {
contentView.grid.views?.append(v)
}
......@@ -130,6 +117,7 @@ public class NavigationBarView : StatusBarView {
*/
public override func prepareView() {
super.prepareView()
contentView.grid.axis.inherited = false
contentView.grid.axis.direction = .Vertical
}
......
......@@ -62,6 +62,7 @@ public class NavigationBarViewController: UIViewController {
}
set(value) {
if let v: UIViewController = internalFloatingViewController {
internalFloatingViewController = nil
UIView.animateWithDuration(0.5,
animations: { [unowned self] in
v.view.center.y = 2 * self.view.bounds.height
......@@ -71,7 +72,6 @@ public class NavigationBarViewController: UIViewController {
v.willMoveToParentViewController(nil)
v.view.removeFromSuperview()
v.removeFromParentViewController()
self.internalFloatingViewController = nil
self.userInteractionEnabled = true
self.navigationBarView.userInteractionEnabled = true
}
......@@ -89,16 +89,15 @@ public class NavigationBarViewController: UIViewController {
// Animate the noteButton out and the noteViewController! in.
v.view.hidden = false
internalFloatingViewController = v
userInteractionEnabled = false
navigationBarView.userInteractionEnabled = false
UIView.animateWithDuration(0.5,
animations: { [unowned self] in
v.view.center.y = self.view.bounds.height / 2
self.navigationBarView.alpha = 0.5
self.mainViewController.view.alpha = 0.5
}) { [unowned self] _ in
self.userInteractionEnabled = false
self.navigationBarView.userInteractionEnabled = false
self.internalFloatingViewController = v
}
})
}
}
}
......
......@@ -90,15 +90,6 @@ public class SearchBarView : StatusBarView {
grid.axis.columns = Int(width / 48)
// General alignment.
if UIApplication.sharedApplication().statusBarOrientation.isLandscape {
grid.contentInset.top = 8
height = 44
} else {
grid.contentInset.top = 28
height = 64
}
reloadView()
}
......@@ -126,12 +117,6 @@ public class SearchBarView : StatusBarView {
*/
public override func prepareView() {
super.prepareView()
grid.spacing = 8
grid.axis.inherited = false
grid.contentInset.left = 8
grid.contentInset.bottom = 8
grid.contentInset.right = 8
depth = .Depth1
prepareTextField()
}
......
......@@ -59,13 +59,14 @@ public class StatusBarView : ControlView {
width = UIScreen.mainScreen().bounds.width
reloadView()
if frame.origin.x != oldFrame!.origin.x || frame.origin.y != oldFrame!.origin.y || frame.width != oldFrame!.width || frame.height != oldFrame!.height {
if nil != delegate {
statusBarViewDidChangeLayout()
}
oldFrame = frame
}
reloadView()
}
public override func intrinsicContentSize() -> CGSize {
......
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